- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to build a couplelarge applications under CENTOS using Composer XE. I have one working, but the other link and I don't understand why. I have a main source a.F and two libraries. p.a and u.a
If I get a compiled as a.o
then do
ifort ./a.o -o aexe -B/home/dajum/p.a -B/home/dajum/u.a
It doesn't find routines in the libraries. Using -L instead of -B fails the same way.
Using
ld a.o /home/dajum/p.a /home/dajum/u.a -o aexe
it finds library routines, but not fortran library routines like 'pow' and 'for_write_seq_fmt'
trying
ifort -o aexe ./a.o /home/dajum/p.a /home/dajum/u.a
seems to find the library routines that are fortran sourced, but not the c sourced ones.
What is the right way to do this?
Thanks
If I get a compiled as a.o
then do
ifort ./a.o -o aexe -B/home/dajum/p.a -B/home/dajum/u.a
It doesn't find routines in the libraries. Using -L instead of -B fails the same way.
Using
ld a.o /home/dajum/p.a /home/dajum/u.a -o aexe
it finds library routines, but not fortran library routines like 'pow' and 'for_write_seq_fmt'
trying
ifort -o aexe ./a.o /home/dajum/p.a /home/dajum/u.a
seems to find the library routines that are fortran sourced, but not the c sourced ones.
What is the right way to do this?
Thanks
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A look at the manual pages for ifort and ld would have told you that your first two commands above were bound to fail.
The third command is correct as far as I can see, if the entire contents of p.a and u.a are to appear in the a.out, but you did not show what the error message said. Certain conditions have to be met in order for inter-language linking to work correctly.
Neither the compiler driver nor the linker know the difference between "Fortran-sourced" and "C-sourced" objects and libraries at this point.
The third command is correct as far as I can see, if the entire contents of p.a and u.a are to appear in the a.out, but you did not show what the error message said. Certain conditions have to be met in order for inter-language linking to work correctly.
Neither the compiler driver nor the linker know the difference between "Fortran-sourced" and "C-sourced" objects and libraries at this point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know what ifort should do with -Bsome.a. Normally, you would set -L to point to the library directory, and use -lyourlib, if the library file is named libyourlib.a. If your libraries aren't named according to libsomething.a, it should be possible simply to give the library name as you did, without -B or -L. Also, I would expect you to put your -o option before your list of objects and libraries.
ld has no knowledge about which libraries must be linked in an ifort build, even if the PATH variables are set by sourceing the compilervars script. You would need to find out (e.g. by ifort -#) how the ifort libraries are to be searched, and specify them. ld doesn't even know the libraries which g++ would require.
Are your C functions built by gcc or by icc? If you install the same version of icc and ifort, they must share all their directories, so there should be no problem finding icc libraries.
If built by gcc, it should be the same gcc version as the g++ version which is active to support ifort.
I haven't run into any problems with ifort/icc 12.0 on CentOS 5.5, other than the installer complaining about non-support, and that the JRE may not be the right one (to support idb). Many customers use CentOS, in spite of Intel not testing specifically on it.
ld has no knowledge about which libraries must be linked in an ifort build, even if the PATH variables are set by sourceing the compilervars script. You would need to find out (e.g. by ifort -#) how the ifort libraries are to be searched, and specify them. ld doesn't even know the libraries which g++ would require.
Are your C functions built by gcc or by icc? If you install the same version of icc and ifort, they must share all their directories, so there should be no problem finding icc libraries.
If built by gcc, it should be the same gcc version as the g++ version which is active to support ifort.
I haven't run into any problems with ifort/icc 12.0 on CentOS 5.5, other than the installer complaining about non-support, and that the JRE may not be the right one (to support idb). Many customers use CentOS, in spite of Intel not testing specifically on it.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page