Reputation: 85
I'm trying to compile a file using fortran and nag fortran library on a 32x machine works perfectly but doesn't work on a 64x one however the same program works on other 64x machines
everytime there is a message error /usr/bin/ld: cannot find -lnag
how can i solve this?
i'm adding some info about my problem
so this kind of additional error message
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libnag.a when searching for -lnag
comes when i compile using
f77 d01dafe.f -lnag
but when compiling with
f77 d01dafe.f -L/usr/lib/libnag.a
i get
d01dafe.o: in function « MAIN__ »:
fort77-2895-1.c:(.text+0xda): undefined reference to « d01daf_ »
fort77-2895-1.c:(.text+0x209): undefined reference to « d01daf_ »
collect2: error: ld returned 1 exit status
Upvotes: 0
Views: 1743
Reputation: 389
The Users' Note (un.html) for your NAG Library gives details about how to access the Library. This file should have been installed (somewhere!) when your Library was installed. Notes for Marks 22, 23 and 24 are also available at http://www.nag.co.uk/numeric/fl/FLinuns.asp.
For example, from http://www.nag.co.uk/doc/inun/fl24/l6adfl/un.html#accessing
(for the gfortran
Library)
" To use the NAG Fortran Library and the supplied ACML libraries, you may link in the following manner:
gfortran -I[INSTALL_DIR]/nag_interface_blocks driver.f90 [INSTALL_DIR]/lib/libnag_acml.a [INSTALL_DIR]/acml/libacml_mp.a -lgomp
where driver.f90 is your application program;
or
gfortran -I[INSTALL_DIR]/nag_interface_blocks driver.f90 [INSTALL_DIR]/lib/libnag_acml.so [INSTALL_DIR]/acml/libacml_mp.so
if the shareable library is required. Please note that the shareable library is fully resolved so that you need not link against other run-time libraries explicitly; this requires the environment variable LD_LIBRARY_PATH to be set correctly at link time (see below).
However, if you prefer to link to a version of the NAG Library which does not require the use of ACML you may wish to use the self-contained libraries as follows:
gfortran -I[INSTALL_DIR]/nag_interface_blocks driver.f90 [INSTALL_DIR]/lib/libnag_nag.a
or
gfortran -I[INSTALL_DIR]/nag_interface_blocks driver.f90 [INSTALL_DIR]/lib/libnag_nag.so
if the shareable library is required. "
Note in particular that there is no libnag.a
or libnag.so
, so that just using -lnag
will never work anyway. For access to the no-vendor Library (assuming your LD_LIBRARY_PATH
is set correctly) you should probably be doing something like
f77 d01dafe.r -lnag_nag
Upvotes: 1