[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bgl-discuss] Linking error solution?



At 04:47 PM 9/9/2005, JungMin (Judy) Lee wrote:
I am Jung-Min Lee and working with Dr. Lan in IIT. We have installed the
accelerator simulation application, called Synergia on BGL. However, we
cannot install it.

The codes are made by Fortran90 and C++. Also, it generates a Makefile
automatically using configure script.

When I defined CXX=mpicxx and CC=mpicc, it has error like :
mpicxx  -g -O2   -o boosterMapDemo6 -L../../../physics_toolkit/src
-L../../../beamline/src -L../../../basic_toolkit/src -L../../../mxyzptlk/src
-L../../../bmlfactory/src boosterMapDemo6.o -lbmlfactory -lphysics_toolkit
-lbeamline -lphysics_toolkit -lbeamline -lmxyzptlk -lbasic_toolkit
-L/home/jungmin/glib-1.2.10/lib -lglib -lm -lnsl
/bgl/BlueLight/DRV202_2005-050606-SLES8/ppc/blrts-gnu/bin/../lib/gcc-lib/pow
erpc-bgl-blrts-gnu/3.2/../../../../powerpc-bgl-blrts-gnu/bin/ld: cannot find
-lnsl

I'd start by simply leaving off -lnsl . It is rare that an application code needs anything from this library (at one time, some systems put gethostbyname in there, but you shouldn't need that). However, you'll probably then run into the same C++ to Fortran 90 name problem.


For that, in the long term, it would be better if the code did not rely on the internal naming format of the F90 module functions, because there is no requirement that those symbols be valid in another language (you are seeing that in the complaints about the "$" character). One possibility is to use a C <=> Fortran 77 naming scheme for the interface between the C and Fortran parts of the code. This is well understood and reasonably portable.

In the short term, you'll have to add something to the header file that defines the mapping from the name you pass to those macros to the names generated by the Fortran 90 compiler. Take the object from the Fortran 90 file that defines these routines and use the nm command to see what the names look like. E.g., if you do

xlf90 -c foo.f

then do

nm foo.o

You can do this on one of the platforms where the code works as you expect and see what you need to change for F90_MODULE_FUNCTION.

Also, for straight Fortran code, the xlf series of compilers by default does not append an underscore. You might try

#define F_FUNCTION(function) function

instead of

#define F_FUNCTION(function) function ##_

Bill


William Gropp
http://www.mcs.anl.gov/~gropp


- --------------------------------------------------------------------
To add or remove yourself from this mailing list, use the 'notifyme'
command on any BGL machine. To remove: notifyme -n, to add: notifyme -y.