Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

undefined reference to `dlsym'

Saumik_D_
Beginner
1,182 Views

Hi, I am compiling a bunch of .f90 files using the below makefile. The error that I get on using -O2 optimization is posted just below that. Can't figure out where the problem is :/

The makefile is

!---------------------------------------------------

.SUFFIXES: .o .f90
.f90.o:
$(F90) -c $(F90FLAGS) $<
F90 = ifort -warn -WB -C
LD = $(F90)
LIBS = -ldl
PROFILE = -O2
OPTFLAGS = -g
CFLAGS = $(OPTFLAGS) $(PROFILE)
F90FLAGS = $(CFLAGS)
LDFLAGS = 

PROGRAM = fadd2d
F90SRCS = global.f90 main.f90 nrtype.f90 nrutil.f90 remesh_module.f90 \
prep.f90 elem_charles.f90 \
assemb_charles.f90 formakf_charles.f90 gauss.f90 shape.f90 solver.f90 \
post_remesh.f90 proc.f90 volume_solver.f90 pressure_solver.f90 \
rearge.f90 sif.f90 sifaniso.f90 root.f90 kernel1_c.f90 kernel2.f90 \
tstress.f90 tstress1.f90 tstress2.f90 tstress2a.f90 tstress3.f90 \
assemb_tstress.f90 rigidinner4.f90

SRCS = $(F90SRCS) 

OBJS = $(F90SRCS:.f90=.o)

all: $(PROGRAM)

$(PROGRAM): $(OBJS)
$(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)

elem_charles.o: elem_charles.f90 ekc_2.f90 ekd_2_temp.f90 ek_b2.f90 ek_at2.f90 \
eatts2.f90 eattip.f90 eat3.f90 ebts2.f90 ebtip.f90 eb3.f90 \
eat_rigid.f90 eb_rigid.f90
$(F90) -c $(F90FLAGS) elem_charles.f90

#Dec10_09: add prep.f90 to following line to recompile prep.f90
prep.o: prep.f90 setint.f90
$(F90) -c $(F90FLAGS) prep.f90
clean:
rm -f $(OBJS) $(PROGRAM)
rm *.mod
tidy:
rm -f *.BAK *.bak *.CKP *~

undepend:
rm -f $(OBJS:%.o=.%.d) 

spotless: tidy clean undepend

!------------------------------------

And the error message is

!------------------------------------

ifort -warn -WB -C -o fadd2d global.o main.o nrtype.o nrutil.o remesh_module.o prep.o elem_charles.o assemb_charles.o formakf_charles.o gauss.o shape.o solver.o post_remesh.o proc.o volume_solver.o pressure_solver.o rearge.o sif.o sifaniso.o root.o kernel1_c.o kernel2.o tstress.o tstress1.o tstress2.o tstress2a.o tstress3.o assemb_tstress.o rigidinner4.o -ldl
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function `_start':
(.text+0x12): undefined reference to `__libc_csu_fini'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/crt1.o: In function `_start':
(.text+0x19): undefined reference to `__libc_csu_init'
/usr/local/src/intel/fce/10.1.012/lib/libifcore.a(for_aio.o): In function `for_waitid':
for_aio.c.text+0xc65): undefined reference to `dlsym'
for_aio.c.text+0xc89): undefined reference to `dlsym'
for_aio.c.text+0xcad): undefined reference to `dlsym'
for_aio.c.text+0xcd1): undefined reference to `dlsym'
for_aio.c.text+0xcf5): undefined reference to `dlsym'
/usr/local/src/intel/fce/10.1.012/lib/libifcore.a(for_aio.o):for_aio.c.text+0xd19): more undefined references to `dlsym' follow
make: *** [fadd2d] Error 1

0 Kudos
6 Replies
Lorri_M_Intel
Employee
1,182 Views

Do you have your own "libdl", either a libdl.a or libdl.so?

 

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,182 Views

And don't forget to resolve the first error "undefined reference to `__libc_csu_fini'"

Jim Dempsey

0 Kudos
Saumik_D_
Beginner
1,182 Views

No Lorri, I don't have my own libdl.a or libdl.so. Can you provide one? I presume it is a compilation of open,close et al commands.

0 Kudos
Lorri_M_Intel
Employee
1,182 Views

There should be a libdl.so as part of the Linux distro.

On my system there are links under /usr/lib and /usr/lib64

What I was curious about, was whether you had built your own library, and called it "libdl".   This would supersede the one from the system, and would block the Fortran runtime library from finding the one on the system.

        --Lorri

0 Kudos
Saumik_D_
Beginner
1,182 Views

Hi All,

        The problem was that glibc-static library was not installed. The -O2 optimization is working now. "The glibc-static package contains the C library static libraries for -static linking.  You don't need these, unless you link statically which is highly discouraged." Could you throw some light on all this? I am not a programmer, A Mechanical Engineer learning his ropes in the computational domain :|.

 

Thanks

Saumik.

   

0 Kudos
pbkenned1
Employee
1,182 Views

There are a bunch of reasons why static linkage is 'strongly discouraged':

--  It is only guaranteed to work on the system on which it was built

-- There is no forward or backward compatibility with a static build.

-- Fixes in updates to the libraries will not be available unless the affected statically linked executables are re-linked.

-- Larger memory footprint.

-- Slower application startup time.

Patrick

0 Kudos
Reply