Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Nov 2000 11:06:25 -0500
From:      Andrew Otwell <aotwell@iss.net>
To:        hackers@freebsd.org
Subject:   porting Linux application to FreeBSD
Message-ID:  <3A228681.4A3DBE88@iss.net>

next in thread | raw e-mail | index | archive | help
source.c 
-------------------------
#include <stdio.h>
int main () {
   printf ("Hello world\n");
}
-------------------------

A couple of you answered my first query which gave me....

gcc -nostdinc -I/includedir -nostdlib -L/libdir source.c

This always failed with either....

ld: No reference to __DYNAMIC
collect2: ld returned 1 exit status

or 

/var/tmp/ccdgopIG.o: Undefined symbol `___main' referenced from text segment
/var/tmp/ccdgopIG.o: Undefined symbol `_printf' referenced from text segment
/var/tmp/ccdgopIG.o: Undefined symbol `_printf' referenced from text segment
collect2: ld returned 1 exit status

Depending on whether I specified lib names (ex. -lnet -lpcap -lgcc, etc....)



I finally pulled all my hair out and ran

gcc -nostdinc -I/usr/include -nostdlib -L/usr/lib source.c
=-= and =-=
gcc -nostdlib -L/usr/lib source.c

and again I received.....
/var/tmp/ccdgopIG.o: Undefined symbol `___main' referenced from text segment
/var/tmp/ccdgopIG.o: Undefined symbol `_printf' referenced from text segment
/var/tmp/ccdgopIG.o: Undefined symbol `_printf' referenced from text segment
collect2: ld returned 1 exit status

Can anyone assist with this?
I need to be able to compile and link a "Hello World" program against a
proprietary
lib dir for my project but for starters I have to make sure my anomolies are not 
with the "ld" portion of my build. 

Why doesn't "gcc -nostdlib -L/usr/lib source.c" link properly? I even added
all the .a files with -lnet -lpcap -ledit, so forth.... and it still failed. 

Please reply to all. If I need to direct this to our gcc brethren then please
advise.

--
 Andrew Otwell, MSS Special Ops Recon/Surveillance/Developer
 desk 678.443.6271, aotwell@iss.net, http://www.iss.net


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?3A228681.4A3DBE88>