No debugger support available lazarus / 65-FV-Textmode IDE ---------------------------------------------------------------------- Moody · 2018-04-13 15:26 Hi folks, i try to compile fp from source to get debugger support into the textmode ide. Everything works fine if i add "NOGDB=1" to the build instruction but of course, then the debugger support is missing. When compiling with GDBLIBDIR=/usr/lib set, libgdb.a is recognized but at the end i get a lot of linking errors. It looks like the libgdb.a referes to modules which are not linked. There were a lot of references to functions of Python so I recompiled gdb without Python support (./configure ... --with-python=no). The references to Python functions are gone. But there is still stuff missing: ---- ... /usr/lib/libgdb.a(tui-file.o): In Funktion »tui_file::~tui_file()«: (.text._ZN8tui_fileD0Ev[_ZN8tui_fileD5Ev]+0x1a): Warnung: undefinierter Verweis auf »operator delete(void*, unsigned long)« /usr/lib/libgdb.a(tui-file.o): Warnung: undefinierter Verweis auf »vtable for __cxxabiv1::__si_class_type_info« /usr/lib/libgdb.a(cp-name-parser.o): In Funktion »cp_demangled_name_to_comp(char const*, char const**)«: (.text+0x448f): Warnung: undefinierter Verweis auf »operator delete(void*, unsigned long)«  Warnung: undefinierter Verweis auf »operator delete(void*, unsigned long)«  Warnung: undefinierter Verweis auf »_Unwind_Resume« /usr/lib/libgdb.a(cp-name-parser.o): Warnung: undefinierter Verweis auf »__gxx_personality_v0« /usr/lib/libgdb.a(f-exp.o): In Funktion »f_parse(parser_state*)«: (.text+0x1f76): Warnung: undefinierter Verweis auf »_Unwind_Resume« /usr/lib/libgdb.a(f-exp.o): Warnung: undefinierter Verweis auf »__gxx_personality_v0« /usr/lib/libbfd.a(compress.o): In Funktion »decompress_contents«: (.text+0x4c): Warnung: undefinierter Verweis auf »inflateInit_«  Warnung: undefinierter Verweis auf »inflateReset«  Warnung: undefinierter Verweis auf »inflate«  Warnung: undefinierter Verweis auf »inflateEnd« /usr/lib/libbfd.a(compress.o): In Funktion »bfd_compress_section_contents«: (.text+0x6ac): Warnung: undefinierter Verweis auf »compressBound«  Warnung: undefinierter Verweis auf »compress« fp.pas(581,1) Error: Error while linking fp.pas(581,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted make[3]: *** [Makefile:2224: all] Fehler 1 make[3]: Verzeichnis „/tmp/fpc/build/fpcbuild-3.0.4/fpcsrc/ide“ wird verlassen make[2]: *** [Makefile:2657: ide_all] Fehler 2 make[2]: Verzeichnis „/tmp/fpc/build/fpcbuild-3.0.4/fpcsrc“ wird verlassen make[1]: *** [Makefile:2821: build-stamp.x86_64-linux] Fehler 2 make[1]: Verzeichnis „/tmp/fpc/build/fpcbuild-3.0.4/fpcsrc“ wird verlassen make: *** [Makefile:2187: fpcsrc/build-stamp.x86_64-linux] Fehler 2 ---- So, my question is: What are the requirements on how gdb has to be installed or where can i add libraries in the FP build system so they get linked into? I'm not that familar with FP's build system. "inflateReset" seems to be defined in zlib, so i might need to link it somehow into FP. Any ideas on how to touch base on this? Thanks! Btw, its on a Linux From Scratch, gdb-8.1, fpc-3.0.4 ---------------------------------------------------------------------- Cyrax · 2018-04-14 10:06 Hmm, the textmode IDE should use GDB MI interface automatically. So there should be no need for building GDB library. What kind of commands and options are you feeding to make utility? ---------------------------------------------------------------------- Thaddy · 2018-04-14 16:15 Indeed, NOGDB=1 is wrong. IF gdb is installed, there should be no need for old style debugger support (libgdb) since fpc3.0.4 uses gdb/mi as default, which calls the external gdb. What does "whereis gdb" say? It should say something like this: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ~ $ whereis gdbgdb: /usr/bin/gdb /etc/gdb /usr/include/gdb /usr/share/gdbIf it says something like that: leave out the NOGDB=1. If it does not, you have a wrong gdb install or a very old linux installed. In the last case try also: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ~ $ gdb --versionGNU gdb (Raspbian 7.12-6) 7.12.0.20161007-gitIf the version is below 7.12 you know you have an old linux but it should work provided: If it is even below 7.0.0  gdb/mi will not work at all. In that case simply install libgdb and libgdb-dev and it will still work with "GDBMI=0". Note that is not recommended: all the latest major stable Linux distributions including all LTE ones support gdb 7+ for the past two years. ---------------------------------------------------------------------- Moody · 2018-04-14 18:50 gdb is here: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i lfs@lfs-x86_64-1:~$ whereis gdbgdb: /usr/bin/gdb /usr/include/gdb /usr/share/gdb /usr/share/man/man1/gdb.1 /usr/share/info/gdb.info-2 /usr/share/info/gdb.info-1 /usr/share/info/gdb.info-4 /usr/share/info/gdb.info-6 /usr/share/info/gdb.info-7 /usr/share/info/gdb.info /usr/share/info/gdb.info-3 /usr/share/info/gdb.info-5  version is: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i lfs@lfs-x86_64-1:~$ gdb --versionGNU gdb (GDB) 8.1...This GDB was configured as "x86_64-pc-linux-gnu".... Its all pretty new, linux-4.15.3, gcc-7.3.0, glibc-2.27, etc. The commands i use to rebuild fp is Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i pushd fpcsrc/compilerfpcmake -Tallpopdexport GDBLIBDIR=/usr/libmake buildmake install -j1 When leaving the GDBLIBDIR var unset, fpc builds fine but without debugging support. Doing so, the build log contains Code: [Select]... Makefile:2425: Using system default libgdb file located in /usr/lib/libgdb.a ... [ 47%] Compiled package fv Start compiling package gdbint for target x86_64-linux. File libgdb.a not found        Compiling gdbint/src/gdbint.pp        Compiling gdbint/src/gdbcon.pp [ 47%] Compiled package gdbint ... Installation package fv for target x86_64-linux succeeded Start compiling package gdbint for target x86_64-linux. File libgdb.a not found Compiled package gdbint Installing package gdbint Installation package gdbint for target x86_64-linux succeeded ... Complete log is at https://pastebin.com/54vReYnk What does "uses gdb/mi by default" mean? Is that /mi something in addition to gdb or is it a module within fp? ---------------------------------------------------------------------- Thaddy · 2018-04-14 18:57 The export is not necessary. gdb is installed correctly, simply do: delete /etc/fpc.cfg (optional), then in the fpc source root directory : Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make clean all installand everything should be ok. gdb/mi means it uses the - somewhat newer - scripting feature that uses the API from the gdb executable directly instead of linking to the libgdb. That has several advantages.  See: https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI.html or google gdb/mi. You will find that for other languages the IDE's are moving to it too. And don't use fpcmake! Use make ---------------------------------------------------------------------- Moody · 2018-04-14 21:33 Unfortunatly, this did not work. make clean all install runs fine - but result shows the wellknown "No debugger support available"  :-( ---------------------------------------------------------------------- Moody · 2018-04-15 12:33 i patched fpcbuild-3.0.4/fpcsrc/ide/bin/x86_64-linux/link.res to contain Code: [Select]INPUT( -lncurses -lm -ldl -lgcc -lz -lpython3 ) (adding -lpython3 and -lz) and linking gets a step further: Code: [Select]pcbuild-3.0.4/fpcsrc/packages/gdbint/units/x86_64-linux/ -Ficompiler -Fl/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0 -Cg -Ur -dNOCATCH -dBrowserCol -dGDB -dx86_64 -Fu../compiler -Fu../compiler/x86_64 -Fu../compiler/targets -Fu../compiler/systems -Fi../compiler/x86_64 -Fi../compiler -Fu../compiler/x86 -dNOOPT -Sg -Fl/usr/lib/ -Xd -viq fp.pas" failed with exit code 256. Console output: Free Pascal Compiler version 3.0.4 [2018/04/14] for x86_64 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling fp.pas Writing Resource String Table file: fp.rsj Linking bin/x86_64-linux/fp /usr/bin/ld: warning: bin/x86_64-linux/link.res contains output sections; did you forget -T? fp.pas(581,1) Error: Error while linking fp.pas(581,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted /usr/lib/libgdb.a(main.o): Mehrfachdefinition von »interpreter_p« /home/lfs/fpcbuild-3.0.4/fpcsrc/packages/gdbint/units/x86_64- linux/gdbint.o: hier zuerst definiert /usr/lib/libgdb.a(main.o): Mehrfachdefinition von »gdb_stdtarg« /home/lfs/fpcbuild-3.0.4/fpcsrc/packages/gdbint/units/x86_64- linux/gdbint.o: hier zuerst definiert /usr/lib/libgdb.a(top.o): Mehrfachdefinition von »deprecated_query_hook« /home/lfs/fpcbuild-3.0.4/fpcsrc/packages/gdbint/units/x86_64- linux/gdbint.o: hier zuerst definiert /usr/bin/ld: /usr/lib/libgdb.a(varobj.o): undefined reference to symbol 'PyImport_AddModule' /usr/lib64/libpython3.6m.so.1.0: error adding symbols: DSO missing from command line make: *** [Makefile:2224: all] Fehler 1 No luck at all ---------------------------------------------------------------------- Thaddy · 2018-04-15 12:46 make sure /etc/fpc.cfg is deleted and search for others. Delete these too. Then force GDBMI like so: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make clean all install GDBMI=1Since GDB/MI uses the GDB executable, the compiler will not look for it at compile time but instead includes just the GDB/MI interface. Note this assumes the bitness for GDB is correct: 32 bit for a 32 bit system 64 bit for a 64 bit system. On multiarch you probably need both. Quite a mess. This should not be not at all necessary. ---------------------------------------------------------------------- marcov · 2018-04-15 12:55 gdbmi in the IDE is a trunk feature, and not available in 3.0.x Linking libgdb is very dependent on options the libgdb was compiled with, and gdbint can be edited somewhat to match, but this is not trivial. Compiling yourself without python support should be easier ---------------------------------------------------------------------- Moody · 2018-04-15 14:27 ah, now it seems we come closer :-) Ok, if it is not yet in 3.0.x ... that might be the reason why my build constantly looks for libgdb.a while it has been said that it wouldn't. Hope that it will come soon. ---------------------------------------------------------------------- Moody · 2018-04-16 07:34 Just to close this thread: with svn checkout it works perfectly.  Just do Code: [Select]svn checkout http://svn.freepascal.org/svn/fpc/trunk fpc cd fpc make clean make all make install Have fun with debugging within fp    Hope that fpc-3.1.1 et.al. will be released soon. ---------------------------------------------------------------------- segfault · 2019-12-30 17:28 I also got a 'no debugger support available' message so I tried following the above steps. Unfortunately I got an error at the 'make all' step. Any suggestions what I could try next? Actually I don't want trunk, but 3.2. I'm using Linux 64 ---------------------------------------------------------------------- Cyrax · 2019-12-30 17:30 Quote from: segfault on December 30, 2019, 06:28:43 pmI also got a 'no debugger support available' message so I tried following the above steps. Unfortunately I got an error at the 'make all' step. Any suggestions what I could try next? Actually I don't want trunk, but 3.2. What kind of error message you got? ---------------------------------------------------------------------- segfault · 2019-12-30 17:52 Ok I just downloaded it again and this time it compiled successfully. I haven't done 'make install' yet because I have 3.04 on my system. Do I need to remove it first? I didn't install it using apt-get so I guess I'll have to remove the files manually? Any advice? Thanks. ---------------------------------------------------------------------- segfault · 2019-12-30 18:29 I installed 3.2 using fpcupdeluxe but got the same message - no debugger support available. ---------------------------------------------------------------------- segfault · 2019-12-30 21:01 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i svn checkout http://svn.freepascal.org/svn/fpc/trunk fpccd fpcmake cleanmake allmake install How do I install to a folder other than the default? I want to install to /usr/local/ ---------------------------------------------------------------------- Cyrax · 2019-12-30 21:13 make install INSTALL_PREFIX="/usr/local/fpc" ---------------------------------------------------------------------- segfault · 2019-12-30 21:55 Thanks. I've installed 3.2 but now when I try to run it I get this message : QuoteError: ppcx64 can't be executed, error message: Failed to execute "ppcx64", error code: 127 'which ppcx64' returns nothing. ---------------------------------------------------------------------- segfault · 2019-12-30 22:15 I can start the IDE and the debugger works fine. I know that the IDE uses its own version of the compiler but why can't I run fpc from the command line? Why is it always so damn hard to get fpc working again whenever you change anything? ---------------------------------------------------------------------- segfault · 2019-12-31 08:33 So it seems this is a bug. The compiler files aren't being copied to /usr/local/bin. https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/issues/11