winlibs_mingw icon indicating copy to clipboard operation
winlibs_mingw copied to clipboard

the selected build of GDB does not support Python scripting. it cannot be used in qt creator.

Open mumin16 opened this issue 4 years ago • 112 comments

the selected build of GDB does not support Python scripting. it cannot be used in qt creator.

mumin16 avatar Mar 06 '20 16:03 mumin16

in clion:

Error during pretty printers setup: Undefined info command: "pretty-printer". Try "help info".

mumin16 avatar Mar 13 '20 17:03 mumin16

I see now that GDB was built without python (and also without tcl and tk). I will try to build with them. Right now I'm compiling the new GCC 9.3, so I will see if I can get this sorted for GDB for the next winlibs personal build release.

brechtsanders avatar Mar 13 '20 20:03 brechtsanders

I just tried with GDB included built with --with-python. It now also contains a file pretty_printers.py, but I'm not sure if the path in the package should be: mingw64/share/gdb/share/gdb/python/gdb/command/pretty_printers.py or: mingw64/share/gdb/python/gdb/command/pretty_printers.py Do you know this?

Also, if I make a release with this gdb will be broken for the users that download it as it will fail to start because the Python DLL file is missing, and I don't intend to distribute an entire Python in the package.

brechtsanders avatar Mar 14 '20 08:03 brechtsanders

The second one mingw64/share/gdb/python/gdb/command/pretty_printers.py should be the right path.

anb0s avatar Mar 14 '20 16:03 anb0s

Also, if I make a release with this gdb will be broken for the users that download it as it will fail to start because the Python DLL file is missing, and I don't intend to distribute an entire Python in the package.

You can use the Embedded Python and copy only the python38.dll and python38.zip from the zip file to /bin. This is not that big ~6 MB.

I did it manually for my own GDB build and it worked. I do not know if a patch was needed, as i have no access to my PC...

anb0s avatar Mar 14 '20 16:03 anb0s

The concept behind winlibs is that every dependancy is built from source. That way everything is built with the same compiler and linked with the same standard C/C++ libraries. So far I haven't build Python from source yet, but maybe I should give it another try.

brechtsanders avatar Mar 14 '20 16:03 brechtsanders

As you mentioned the Python DLL is missing and must be copied by user: image

anb0s avatar Mar 25 '20 16:03 anb0s

After adding python.dll etc. GDB starts, but it misses the files, looks like path d:\r\winlibs64-9.3.0-7.0.0\inst_gdb-9.1\share\gdb\share\gdb/python is hardcoded?

d:\git\s7p\work2\s7p.tools\win64_gcc_mingw64_9.3.0\bin>gdb
Python Exception <class 'ModuleNotFoundError'> No module named 'gdb':
d:\git\s7p\work2\s7p.tools\win64_gcc_mingw64_9.3.0\bin\gdb.exe: warning:
Could not load the Python gdb module from `d:\r\winlibs64-9.3.0-7.0.0\inst_gdb-9.1\share\gdb\share\gdb/python'.
Limited Python support is available from the _gdb module.
Suggest passing --data-directory=/path/to/gdb/data-directory.
GNU gdb (GDB for MinGW-W64 x86_64, built by Brecht Sanders) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)

anb0s avatar Mar 25 '20 16:03 anb0s

It also be good if it can be compiled with Python 3.7 (python3.7.dll) or 3.8 (python3.8.dll)...

anb0s avatar Mar 25 '20 16:03 anb0s

I haven't tested this at all. It is very well possible that compiling this in uses absolute paths. For now I will not put any more effort in this as Python or CPython won't build yet in my environment, and the main focus of winlibs is compiled languages like C and C++ and the goal is to build every component in the same environment.

Once I get CPython to compile I may reavaluate. Currently I got 3.8.2 to compile, but linking fails with some undefined references.

brechtsanders avatar Mar 25 '20 17:03 brechtsanders

Thank You for the effort! If you have a new version i would be happy to test it :)

anb0s avatar Mar 25 '20 19:03 anb0s

Any news about python support?

nenin-sc avatar May 17 '20 19:05 nenin-sc

I wonder why they require python support in QtCreator in the first place.

Trass3r avatar Oct 14 '20 15:10 Trass3r

Is it possible to help with this issue? I can find no build or packaging scripts so I don't know how to experiment with solving this issue.

krsch avatar Jan 15 '21 13:01 krsch

Is it possible to help with this issue? I can find no build or packaging scripts so I don't know how to experiment with solving this issue.

https://github.com/niXman/mingw-builds This repo provides build scripts with Python support. I've tried these scripts, and built MinGW with GCC 10.2.0 successfully.

guyutongxue avatar Jan 16 '21 01:01 guyutongxue

@brechtsanders I'm currently in the process of adding Python support to the llvm-mingw toolchain. If you wanna add support for Python in your toolchain, check out the MSYS2 patchset for python3. It should allow you to build Python from source. Just apply all the patches, run autoreconf -fi and configure like usual. Have a look at the PKGBUILD file in the patchset for the configure options.

longnguyen2004 avatar Feb 14 '21 13:02 longnguyen2004

Any update on this issue? I would love to move from MinGW builds to your package, but missing Python support is a blocker.

emiro85 avatar Jun 14 '21 11:06 emiro85

Still unable to build python/cpython in my environment :-(

I need to find time to go through the patches in the links you sent...

brechtsanders avatar Jun 14 '21 11:06 brechtsanders

You can have a look at our Python build script here In short, we basically build a native cpython, then we build libffi and cpython for mingw-w64, using the patchset from MSYS2. After that, we removed a few stuff to reduce the size of the package (namely the test module and the bytecode cache). As we don't build gdb, I don't know what flags are required for Python support in gdb, but I think you can figure it out.

longnguyen2004 avatar Jun 14 '21 12:06 longnguyen2004

try to use this version of minGW https://nim-lang.org/install_windows.html

hamidb80 avatar Jun 15 '21 06:06 hamidb80

@hamidb80 What do you mean exactly? https://winlibs.com/ provides a standalone build of the latest MinGW-w64 version (currently 9.0.0). The download on the link you mention seems to be an older winlibs release (MinGW-w64 8.0.2).

brechtsanders avatar Jun 15 '21 08:06 brechtsanders

@hamidb80 What do you mean exactly? https://winlibs.com/ provides a standalone build of the latest MinGW-w64 version (currently 9.0.0). The download on the link you mention seems to be an older winlibs release (MinGW-w64 8.0.2).

it supports GDB scripting [I think that's what you wanted, right? ]

it has pretty printing, ... - it meets my needs, maybe it fit for you also

hamidb80 avatar Jun 15 '21 10:06 hamidb80

@hamidb80 No, this question is specifically about Python support in GDB. Since the https://nim-lang.org/install_windows.html is an earlier download from https://winlibs.com/ that was renamed, it doesn't have this either.

brechtsanders avatar Jun 15 '21 17:06 brechtsanders

@hamidb80 No, this question is specifically about Python support in GDB. Since the https://nim-lang.org/install_windows.html is an earlier download from https://winlibs.com/ that was renamed, it doesn't have this either.

They have a debugger that is based on gdb scripting with python

hamidb80 avatar Jun 15 '21 18:06 hamidb80

Guyutongxue made a perfect bundle with a complete mingw-w64 toolchain. It works perfectly with Qt Creator.

xtemp09 avatar Jul 01 '21 03:07 xtemp09

Any news on python support? LLVM 12.0.1 has been released.

Using your toolchain, I compiled clang with default targetting libc++ instead of libstdc++, using Win32 threads instead of pthreads and libc++abi instead of libgcc_s (the compilation process contains a flaw, libc++abi prefers pthreads, it needs to be set off explicitly).

With Guyutongxue's bundle I made clangless gcc and gccless clang (clang defaults to compiler-rt).

xtemp09 avatar Jul 21 '21 13:07 xtemp09

Any news on python support?

xtemp09 avatar Oct 07 '21 06:10 xtemp09

I have been trying to build the latest Python earlier this week, and while compiling works there are still some missing symbols when linking. I will only include Python support if I get Python to build with the same build tools.

brechtsanders avatar Oct 07 '21 08:10 brechtsanders

Will python scripting in gdb & lldb be implemented before New Year's day?

xtemp09 avatar Dec 11 '21 11:12 xtemp09

No. Python still won't build due the winlibs way. But from time to time I try to get it to build (last time was last week when Python 3.11.0a1 came out).

brechtsanders avatar Dec 11 '21 12:12 brechtsanders