Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python undefined reference when compiling for gdb 7.11.x #24

Closed
sadaaithal opened this issue Oct 2, 2020 · 1 comment
Closed

python undefined reference when compiling for gdb 7.11.x #24

sadaaithal opened this issue Oct 2, 2020 · 1 comment

Comments

@sadaaithal
Copy link

Hi
It would help if you could share the detailed steps on how to build from scratch.
Ive tried a lot of things but keep ending up with something like this

gcc -g -O2      \
        -o gdb gdb.o amd64-tdep.o amd64-linux-tdep.o i386-tdep.o i387-tdep.o i386-linux-tdep.o glibc-tdep.o solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o ser-base.o ser-unix.o ser-pipe.o ser-tcp.o inf-ptrace.o fork-child.o x86-nat.o x86-dregs.o amd64-nat.o amd64-linux-nat.o x86-linux-nat.o linux-nat.o linux-osdata.o proc-service.o linux-thread-db.o linux-fork.o linux-procfs.o linux-ptrace.o linux-btrace.o linux-waitpid.o linux-personality.o x86-linux.o x86-linux-dregs.o amd64-linux-siginfo.o linux-namespaces.o remote.o dcache.o tracepoint.o ax-general.o ax-gdb.o remote-fileio.o remote-notif.o ctf.o tracefile.o tracefile-tfile.o  cli-dump.o cli-decode.o cli-script.o cli-cmds.o cli-setshow.o cli-logging.o cli-interp.o cli-utils.o mi-out.o mi-console.o mi-cmds.o mi-cmd-catch.o mi-cmd-env.o mi-cmd-var.o mi-cmd-break.o mi-cmd-stack.o mi-cmd-file.o mi-cmd-disas.o mi-symbol-cmds.o mi-cmd-target.o mi-cmd-info.o mi-interp.o mi-main.o mi-parse.o mi-getopt.o tui-command.o tui-data.o tui-disasm.o tui-file.o tui-hooks.o tui-interp.o tui-io.o tui-layout.o tui-out.o tui-regs.o tui-source.o tui-stack.o tui-win.o tui-windata.o tui-wingeneral.o tui-winsource.o tui.o python.o py-arch.o py-auto-load.o py-block.o py-bpevent.o py-breakpoint.o py-cmd.o py-continueevent.o py-xmethods.o py-event.o py-evtregistry.o py-evts.o py-exitedevent.o py-finishbreakpoint.o py-frame.o py-framefilter.o py-function.o py-gdb-readline.o py-inferior.o py-infevents.o py-infthread.o py-lazy-string.o py-linetable.o py-newobjfileevent.o py-objfile.o py-param.o py-prettyprint.o py-progspace.o py-signalevent.o py-stopevent.o py-symbol.o py-symtab.o py-threadevent.o py-type.o py-unwind.o py-utils.o py-value.o py-varobj.o guile.o elfread.o stap-probe.o dtrace-probe.o posix-hdep.o posix-strerror.o c-exp.o cp-name-parser.o ada-exp.o jv-exp.o d-exp.o f-exp.o go-exp.o m2-exp.o p-exp.o version.o annotate.o addrmap.o auto-load.o auxv.o agent.o bfd-target.o blockframe.o breakpoint.o break-catch-sig.o break-catch-throw.o break-catch-syscall.o findvar.o regcache.o cleanups.o charset.o continuations.o corelow.o disasm.o dummy-frame.o dfp.o source.o value.o eval.o valops.o valarith.o valprint.o printcmd.o block.o symtab.o psymtab.o symfile.o symfile-debug.o symmisc.o linespec.o dictionary.o namespace.o location.o infcall.o infcmd.o infrun.o expprint.o environ.o stack.o tid-parse.o thread.o thread-fsm.o exceptions.o extension.o filesystem.o filestuff.o inf-child.o interps.o minidebug.o main.o macrotab.o macrocmd.o macroexp.o macroscope.o mi-common.o event-loop.o event-top.o inf-loop.o completer.o gdbarch.o arch-utils.o gdbtypes.o gdb_bfd.o gdb_obstack.o osabi.o copying.o memattr.o mem-break.o target.o target-dcache.o parse.o language.o build-id.o buildsym.o findcmd.o std-regs.o signals.o exec.o reverse.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o dbxread.o coffread.o coff-pe-read.o dwarf2read.o mipsread.o stabsread.o corefile.o dwarf2expr.o dwarf2loc.o dwarf2-frame.o dwarf2-frame-tailcall.o ada-lang.o c-lang.o d-lang.o f-lang.o objc-lang.o ada-tasks.o ada-varobj.o c-varobj.o ui-out.o cli-out.o varobj.o vec.o go-lang.o go-valprint.o go-typeprint.o jv-lang.o jv-valprint.o jv-typeprint.o jv-varobj.o m2-lang.o opencl-lang.o p-lang.o p-typeprint.o p-valprint.o sentinel-frame.o complaints.o typeprint.o ada-typeprint.o c-typeprint.o f-typeprint.o m2-typeprint.o ada-valprint.o c-valprint.o cp-valprint.o d-valprint.o f-valprint.o m2-valprint.o serial.o mdebugread.o top.o utils.o ui-file.o user-regs.o frame.o frame-unwind.o doublest.o frame-base.o inline-frame.o gnu-v2-abi.o gnu-v3-abi.o cp-abi.o cp-support.o cp-namespace.o d-namespace.o reggroups.o trad-frame.o tramp-frame.o solib.o solib-target.o prologue-value.o memory-map.o memrange.o xml-support.o xml-syscall.o xml-utils.o target-descriptions.o target-memory.o xml-tdesc.o xml-builtin.o inferior.o osdata.o gdb_usleep.o record.o record-full.o gcore.o gdb_vecs.o jit.o progspace.o skip.o probe.o common-utils.o buffer.o ptid.o gdb-dlfcn.o common-agent.o format.o registry.o btrace.o record-btrace.o waitstatus.o print-utils.o rsp-low.o errors.o common-debug.o debug.o common-exceptions.o btrace-common.o fileio.o common-regcache.o compile.o compile-c-symbols.o compile-c-types.o compile-object-load.o compile-object-run.o compile-loc2c.o compile-c-support.o inflow.o    init.o \
           ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a -L./../zlib -lz  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -ldl -ldl -lncurses -lm -ldl   -L/data/isuser/temp/lib/python2.7/config -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic     ../libiberty/libiberty.a  build-gnulib/import/libgnu.a  -ldl -Wl,--dynamic-list=./proc-service.list
/data/isuser/temp/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/root/tools/Python-2.7.9/./Modules/posixmodule.c:7575: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
/data/isuser/temp/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/root/tools/Python-2.7.9/./Modules/posixmodule.c:7522: warning: the use of `tempnam' is dangerous, better use `mkstemp'
python.o: In function `_initialize_python':
/data/isuser/tools/gdb-7.11.1/gdb/./python/python.c:1834: undefined reference to `gdbpy_initialize_heap_block'
/data/isuser/tools/gdb-7.11.1/gdb/./python/python.c:1835: undefined reference to `gdbpy_initialize_object_ref'
python.o:(.data+0x428): undefined reference to `gdbpy_heap_block'
python.o:(.data+0x448): undefined reference to `gdbpy_heap_walk'
python.o:(.data+0x468): undefined reference to `gdbpy_big_blocks'
python.o:(.data+0x488): undefined reference to `gdbpy_cpp_object'
python.o:(.data+0x4a8): undefined reference to `gdbpy_shared_object'
python.o:(.data+0x4c8): undefined reference to `gdbpy_ref'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1410: gdb] Error 1
make[2]: Leaving directory '/data/isuser/tools/gdb-7.11.1/gdb'
make[1]: *** [Makefile:9157: all-gdb] Error 2
make[1]: Leaving directory '/data/isuser/tools/gdb-7.11.1'
make: *** [Makefile:847: all] Error 2

I did copy the python files from gdbplus to gdb-7.11.1/gdb/python folder as suggested in one of the issues.
I have configured this against python2.7.

Can you let me know what else I am missing?

@sadaaithal
Copy link
Author

i meticulously copied all the files in their respective locations in gdb source folders - some of them were copied as cpp files but i did that again by copying them as .c files.
and then the build went through.
i will run more tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant