[mgv4ce@node4 test]$ which root
/common/lib/root-5.34.23//bin/root
[mgv4ce@node4 test]$ which root.exe
/common/lib/root-5.34.23//bin/root.exe
I will be installing a new version of ROOT this weekend on a new machine. I will reproduce the error on that machine (or not). In the mean time of course…anything that occurs to you.
In your “makefile”, try to replace:
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $@ $(EXPLLINKLIBS)
with:
$(CXX) $(CXXFLAGS) $(SOFLAGS) $(OutPutOpt) $@ $^ $(EXPLLINKLIBS) $(LIBS)
and then try to “make clean ; make myClass.so ; make” and then try to “.L myClass.so” and TClass::GetClass(“myClass”) in “root.exe”.
One test, please … remove “$(LIBS)” from this line …
$(CXX) $(CXXFLAGS) $(SOFLAGS) $(OutPutOpt) $@ $^ $(EXPLLINKLIBS)
then try again “make clean ; make myClass.so ; make” and so on …
What OS version are you running on? Can you reupload a tar file containing your current failing example? [I.e. so far I can *not* reproduce this problem nor guess what the issue might be]
I am building new root version and trying on a different system. In the mean time, may I ask if the following files work for the experts? Or if they also have Bronch unable to find the class? This helps me narrow down where my error may be. Many thanks! makefile.txt (1.67 KB) LinkDef.h (150 Bytes) myClass.cpp (404 Bytes) myClass.h (442 Bytes) myApp.cxx (407 Bytes)
It did not work for me out of the box:g++ -pthread -std=c++11 -Wno-deprecated-declarations -m64 -I/home/pcanal/cint_working/rootcling/root/altc++11/include -fPIC -O2 -Wall -Wno-write-strings -shared -o myClass.so myClass.o EventDict.o -L/home/pcanal/cint_working/rootcling/root/altc++11/lib -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -pthread -lm -ldl -rdynamic -lm -lz -lutil -lnsl -lpthread -L.
/home/pcanal/bin/ld: error: myClass.o: requires unsupported dynamic reloc 11; recompile with -fPIC
/home/pcanal/bin/ld: error: myClass.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: myClass.o: requires dynamic R_X86_64_PC32 reloc against '_ZN7myClass5ClassEv' which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: myClass.o: requires dynamic R_X86_64_PC32 reloc against '_ZN7myClass5ClassEv' which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: myClass.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: myClass.o: requires dynamic R_X86_64_32 reloc against '__gxx_personality_v0' which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: EventDict.o: requires dynamic R_X86_64_PC32 reloc against '_ZN8TStorage11ObjectAllocEmPv' which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: EventDict.o: requires dynamic R_X86_64_PC32 reloc against '_ZdlPv' which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: EventDict.o: requires unsupported dynamic reloc 11; recompile with -fPIC
/home/pcanal/bin/ld: error: EventDict.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/home/pcanal/bin/ld: error: EventDict.o: requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
Once I added -fPIC ot the CXXFLAGS:CXXFLAGS += -fPIC -O2 -Wall -Wno-write-strings
It worked fine for both v6 and v5 on a Scientic Linux 6.7 machine.
There is something odd with your OS installation and/or environment. I just installed CentOS 6.7 and the compilation of your example failed (as it should) mentioning that fPIC is necessary. Once I add fPIC it all works for me.