Date: Tue, 28 Nov 2000 11:26:30 -0700 From: Wes Peters <wes@softweyr.com> To: Andrew Otwell <aotwell@iss.net> Cc: Steve Kargl <sgk@troutmask.apl.washington.edu>, hackers@FreeBSD.ORG Subject: Re: porting Linux application to FreeBSD Message-ID: <3A23F8D6.D5A7470B@softweyr.com> References: <200011271635.eARGZQw29552@troutmask.apl.washington.edu> <3A229298.9B928795@iss.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Andrew Otwell wrote: > > same problem. I'm trying though.... > > bash-2.03$ gcc -static -nostdlib -L/usr/lib \ > > -lalias -lalias_p -lc -lc_p -lc_pic -lcalendar -lcalendar_p -lcom_err -lcom_err_p \ > > -lcompat -lcompat_p -lcrypt -lcrypt_p -lcurses -lcurses_p \ > > -ldialog -ldialog_p -ldisk -ledit -ledit_p -lf2c -lf2c_p -lfl -lfl_p -lftpio \ > > -lftpio_p -lg++ -lg++_p -lgcc -lgcc_p -lgcc_pic -lgmp -lgmp_p \ > > -lgnuregex -lgnuregex_p -lipx -lipx_p -lkeycap -lkeycap_p -lkvm \ > > -lkvm_p -ll -ll_p -lln -lln_p -lm -lm_p -lmd -lmd_p -lmp -lmp_p -lmytinfo \ > > -lmytinfo_p -lncurses -lncurses_p -lobjc -lobjc_p -lopie -lopie_p \ > > -lpcap -lpcap_p -lreadline -lreadline_p -lrpcsvc -lrpcsvc_p -lscrypt \ > > -lscrypt_p -lscsi -lscsi_p -lskey -lskey_p -lss -lss_p -lstdc++ -lstdc++_p > > -ltelnet -ltelnet_p -ltermcap -ltermcap_p -ltermlib -ltermlib_p \ > > -lutil -lutil_p -lvgl -lvgl_p -lxpg4 -lxpg4_p -ly -ly_p -lz -lz_p \ > > test2.c > >/var/tmp/ccaCTG6m.o: Undefined symbol `___main' referenced from text segment > >/var/tmp/ccaCTG6m.o: Undefined symbol `_printf' referenced from text segment > >/var/tmp/ccaCTG6m.o: Undefined symbol `_printf' referenced from text segment > >collect2: ld returned 1 exit status > bash-2.03$ The libraries are searched in the order you specify them on the command line. You have -lc very early in your library path; you may not have encountered a call to printf when you search libc, but encounter one buried in another library function later on. The missing ___main comes from not linking a C runtime startup module. Try specifying /usr/lib/crt1.o before test2.c. Running cc -v on your program using the standard libraries will show you what the cc program normally does. This is, as someone else suggested, a great starting point for learning what you will have to do in order to link your image. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A23F8D6.D5A7470B>