Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26756 Discussions

files not found by shared library. "...try using -rpath or -rpath-link

Jon_D_2
New Contributor I
1,448 Views

This is a f77 code being ported to Intel fortran 90.   The build consists of building a shared library that is used by other fortran programs.   When building contempt28, The linker is complaining (warning) that the shared library I am linking to, cannot find library files.  The -rpath or -rpath-link is not an option I can use in the compiler.   The .so files described in the warning, are library files in the library of the compiler.

 How can I fix this?

See below:
  ld: warning: libifport.so.5, needed by /rxe/source/shlib/v21_cp03/v2.1.cp03/hpgl_routines.so, not found (try using -rpath or -rpath-link)
  ld: warning: libifcoremt.so.5, needed by /rxe/source/shlib/v21_cp03/v2.1.cp03/hpgl_routines.so, not found (try using -rpath or -rpath-link)
  ld: warning: libimf.so, needed by /rxe/source/shlib/v21_cp03/v2.1.cp03/hpgl_routines.so, not found (try using -rpath or -rpath-link)
  ld: warning: libsvml.so, needed by /rxe/source/shlib/v21_cp03/v2.1.cp03/hpgl_routines.so, not found (try using -rpath or -rpath-link)
  ld: warning: libintlc.so.5, needed by /rxe/source/shlib/v21_cp03/v2.1.cp03/hpgl_routines.so, not found (try using -rpath or -rpath-link)

The Makefile for the contempt28:

FC=/opt/intel/bin/ifort
FFLAGS=-debug -O3
SHLIB=/rxe/source/shlib/v21_cp03/v2.1.cp03
OBJS=contempt28_tu.o inp_routines.o ftb_routines.o con_try.o drxe1.o hx1.o spray1.o local_lib.o
FFLAGS=-debug -align dcommons -real-size 64 -warn nouncalled -warn nousage

Build-Order: contempt28_tu.o inp_routines.o ftb_routines.o \
        con_try.o drxe1.o hx1.o spray1.o local_lib.o  \
        $(SHLIB)/hpgl_routines.so contempt28

contempt28: $(OBJS) ${SHLIB}/hpgl_routines.so
        $(FC) $(FFLAGS) -rpath-link -o contempt28 $(OBJS) -L$(SHLIB)/hpgl_routines.so

contempt28_tu.o : contempt28_tu.f
        $(FC) $(FFLAGS) -c contempt28_tu.f

inp_routines.o : inp_routines.f
        $(FC) $(FFLAGS) -c inp_routines.f

ftb_routines.o : ftb_routines.f
        $(FC) $(FFLAGS) -c ftb_routines.f

con_try.o: con_try.f
        $(FC) $(FFLAGS) -c con_try.f

drxe1.o : drxe1.f
        $(FC) $(FFLAGS) -c drxe1.f

hx1.o : hx1.f
        $(FC) $(FFLAGS) -c hx1.f

spray1.o : spray1.f
        $(FC) $(FFLAGS) -c spray1.f

local_lib.o : local_lib.f
        $(FC) $(FFLAGS) -c local_lib.f

The Makefile for the shared library

FC=/opt/intel/bin/ifort
CC=/opt/intel/bin/icc
CFLAGS=-g -shared -fPIC
FFLAGS=-debug -shared -fPIC -align dcommons -real-size 64 -warn nousage

SHLIB_UTIL: interfaces.so hpgl_routines.so system.so datey2k.so

interfaces.so : interfaces.c
 $(CC) $(CFLAGS) -o interfaces.so interfaces.c

hpgl_routines.so : hpgl_routines.f
 $(FC) $(FFLAGS) -o hpgl_routines.so hpgl_routines.f

system.so : system.f
 $(FC) $(FFLAGS) -o system.so system.f

datey2k.so : datey2k.f
 $(FC) $(FFLAGS) -o datey2k.so datey2k.f

 

0 Kudos
1 Solution
Lorri_M_Intel
Employee
1,448 Views

Please try invoking compilervars.csh, or compilervars.sh, whichever is appropriate your shell.

This will define LD_LIBRARY_PATH to point to the .so libraries.

             Hope this helps,

                                    --Lorri

View solution in original post

2 Replies
Lorri_M_Intel
Employee
1,449 Views

Please try invoking compilervars.csh, or compilervars.sh, whichever is appropriate your shell.

This will define LD_LIBRARY_PATH to point to the .so libraries.

             Hope this helps,

                                    --Lorri

View solution in original post

Jon_D_2
New Contributor I
1,448 Views

Lorri,

Okay, I believe I was successful with invoking the compilervars.sh as I no longer get the warnings.  On another note, I also had the LD_LIBRARY_PATH pointed specifically at the debugger in my profile; however, it looks like I can edit my profile to just run the compilervars.sh and I can still debug.  Great tip!  Please correct me if I'm wrong.

Thank you Lorri.  You have been a lot of help to me.

Reply