[mpich-discuss] relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC

Luís Miranda luistm at gmail.com
Fri Oct 23 05:21:56 CDT 2009


HI

It must be something in my application, because i have successfully compiled
an older version of my application, but the last version does't compile.
So, the problem is not the make file neither the mpich in the cluster.
Any suggestion?



Thanks

2009/10/19 Luís Miranda <luistm at gmail.com>

> Unfortunately that didn't help
> Anyway, thanks for your help.
>
>
> Thanks
>
> 2009/10/19 Mário Costa <mario.silva.costa at gmail.com>
>
>> >From what I can see you are using dynamic compiling in your
>> application, and I would guess that your mpich compilers have a
>> default configuration to use static liking with the mpich libraries,
>> you can check that with the mpichversion or similar command in the dir
>> /opt/mpich/gnu/bin/ .
>>
>> If your application can compile statically try changing
>>
>>  OPT=-O3 -fPIC -D__IC_SMS to
>>  OPT=-O3 -static -D__IC_SMS
>>
>> and
>>
>> LRT_LDFLAGS=-rdynamic $(OPT) to
>> LRT_LDFLAGS= $(OPT)
>>
>> Hope this helps
>>
>> On Mon, Oct 19, 2009 at 2:58 PM, Luís Miranda <luistm at gmail.com> wrote:
>> > This is the makefile i use:
>> >
>> > ARCH = $(shell uname)
>> > LEX=flex
>> > YACC=bison -d -v -t
>> > LEXLIB = -lfl
>> > DLLLIB = -ldl
>> > ifeq ($(ARCH),Darwin)
>> >   DLLLIB =
>> > endif
>> > ifeq ($(ARCH),OpenBSD)
>> >   DLLLIB =
>> > endif
>> >
>> > EXRINCLUDE=-I/export3/home/lmiranda/.usr/include/OpenEXR
>> > EXRLIBDIR=-L/export3/home/lmiranda/.usr/lib
>> >
>> >
>> #EXRINCLUDE=-I/export3/home/lmiranda/Sources/par-pbrt/src/OpenEXR/include
>> >
>> #EXRLIBDIR=-L/export3/home/lmiranda/Sources/par-pbrt/src/OpenEXR/liblinux
>> >
>> >
>> >
>> > #EXRLIBS=$(EXRLIBDIR) -Bstatic -lIex -lIlmImf -lImath -lIex -lHalf
>> -Bdynamic
>> > -lz
>> >
>> >
>> > ifeq ($(ARCH),Linux)
>> >   EXRLIBS += -lpthread
>> > endif
>> >
>> >
>> > #CC=gcc
>> > #CXX=g++
>> > #CC=/opt/mpich-mx/bin/mpicc
>> > #CXX=/opt/mpich-mx/bin/mpicxx
>> > #CC=/opt/mpich/intel/bin/mpiCC
>> > #CXX=/opt/mpich/intel/bin/mpicxx
>> > CC=/opt/mpich/gnu/bin/mpicc
>> > CXX=/opt/mpich/gnu/bin/mpicxx
>> >
>> > #CC=/export3/home/lmiranda/.opt/openmpi/bin/mpicc
>> > #CXX=/export3/home/lmiranda/.opt/openmpi/bin/mpicxx
>> >
>> > #CC=/export3/home/lmiranda/.opt/mpich2/bin/mpicc
>> > #CXX=/export3/home/lmiranda/.opt/mpich2/bin/mpicxx
>> >
>> >
>> > #CC= /opt/mpich/myrinet/gnu/bin/mpicc
>> > #CXX= /opt/mpich/myrinet/gnu/bin/mpicxx
>> > LD=$(CXX) $(OPT)
>> >
>> >
>> > #v0.4######################################
>> > #OPT=-O3 -fPIC
>> > OPT=-O3 -fPIC -D__IC_SMS
>> > #OPT=-O3 -fPIC -D__AU_L
>> > #OPT=-O3 -fPIC -pthread -D__AU_L_2T
>> > #OPT=-O3 -fPIC -pthread -D__AB_L_2T
>> > #OPT=-O3 -fPIC -D__AB_L
>> > #OPT=-O3 -fPIC  -D__OTA
>> >
>> > #v0.2.1 & v0.3######################################
>> > #OPT=-O3 -fPIC   -D__IC_SMS
>> > #OPT=-O3 -fPIC -pthread -D__ALC
>> > #OPT=-O3 -fPIC  -D__AU
>> > #OPT=-O3 -fPIC -D__AU-L
>> >
>> > #OPT=-O3 -fPIC  -D__AB
>> > #OPT=-O3 -fPIC  -D__AB2
>> > #OPT=-O3 -fPIC -D__AB-L
>> >
>> >
>> > #OPT=-O3 -fPIC -D__AL
>> > #OPT=-O3 -fPIC -D__AL2
>> > #OPT=-O3 -fPIC -D__ALL
>> >
>> > #v0.2##############################################
>> > #OPT=-O3 -fPIC   -D__AB1
>> > #OPT=-O3 -fPIC   -lm -D__AB2
>> > #OPT=-O3 -fPIC   -lm -D__AU
>> > #OPT=-O3 -fPIC   -lm -D__AU2
>> > #OPT=-O3 -fPIC   -lm -D__LR
>> >
>> > #ORIGINAL#########################################
>> > #OPT=-O3 -fPIC
>> > #OPT=-O3
>> > # OPT=-O2 -msse -mfpmath=sse
>> > INCLUDE=-I. -Icore $(EXRINCLUDE)
>> > WARN=-Wall
>> > CWD=$(shell pwd)
>> > CXXFLAGS=$(OPT) $(INCLUDE) $(WARN)
>> > CCFLAGS=$(CXXFLAGS)
>> > LIBS=$(LEXLIB) $(DLLLIB) $(EXRLIBDIR) $(EXRLIBS) -lm
>> >
>> > SHARED_LDFLAGS = -shared
>> > LRT_LDFLAGS=-rdynamic $(OPT)
>> > #PBRTPRELINK=-Wl,--export-dynamic -Wl,-whole-archive
>> > #PBRTPOSTLINK=-Wl,-no-whole-archive
>> >
>> > ifeq ($(ARCH), Darwin)
>> >   OS_VERSION = $(shell uname -r)
>> >   SHARED_LDFLAGS = -flat_namespace -undefined suppress -bundle
>> -noprebind
>> >   LRT_LDFLAGS=$(OPT) # -L/sw/lib
>> >   INCLUDE += -I/sw/include
>> >   WARN += -Wno-long-double
>> > endif
>> >
>> > ACCELERATORS = grid kdtree
>> > CAMERAS      = environment orthographic perspective
>> > CORE         = api camera color dynload exrio film geometry light
>> material
>> > mc \
>> >                paramset parser primitive reflection sampling scene shape
>> \
>> >                texture timer transform transport util volume pbrtparse
>> > pbrtlex
>> > FILM         = image
>> > FILTERS      = box gaussian mitchell sinc triangle
>> > INTEGRATORS  = directlighting emission irradiancecache \
>> >                path photonmap single whitted igi debug exphotonmap
>> > LIGHTS       = area distant goniometric infinite point projection spot
>> > infinitesample
>> > MATERIALS    = bluepaint brushedmetal clay felt \
>> >                glass matte mirror plastic primer \
>> >                shinymetal skin substrate translucent uber
>> > SAMPLERS     = bestcandidate lowdiscrepancy random stratified
>> > SHAPES       = cone cylinder disk heightfield hyperboloid loopsubdiv
>> nurbs \
>> >                paraboloid sphere trianglemesh
>> > TEXTURES     = bilerp checkerboard constant dots fbm imagemap marble mix
>> \
>> >                scale uv windy wrinkled
>> > TONEMAPS     = contrast highcontrast maxwhite nonlinear
>> > VOLUMES      = exponential homogeneous volumegrid
>> >
>> > RENDERER     = pbrt
>> >
>> >
>> >
>> > RENDERER_OBJS     := $(addprefix objs/, $(RENDERER:=.o) )
>> > CORE_OBJS         := $(addprefix objs/, $(CORE:=.o) )
>> > CORE_LIB          := core/libpbrt.a
>> >
>> > SHAPES_DSOS       := $(addprefix bin/, $(SHAPES:=.so))
>> > MATERIALS_DSOS    := $(addprefix bin/, $(MATERIALS:=.so))
>> > LIGHTS_DSOS       := $(addprefix bin/, $(LIGHTS:=.so))
>> > INTEGRATORS_DSOS  := $(addprefix bin/, $(INTEGRATORS:=.so))
>> > VOLUMES_DSOS      := $(addprefix bin/, $(VOLUMES:=.so))
>> > TEXTURES_DSOS     := $(addprefix bin/, $(TEXTURES:=.so))
>> > ACCELERATORS_DSOS := $(addprefix bin/, $(ACCELERATORS:=.so))
>> > CAMERAS_DSOS      := $(addprefix bin/, $(CAMERAS:=.so))
>> > FILTERS_DSOS      := $(addprefix bin/, $(FILTERS:=.so))
>> > FILM_DSOS         := $(addprefix bin/, $(FILM:=.so))
>> > TONEMAPS_DSOS     := $(addprefix bin/, $(TONEMAPS:=.so))
>> > SAMPLERS_DSOS     := $(addprefix bin/, $(SAMPLERS:=.so))
>> >
>> > SHAPES_OBJS       := $(addprefix objs/, $(SHAPES:=.o))
>> > MATERIALS_OBJS    := $(addprefix objs/, $(MATERIALS:=.o))
>> > LIGHTS_OBJS       := $(addprefix objs/, $(LIGHTS:=.o))
>> > INTEGRATORS_OBJS  := $(addprefix objs/, $(INTEGRATORS:=.o))
>> > VOLUMES_OBJS      := $(addprefix objs/, $(VOLUMES:=.o))
>> > TEXTURES_OBJS     := $(addprefix objs/, $(TEXTURES:=.o))
>> > ACCELERATORS_OBJS := $(addprefix objs/, $(ACCELERATORS:=.o))
>> > CAMERAS_OBJS      := $(addprefix objs/, $(CAMERAS:=.o))
>> > FILTERS_OBJS      := $(addprefix objs/, $(FILTERS:=.o))
>> > FILM_OBJS         := $(addprefix objs/, $(FILM:=.o))
>> > TONEMAPS_OBJS     := $(addprefix objs/, $(TONEMAPS:=.o))
>> > SAMPLERS_OBJS     := $(addprefix objs/, $(SAMPLERS:=.o))
>> >
>> > RENDERER_BINARY = bin/pbrt
>> >
>> > CORE_HEADERFILES = api.h camera.h color.h dynload.h film.h geometry.h \
>> >                   kdtree.h light.h pbrt.h material.h mc.h mipmap.h
>> octree.h
>> > \
>> >                   paramset.h primitive.h reflection.h sampling.h scene.h
>> \
>> >                   shape.h texture.h timer.h tonemap.h transform.h
>> > transport.h \
>> >                   volume.h
>> >
>> > CORE_HEADERS := $(addprefix core/, $(CORE_HEADERFILES) )
>> >
>> > .SECONDARY: $(SHAPES_OBJS) $(MATERIALS_OBJS) $(LIGHTS_OBJS)
>> > $(INTEGRATORS_OBJS) \
>> >             $(VOLUMES_OBJS) $(ACCELERATORS_OBJS) $(CAMERAS_OBJS)
>> > $(FILTERS_OBJS) \
>> >             $(FILM_OBJS) $(TONEMAPS_OBJS) $(SAMPLERS_OBJS)
>> $(TEXTURES_OBJS)
>> >
>> > .PHONY: tools exrcheck
>> >
>> > default: $(CORE_LIB) $(RENDERER_BINARY) $(INTEGRATORS_DSOS)
>> $(VOLUMES_DSOS)
>> > $(FILM_DSOS) $(SHAPES_DSOS) $(MATERIALS_DSOS) $(LIGHTS_DSOS)
>> > $(ACCELERATORS_DSOS) $(CAMERAS_DSOS) $(SAMPLERS_DSOS) $(FILTERS_DSOS)
>> > $(TONEMAPS_DSOS) $(TEXTURES_DSOS) #tools
>> >
>> > tools: $(CORE_LIB)
>> >     (cd tools && $(MAKE))
>> >
>> > $(CORE_LIB): $(CORE_OBJS)
>> >     @echo "Building the core rendering library (libpbrt.a)"
>> >     @ar rcs $(CORE_LIB) $(CORE_OBJS)
>> >
>> > bin/%.so: objs/%.o
>> >     @$(LD) $(SHARED_LDFLAGS) $^ -o $@
>> >
>> > objs/%.o: renderer/%.cpp $(CORE_HEADERS)
>> >     @echo "Building the rendering binary (pbrt)"
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: core/%.cpp $(CORE_HEADERS)
>> >     @echo "Compiling $<"
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: core/%.c $(CORE_HEADERS)
>> >     @echo "Compiling $<"
>> >     @$(CC) $(CCFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: shapes/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Shape Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: integrators/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Integrator Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: volumes/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Volume Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: textures/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Texture Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: materials/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Material Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: lights/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Light Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: accelerators/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Accelerator Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: cameras/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Camera Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: filters/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Filter Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: tonemaps/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Tone Map Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: film/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Film Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > objs/%.o: samplers/%.cpp $(CORE_HEADERS)
>> >     @echo "Building Sampler Plugin \"$*\""
>> >     @$(CXX) $(CXXFLAGS) -o $@ -c $<
>> >
>> > core/pbrtlex.cpp: core/pbrtlex.l
>> >     @echo "Lex'ing pbrtlex.l"
>> >     @$(LEX) -o$@ core/pbrtlex.l
>> >
>> > core/pbrtparse.h core/pbrtparse.cpp: core/pbrtparse.y
>> >     @echo "YACC'ing pbrtparse.y"
>> >     @$(YACC) -o $@ core/pbrtparse.y
>> >     @if [ -e core/pbrtparse.cpp.h ]; then /bin/mv core/pbrtparse.cpp.h
>> > core/pbrtparse.h; fi
>> >     @if [ -e core/pbrtparse.hpp ]; then /bin/mv core/pbrtparse.hpp
>> > core/pbrtparse.h; fi
>> >
>> > $(RENDERER_BINARY): $(RENDERER_OBJS) $(CORE_LIB)
>> >     @echo "Linking $@"
>> >     @$(CXX) $(LRT_LDFLAGS) -o $@ $(RENDERER_OBJS) $(PBRTPRELINK)
>> > $(CORE_OBJS) $(PBRTPOSTLINK) $(LIBS)
>> >
>> > clean:
>> >     rm -f */*.o */*.so */*.a bin/pbrt core/pbrtlex.[ch]*
>> > core/pbrtparse.[ch]*
>> >     (cd tools && $(MAKE) clean)
>> >
>> > objs/exrio.o: exrcheck
>> >
>> > exrcheck:
>> >     @echo -n Checking for EXR installation...
>> >     @$(CXX) $(CXXFLAGS) -o exrcheck exrcheck.cpp $(LIBS) || \
>> >         (cat exrinstall.txt; exit 1)
>> >
>> >
>> >
>> >
>> >
>> >
>> > 2009/10/19 Mário Costa <mario.silva.costa at gmail.com>
>> >>
>> >> Maybe if you can post the build script or part of it where you
>> >> compile, and have the flag and library definition e could try to
>> >> identify what might be wrong...
>> >>
>> >> Regards,
>> >> Mario
>> >>
>> >> On Mon, Oct 19, 2009 at 2:40 PM, Luís Miranda <luistm at gmail.com>
>> wrote:
>> >> > Well, thanks for the suggestion, but the problem is still happening.
>> >> >
>> >> >
>> >> > Thanks
>> >> >
>> >> > 2009/10/19 Mário Costa <mario.silva.costa at gmail.com>
>> >> >>
>> >> >> Hi,
>> >> >>
>> >> >> The problem is that the irradiancecache.so library is dynamic, and
>> you
>> >> >> are using mpich static library version libpmpich++.a.
>> >> >>
>> >> >> Either you are compiling with -static with gnu, or you are
>> specifying
>> >> >> the static library libpmpich++.a.
>> >> >>
>> >> >> If that is the case remove the -static flag from gnu compiler in the
>> >> >> byuild script, or use -lmpich++ instead of the library ...
>> >> >>
>> >> >> Hope this helps,
>> >> >> Regards,
>> >> >> Mário
>> >> >>
>> >> >> On Mon, Oct 19, 2009 at 11:56 AM, Luís Miranda <luistm at gmail.com>
>> >> >> wrote:
>> >> >> > Hi
>> >> >> >
>> >> >> > I'm having this problem, when i try to compile my software in a
>> >> >> > rocks4.2
>> >> >> > cluster.
>> >> >> >
>> >> >> > /usr/bin/ld:
>> /opt/mpich/myrinet/gnu/lib/libpmpich++.a(intercepts.o):
>> >> >> > relocation R_X86_64_32S against `a local symbol' can not be used
>> when
>> >> >> > making
>> >> >> > a shared object; recompile with -fPIC
>> >> >> > /opt/mpich/myrinet/gnu/lib/libpmpich++.a: could not read symbols:
>> Bad
>> >> >> > value
>> >> >> > collect2: ld returned 1 exit status
>> >> >> > make: *** [bin/irradiancecache.so] Error 1
>> >> >> >
>> >> >> > A solution to the problem, isto to compile the mpich with
>> >> >> > CFLAGS=-fPIC,
>> >> >> > but
>> >> >> > i can't do this, becouse i'm not the cluster's admin.
>> >> >> > Anyone knows any other workaround to the problem?
>> >> >> >
>> >> >> > Thanks
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > mpich-discuss mailing list
>> >> >> > mpich-discuss at mcs.anl.gov
>> >> >> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Mário Costa
>> >> >>
>> >> >> Laboratório Nacional de Engenharia Civil
>> >> >> LNEC.CTI.NTIEC
>> >> >> Avenida do Brasil 101
>> >> >> 1700-066 Lisboa, Portugal
>> >> >> Tel : ++351 21 844 3911
>> >> >> _______________________________________________
>> >> >> mpich-discuss mailing list
>> >> >> mpich-discuss at mcs.anl.gov
>> >> >> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > mpich-discuss mailing list
>> >> > mpich-discuss at mcs.anl.gov
>> >> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>> >> >
>> >> >
>> >> _______________________________________________
>> >> mpich-discuss mailing list
>> >> mpich-discuss at mcs.anl.gov
>> >> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>> >
>> >
>> > _______________________________________________
>> > mpich-discuss mailing list
>> > mpich-discuss at mcs.anl.gov
>> > https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>> >
>> >
>> _______________________________________________
>> mpich-discuss mailing list
>> mpich-discuss at mcs.anl.gov
>> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20091023/f5ba3ffb/attachment-0001.htm>


More information about the mpich-discuss mailing list