This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Hi, you wrote: > I'm trying to make a cross compiler on a SPARC Solaris 2 system for a > FreeBSD 2.2.7 system. > > I installed binutils on the SPARC with i386-unknown-freebsd2.2.7 as the > target. I compiled libgcc1.a on the FreeBSD machine natively. I compiled > gcc-2.8.1 on the SPARC with target=i386-unknown-freebsd2.2.7, > --with-gnu-as, and --with-gnu-ld. > > The resulting compiler reports the following errors when I try to compile > anything: > > quark:/var/tmp/compiler/newlib-1.8.1 787> ./configure --target=i386-unknown-freebsd2.2.7 --prefix=/tmp/cross -v > Configuring for a sparc-sun-solaris2.6 host. > Created "Makefile" in /var/tmp/compiler/newlib-1.8.1 using "mh-frag" > /tmp/cross/i386-unknown-freebsd2.2.7/lib/crt0.o(.text+0x421): undefined > reference to `_DYNAMIC' > /tmp/cross/i386-unknown-freebsd2.2.7/lib/crt0.o(.text+0x3c2): undefined > reference to `_DYNAMIC' > /tmp/cross/i386-unknown-freebsd2.2.7/lib/crt0.o(.text+0x57): undefined > reference to `_DYNAMIC' > /tmp/cross/i386-unknown-freebsd2.2.7/lib/libc.a(atexit.o)(.text+0x30): > undefined reference to `sbrk' > /tmp/cross/i386-unknown-freebsd2.2.7/lib/libc.a(exit.o)(.text+0x36): undefined > reference to `_exit' > *** The command '/tmp/cross/bin/i386-unknown-freebsd2.2.7-gcc -o conftest -g > conftest.c' failed. > *** You must set the environment variable CC to a working compiler. > > I could not configure newlib without the crt0.o and libc.a files from the > FreeBSD box, so I ftp'ed them over and installed them in $prefix/$target/lib. > > What am I doing wrong??? Why can't I use the C libraries that were compiled on > the native machine? You should be able and should use them, not build any new libs... You can freely copy the C-library headers and libraries from a FreeBSD machine. So why you are starting to port newlib as the C-library for FreeBSD? For a crosscompiler to FreeBSD you'll need to copy its libraries and headers to the host machine. Then build GCC as a crosscompiler to the target, FreeBSD, for and using its libs and headers. This is the 'normal' practice... But with the FreeBSD 2.2.7 target you'll have big problems. That '_DYNAMIC' could be the hardest... I tried a Linux-to-FreeBSD-2.2.6 in last November and found the following: 1. The GNU binutils must be configured to support both 'i386-freebsd' and 'i386-netbsd' binaries, because the ready-made FreeBSD 'libc.a' has both types of binaries: configure --host=... --target=i386-freebsd --enable-targets=i386-netbsd The undefined references to 'sbrk' and '_exit' can be the result of the objects having these symbols being NetBSD-aout objects... 2. The 'DYNAMIC' seems to be the address of some kind of jump table, which ld should scan to resolve the function start addresses. This should be equivalent to the SunOS4.1 method of using shared libs, so I added a #define USE_SUNOS4_SHARED_LIBS (or something like that), to enable the code in 'collect2.c'... But this didn't seem to help... I don't know where it should search this address (from kernel? -- then a cross-compiler is quite impossible). I thought to leave this problem unsolved (no real need for a freebsd-aout target cross-compiler) and be prepared when the elf-based FreeBSD is stable and the 'standard'... Anyhow you could try to define the '__DYNAMIC' as '0', in a linker script, just as it is defined in the 'i386-netbsd' scripts: -------------- clip ------------------- D:\usr\local\i486-netbsd\lib\ldscripts>type i386nbsd.x OUTPUT_FORMAT("a.out-i386-netbsd", "a.out-i386-netbsd", "a.out-i386-netbsd") OUTPUT_ARCH(i386) SEARCH_DIR(/usr/local/i486-netbsd/lib); __DYNAMIC = 0; PROVIDE (__stack = 0); SECTIONS --------------- clip ------------------ And then use it with the '-T <script_name>' when linking... Problems with the 'i386-freebsdelf' target: I had to download the whole 30 M 'base operating system' install kit to find the elf-format libs and the system headers (using a modem connection)... Disturbing FreeBSD users and asking them to email the libs & headers (the amount of download would have been just as much) was too much. The 'ftp.freebsd.org' maintainers don't want to open FreeBSD to 'outsiders', and it is OK for me... Packaging the FreeBSD libs and headers separately for cross-compiler builders, who have no intention to install FreeBSD, seemed to be really impossible... So although I now have my 'freebsdelf' target compiler, I am not very eager to use it to compile anything 'freely' for the hostile FreeBSD-community... Cheers, Kai PS. What is the situation of your SGI-Irix 5.3/6.x target tools? _______________________________________________ New CrossGCC FAQ: http://www.objsw.com/CrossGCC _______________________________________________ To remove yourself from the crossgcc list, send mail to crossgcc-request@cygnus.com with the text 'unsubscribe' (without the quotes) in the body of the message.