problems with compiling a mixed Fortran/C program

problems with compiling a mixed Fortran/C program

Hello,

I was trying to compile a mixed Fortran/C++ program on a Linux cluster using Intel Fortran and C++ compiler. Basically it's Fortran call C++. I got the following warnings and errors:

ld: warning: i386:x86-64 architecture of input file `/usr/lib/crt1.o' is incompatible with i386 output
ld: warning: i386:x86-64 architecture of input file `/usr/lib/crti.o' is incompatible with i386 output
ld: warning: i386:x86-64 architecture of input file `/usr/lib/crtn.o' is incompatible with i386 output

and

/usr/lib/crt1.o: In function `_start':
init.c:(.text+0x21): undefined reference to `main'

also a lot of other undefined reference errors such as:

aplbce.o: In function `aplbce_':
../aplbce.f90:(.text+0x104): undefined reference to `for_check_mult_overflow'

It is Fortran call C, so it should not ask for a 'main' in C. Cannot figure out why. Can anybody help me? Thanks a lot.

Li

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The warning says you are trying to mix 32- and 64-bit objects. This won't work. Details would depend on a number of issues which you haven't mentioned, including which version of linux you are running. All supported linux versions have the standard organization of 64- and 32-bit libraries. If you have any 32-bit OS installation on your cluster, you will have to stick to 32-bit.

Thanks a lot, Tim.

The Linux version is 2.3.6. The Intel Fortran Compiler version is 9.1.032 and C/C++ compiler is 9.1.038.

The headnode on our cluster is an Intel 64bit 4 processor dual core SMP computer while the nodes are still 32bit. I should be able to run both 64bit and 32bit applications. But the problem is during linking, it still looks for /usr/lib (which is actually /usr/lib64) although I specified -L/usr/lib32 in my Makefile. I guess this is why I see these:

ld: warning: i386:x86-64 architecture of input file `/usr/lib/crt1.o' is incompatible with i386 output

Even if you can run 64-bit applications on your head node, you can't run 64-bit cluster applications or MPI unless all nodes are running 64-bit OS. If you succeed in mixing 32- and 64-bit objects in one link, the result will hang even when running on the 64-bit OS. You could conceivably run a 64-bit build of your application on the 64-bit OS, but you would need a separate 32-bit build for the 32-bit nodes. You would have to run the corresponding combination of 64- and 32-bit builds of your MPI.

It will be quite confusing if you use a 64-bit OS with an unsupported library organization on your head node, while running 32-bit OS on other nodes. If you have the compilers and MPI installed correctly, using32-bitmpi compile scriptscorrectly to drive the link will automatically select 32-bit compilers and libraries.

The kernel version doesn't tell conclusively whether you are running an OS which is supported for Intel compilers. Your comment about /usr/lib32 would indicate that you are not running a 64-bit OS with one of the usual library organizations. It seems unlikely that the 32-bit linux on your cluster nodes would have that same organization, so you have a lot of potential problems to deal with. If you are running an OS which is not supported by Intel tools, you might at least consider following advice from someone who has been successful with it.

Thanks a lot for the explanation. You are right the problem is caused by the 64bit system on our headnode. I was able to compile and link on a 32bit node without any more problems. Thanks again for your help.

Li

Leave a Comment

Please sign in to add a comment. Not a member? Join today