From owner-freebsd-hackers Tue Nov 28 23: 5:55 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from homer.softweyr.com (bsdconspiracy.net [208.187.122.220]) by hub.freebsd.org (Postfix) with ESMTP id 1619537B402 for ; Tue, 28 Nov 2000 23:05:50 -0800 (PST) Received: from [127.0.0.1] (helo=softweyr.com ident=Fools trust ident!) by homer.softweyr.com with esmtp (Exim 3.16 #1) id 140pSY-0000Gl-00; Tue, 28 Nov 2000 11:26:30 -0700 Message-ID: <3A23F8D6.D5A7470B@softweyr.com> Date: Tue, 28 Nov 2000 11:26:30 -0700 From: Wes Peters Organization: Softweyr LLC X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.12 i386) X-Accept-Language: en MIME-Version: 1.0 To: Andrew Otwell Cc: Steve Kargl , hackers@FreeBSD.ORG Subject: Re: porting Linux application to FreeBSD References: <200011271635.eARGZQw29552@troutmask.apl.washington.edu> <3A229298.9B928795@iss.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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