OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 28, 2017 7:38 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Problem Making Cross Binutils - Undefined Symbol
PostPosted: Thu Mar 02, 2017 9:56 am 
Offline

Joined: Thu Mar 02, 2017 9:46 am
Posts: 2
Hi,

I'm trying to make a cross compiler for the arm-none-eabi target, but following the directions in the tutorial results in this error when making binutils:

Code:
gcc -g -O2   -static-libstdc++ -static-libgcc -Wl,--stack,12582912   \
        -o gdb.exe gdb.o arm-tdep.o ser-base.o ser-unix.o ser-pipe.o ser-tcp.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 remote-sim.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 guile.o elfread.o stap-probe.o posix-hdep.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 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 infcall.o infcmd.o infrun.o expprint.o environ.o stack.o thread.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-support.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 inflow.o    init.o \
          ../sim/arm/libsim.a ../readline/libreadline.a ../opcodes/libopcodes.a ../bfd/libbfd.a  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a    -lncurses -lm   -liconv    ../libiberty/libiberty.a -luser32 build-gnulib/import/libgnu.a
ada-exp.o: In function `ada_parse_internal':
/usr/src/build-binutilsarm/gdb/ada-exp.c:1637: undefined reference to `ada_lex'
/usr/src/build-binutilsarm/gdb/ada-exp.c:1637:(.text+0x247d): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `ada_lex'
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:1347: gdb.exe] Error 1
make[2]: Leaving directory '/usr/src/build-binutilsarm/gdb'
make[1]: *** [Makefile:9962: all-gdb] Error 2
make[1]: Leaving directory '/usr/src/build-binutilsarm'
make: *** [Makefile:836: all] Error 2


I can get a working binutils by passing --disable-gdb to the configure script, which was good enough for me to begin with, but I'm at the stage where a working debugger would be handy and so I'd like to solve this.

Any ideas what I could be doing wrong?


Top
 Profile  
 
 Post subject: Re: Problem Making Cross Binutils - Undefined Symbol
PostPosted: Thu Mar 02, 2017 10:06 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 228
If all you want is get your cross-compiler and move on, you can try using my Makefile here:

https://github.com/kiznit/build-gcc-and-binutils

Simply type:

Code:
make arm-none-eabi


If you get errors, it likely means you are missing some prerequesite librairies.

PREFIX is set to "$(HOME)/opt/cross" in gcc.mk, change it to what you want / need.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: Problem Making Cross Binutils - Undefined Symbol
PostPosted: Thu Mar 02, 2017 12:08 pm 
Offline

Joined: Thu Mar 02, 2017 9:46 am
Posts: 2
Thanks kzinti,

Should also have mentioned that I'm doing this under cygwin. I had a look at your makefile though and the sequence of commands seems to be exactly what I was using.


Top
 Profile  
 
 Post subject: Re: Problem Making Cross Binutils - Undefined Symbol
PostPosted: Mon Mar 27, 2017 5:23 pm 
Offline

Joined: Mon Mar 27, 2017 5:06 pm
Posts: 1
Did you get it working under Cygwin?

I found that the current flex in cygwin with 2.6.3, while I was able to build binutils in mingw with flex 2.5.35

GDB depends on using #define to rename a bunch of yy* symbols, including renaming yylex to ada_lex.
But, with flex 2.6.3 it emits #defines that override this attempt by GDB.
(See the generated ada-lex.c).

Anyways, add "--prefix=ada_" to the FLEX command line
binutils\gdb\Makefile.in
in the .l.c: rule (line 1889)

was:
$(FLEX) -o$@ $< && \
change to:
$(FLEX) -o$@ --prefix=ada_ $< && \

Re-configure and now building GDB works (in cygwin)!

I'm assuming this is really a compatibility problem with the new version of flex and not specifically with Cygwin.


Top
 Profile  
 
 Post subject: Re: Problem Making Cross Binutils - Undefined Symbol
PostPosted: Tue Mar 28, 2017 2:02 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 631
Location: Tallinn, Estonia
Why do you need Ada?

Code:
--enable-languages=c,c++
should cover 146% of your needs

_________________
Learn to read.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group