PIC /error: relocation R_X86_64_32S against `vtable for hit' can not be used when making a shared object; recompile with -fPIC

PIC /error: relocation R_X86_64_32S against `vtable for hit' can not be used when making a shared object; recompile with -fPIC

Imagen de Daniel N.

I'm newbie with Linux and I'm having trouble with compiling a make file which works well in a 32-bit machine. I didn't write this program but I need it to work to use its functionalities. My machine is 64-bit and I get the following message error:

cd pmtTools; make

make[1]: Entering directory `/home/daniel/Documents/Master_thesis/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysis/pmtTools'

g++ -shared -L/home/root/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -pthread -lm -ldl -rdynamic -o libPmtTools.so hit.o event.o waveform.o readLeCroyBinary.o pmtToolsDict.o

/usr/bin/ld: hit.o: relocation R_X86_64_32S against `vtable for hit' can not be used when making a shared object; recompile with -fPIC

hit.o: could not read symbols: Bad value

collect2: ld returned 1 exit status

make[1]: *** [libPmtTools.so] Error 1

make[1]: Leaving directory `/home/daniel/Documents/Master_thesis/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysis/pmtTools'

make: *** [all] Error 2

I've been trying to solve the problem by using this website but I don't get the program to work... http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=3I'm not used to makefiles and that's why I don't manage to modify the makefiles properly to PIC compile the shared libraries. I added globally the flag 'export CXXFLAGS=$CXXFLAGS -fPIC' but it didn't work. I'm just completely lost.

Here are the make files (two make files and one which calls them).

CXX = $(shell $(ROOTCONFIG) --cxx)

LD = $(shell $(ROOTCONFIG) --ld)

CFLAGS = $(shell $(ROOTCONFIG) --cflags)

LIBS = $(shell $(ROOTCONFIG) --libs)

SOFLAGS = -shared

CINTSRCS = event.cc hit.cc

CINTINCS = event.h hit.h

OBJS = hit.o event.o waveform.o readLeCroyBinary.o pmtToolsDict.o

LIBPMTTOOLS = libPmtTools.so

all: $(LIBPMTTOOLS)

          export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/Documents/Master_thesis/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysis/pmtTools

$(LIBPMTTOOLS): $(OBJS)

          $(LD) $(SOFLAGS) $(LIBS) -o $@ $(OBJS)

%.o: %.cc

          $(CXX) $(CFLAGS) -c -o $@ $<

pmtToolsDict.cc: $(CINTSRCS) $(CINTINCS) pmtToolsLinkDef.h

         @echo "Generating dictionary pmtToolsDict..."

         $(ROOTCINT) -f pmtToolsDict.cc -c -p $(CINTINCS) pmtToolsLinkDef.h

clean:

       rm -f pmtToolsDict.cc pmtToolsDict.h $(LIBPMTTOOLS) $(OBJS)

dox:

      rm -rf html

     $(DOXYGEN) pmtTools.dox

------------------------------------------2---------------------------------------------

ROOTCONFIG = $(ROOTSYS)/bin/root-config

CXX = $(shell $(ROOTCONFIG) --cxx)

LD = $(shell $(ROOTCONFIG) --ld)

CFLAGS = $(shell $(ROOTCONFIG) --cflags) -I../pmtTools

LIBS = $(shell $(ROOTCONFIG) --libs)# -L../pmtTools -lpmtTools

OBJS = analysis.o

SHARED = ../pmtTools/libPmtTools.so

EXE = analysis.exe

all: $(EXE)

$(EXE): $(OBJS) $(SHARED)

      $(LD) $(LIBS) -o $@ $(OBJS) $(SHARED)

$(SHARED):

      cd ../pmtTools; make

%.o: %.cxx

      $(CXX) $(CFLAGS) -c -o $@ $<

test: test.cxx $(SHARED)

      $(CXX) $(CFLAGS) -c -o test.o test.cxx

      $(LD) $(LIBS) -o test.exe test.o $(SHARED)

clean:

        rm -f $(EXE) $(OBJS) test.o test.exe

-----------------------------------------3---------------------

all:

         cd pmtTools;     make

         cd analysis;      make

clean:

         cd pmtTools;     make clean

         cd analysis;      make clean

Hope that someone can help me. Thanks in advance!! Daniel

publicaciones de 5 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Georg Zitzlsberger (Intel)

Hello,

it might be better to ask the author of the program directly as it looks more like a project configuration issue.
One thing you might try, though:

$ make CFLAGS='-fpic'

CXXFLAGS are not used in your Makefile.

Best regards,

Georg Zitzlsberger

Imagen de Sergey Kostrov

[ DUPLICATE ] Removed. Sorry about this.

Imagen de Sergey Kostrov

>>My machine is 64-bit and I get the following message error:
>>
>>cd pmtTools; make
>>
>>make[1]: Entering directory `/home/daniel/Documents/Master_thesis/data_Daniel-Thomas/photondet/trace/PMTSignalsAnalysis/pmtTools'
>>
>>g++ -shared -L/home/root/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics
>>-lMathCore -lThread -pthread -lm -ldl -rdynamic -o libPmtTools.so hit.o event.o waveform.o readLeCroyBinary.o pmtToolsDict.o
>>
>>/usr/bin/ld: hit.o: relocation R_X86_64_32S...

I could only assume that you're accidentally mixing 32-bit and 64-bit objects or libraries when trying to build a 64-bit application. I agree with Georg that it looks like a project configuration problem with a make file and the problem happens when linking object or libraries.

Imagen de Sergey Kostrov

Here are a couple of more notes:

The list of objects files is:
...
OBJS = hit.o event.o waveform.o readLeCroyBinary.o pmtToolsDict.o
...
and a 2nd linker error is also related to:
...
hit.o: could not read symbols: Bad value
...
Is there a possibility that hit.o is corrupted?

Inicie sesión para dejar un comentario.