Error recompile with fPIC, but fPIC is already as a compilation option
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Error recompile with fPIC, but fPIC is already as a compilation option
Hello I am getting this error when I am doing the make of a program
Relocation R_X86_64_32 against `vtable for Torch::MemoryDataSet' can not be used when making a shared object; recompile with -fPIC
It says that I should recompile with the -fPIC option, but I already have the -fPIC option in the CFLAGS and CXXFLAGS of the make file, is there any way to solve this?. I have seen that this problem is related with the use of a 64 bits machine, and it is true because I am using one.
It's always better to post the last 20-30 lines of the failed make which will include the actual error message. Are you sure all of the Makefiles in the source tree contain -fPIC? Are you sure it's not complaining about a 32-bit dependency that whatever app (something else that might be helpful) you're trying to build is attempting to link against?
Thanks for your answer, this is the complete error message,
/usr/bin/ld: /home/olmedo/RL_Toolbox/external_libs/torch3/lib/Linux_OPT_DOUBLE/libtorch.a(MemoryDataSet.o): relocation R_X86_64_32 against `vtable for Torch::MemoryDataSet' can not be used when making a shared object; recompile with -fPIC
/home/olmedo/RL_Toolbox/external_libs/torch3/lib/Linux_OPT_DOUBLE/libtorch.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [../lib/librltoolbox.so.1.0.0] Error 1
Libtorch.a is a file from an external library, is maybe the cause of the problem the other library?. I think that all my makefiles have the -fPIC option, I have only one makefile in the directory , so I think that that is the only one that is being in used.
Well, 5 lines of output is almost 20-30. It's helpful to see what the compiler or linker was trying to do when it failed. Anyway, if libtorch is a dependency lib for RL_Toolbox, then you need a 64-bit copy of libtorch compiled with -fPIC.
Thank for the answer, here you have the rest of the lines:
makedepend: warning: ckdtrees.cpp, line 5: cannot find include file "iostream"
not in /usr/lib64/qt-3.3/mkspecs/default/iostream
not in ./iostream
not in ../external_libs/torch3/include/iostream
not in ../external_libs/newmat11/iostream
not in ../include/iostream
not in /usr/include/iostream
test -d ../lib/ || mkdir -p ../lib/
rm -f librltoolbox.so.1.0.0 librltoolbox.so librltoolbox.so.1 librltoolbox.so.1.0
g++ -shared -Wl,-soname,librltoolbox.so.1 -o librltoolbox.so.1.0.0 cacrobotmodel.o caction.o cactionstatistics.o cactorcritic.o cadaptivesoftmaxnetwork.o cadvantagelearning.o cagentcontroller.o cagent.o cagentlistener.o cagentlogger.o canalyzer.o ccartpolemodel.o ccontinuousactiongradientpolicy.o ccontinuousactions.o ccontinuoustime.o cdiscretizer.o cdynamicprogramming.o cenvironmentmodel.o cepisode.o cepisodehistory.o cerrorlistener.o cexploration.o cfeaturefunction.o cgradientfunction.o cgridworldmodel.o chierarchicbehaviours.o chierarchiccontroller.o chistory.o clearndataobject.o clinearfafeaturecalculator.o cmontecarlo.o cmultipolemodel.o cmyexception.o cparameters.o cpegasus.o cpendulummodel.o cpolicies.o cpolicygradient.o cprioritizedsweeping.o cqetraces.o cqfunction.o cregions.o creinforce.o cresiduals.o crewardfunction.o crewardmodel.o cstatecollection.o cstate.o cstatemodifier.o cstateproperties.o csupervisedlearner.o ctaxidomain.o ctdlearner.o ctestsuit.o ctheoreticalmodel.o ctorchvfunction.o ctransitionfunction.o cutility.o cvaluepolicygradientlearner.o cvetraces.o cvfunction.o cvfunctionfromqfunction.o cvfunctionlearner.o ril_debug.o cbatchlearning.o clstd.o cdatafactory.o cextratrees.o cforest.o cinputdata.o ctrees.o ctreevfunction.o ctreebatchlearning.o crbftrees.o cnearestneighbor.o ckdtrees.o clocalregression.o cmodeltree.o csamplingbasedmodel.o cbaseobjects.o cevaluator.o -ltorch -L/home/olmedo/RL_Toolbox/external_libs/torch3/lib/Linux_OPT_DOUBLE -lnewmat -L/home/olmedo/RL_Toolbox/external_libs/newmat11/lib
/usr/bin/ld:
/home/olmedo/RL_Toolbox/external_libs/torch3/lib/Linux_OPT_DOUBLE/libtorch.a(MemoryDataSet.o): relocation R_X86_64_32 against `vtable for Torch::MemoryDataSet' can not be used when making a shared object; recompile with -fPIC
/home/olmedo/RL_Toolbox/external_libs/torch3/lib/Linux_OPT_DOUBLE/libtorch.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [../lib/librltoolbox.so.1.0.0] Error 1
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.