Bugzilla – Bug 140333
Problem cross-compiling C and Fortran
Last modified: 2006-01-02 08:10:55 UTC
I am having problems compiling a program that has mixed C and Fortran code. The individual files compile OK with the respective compilers gcc and gfortran. I am having problems linking them together. I have the LD_LIBRARY_PATH set to /usr/lib. If you link the objects with gcc, you get the error: /usr/lib/gcc/i586-suse-linux/4.0.2/../../../crt1.o: In function `_start': ../sysdeps/i386/elf/start.S:115: undefined reference to `main' /usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: BFD 2.16.91.0.2 20050720 (SuSE Linux) internal error, aborting at ../../bfd/dwarf2.c line 1787 in scan_unit_for_symbols /usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: Please report this bug. collect2: ld returned 1 exit status make: *** [sigpro] Error 1 ------------------------------------------------------------ If you link the objects with gfortran, you get the error: ld: BFD 2.16.91.0.2 20050720 (SuSE Linux) internal error, aborting at ../../bfd/dwarf2.c line 1787 in scan_unit_for_symbols ld: Please report this bug. make: *** [sigpro] Error 1 The command I am using to make them is: gcc -g -o sigpro -L/apps/qtsi/seatools/lib -I../../include -I/apps/qtsi/cm/dev/from_usndc/include/array_structs -I/apps/qtsi/cm/dev/from_usndc/include buildarg.o [...lots of other objects and libraries...] We are running Suse 10.0 on Panasonic Toughbooks CF-29s. gcc -v yields: qtsi@linux:~/mix> gcc -v Using built-in specs. Target: i586-suse-linux Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,f95,java,ada --disable-checking --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk --disable-libjava-multilib --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --without-system-libunwind --host=i586-suse-linux Thread model: posix gcc version 4.0.2 20050901 (prerelease) (SUSE Linux) gfortran -v yields: qtsi@linux:~/mix> gfortran -v Using built-in specs. Target: i486-pld-linux Configured with: ../configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,f95,objc,obj-c++,ada --enable-c99 --enable-long-long --disable-multilib --enable-nls --disable-werror --with-gnu-as --with-gnu-ld --with-demangler-in-ld --with-system-zlib --with-slibdir=/lib --without-x --enable-cmath i486-pld-linux Thread model: posix gcc version 4.1.0 20051113 (experimental) I am sorry that I cannot post a test case. I made a small program that incorporates C and Fortran, but it compiled OK> If I could find out what is causing BFD to burp, I might be able to narrow down the problem for you. Please let me know if there is anything more that I can send to you to help you find this problem. - George Jenkins gjenkins@qtsi.com
Without a test case I'm afraid we can't do much.
Closing by request of originator.