I've getting the following linking error while compiling mlpack:
[ 37%] Linking CXX shared library ../../lib/libmlpack.so
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib/libiberty.a(cplus-dem.o): warning: relocation against `libiberty_demanglers' in read-only section `.text'
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/../../../../lib/libiberty.a(cp-demangle.o): relocation R_X86_64_PC32 against symbol `cplus_demangle_builtin_types' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [src/mlpack/CMakeFiles/mlpack.dir/build.make:1040: lib/libmlpack.so.3.4] Error 1
make[1]: *** [CMakeFiles/Makefile2:2106: src/mlpack/CMakeFiles/mlpack.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
It seems I need to recompile libiberty.a library with -fPIC flag. How do I do that?
I found this bug report on the issue. In my case I was able to fix things by downgrading a few packages (as described in the report):
binutils 2.36.1-3
gcc 11.1.0-3
gcc-libs 11.1.0-3
gcc fortran-11.1.0-3
Ultimately this should be resolved when binutils gets updated.
Related
I am getting a make error while running omnetpp.
I have turned the clang and the lld off. The exact error is:
Creating shared library: /home/ash/omnetpp-master/out/gcc-release/src/sim/liboppsim.so
/usr/bin/ld: /usr/local/lib/libpython3.10.a(pythonrun.o): warning: relocation against _Py_UnhandledKeyboardInterrupt' in read-only section .text'
/usr/bin/ld: /usr/local/lib/libpython3.10.a(bytearrayobject.o): relocation R_X86_64_PC32 against symbol `_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:135: /home/ash/omnetpp-master/out/gcc-release/src/sim/liboppsim.so] Error 1
make[1]: *** [Makefile:134: sim] Error 2
make: *** [Makefile:35: allmodes] Error 2
Do NOT use the omnetpp master branch. There is absolutely no guarantee that the master branch is properly working or at least compiling at any given time.
I was trying to install Armadillo in my Ubuntu 14.04.
I run cmake . command in the terminal at the folder where the Armadillo files are located and then run make command. I got the following errors.
/usr/bin/ld: /usr/local/lib/libsuperlu.a(util.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object;
recompile with -fPIC
/usr/local/lib/libsuperlu.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [libarmadillo.so.7.800.1] Error 1
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
make: *** [all] Error 2
How can I rectify this?
The library at /usr/local/lib/libsuperlu.a on your system was most likely not built with -fPIC and you are presumably trying to build a shared library that uses code from libsuperlu.a. If this is your situation, then the compiler is telling you that the code in libsuperlu.a is not relocatable, but your shared library needs it to be. You will need to build your own libsuperlu.a and ensure that all of its object files are compiled with the -fPIC flag, since the libsuperlu.a you currently have installed in /usr/local/lib won't work for you.
While trying to make the memcached gem, i am getting the following error:
*linking shared-object rlibmemcached.so
/usr/bin/ld: skipping incompatible /ghostcache/nightly_build/components/ruby-memcached/akamai/ruby-memcached/memcached-1.8.0/ext/lib/libmemcached_gem.a when searching for -lmemcached_gem
/usr/bin/ld: skipping incompatible /ghostcache/nightly_build/components/ruby-memcached/akamai/ruby-memcached/memcached-1.8.0/ext/lib/libmemcached_gem.a when searching for -lmemcached_gem
/usr/bin/ld: cannot find -lmemcached_gem
collect2: ld returned 1 exit status
make[2]: *** [rlibmemcached.so] Error 1*
Looks like there is some platform issue. The libmemcached_gem.a library does exist in that path. I tried building by passing -m32 and -m64, but it fails for the same reason.
Any help will be much appreciated.
I try to build graphviz from git http://github.com/ellson/graphviz/
It stop building with this message
make[2]: Leaving directory `/home/peter/work/sdk/graphviz/graphviz-src/graphviz/cmd/gvedit'
CXX gvedit-moc_csettings.o
CXX gvedit-moc_imageviewer.o
CXX gvedit-moc_mainwindow.o
CXX gvedit-moc_mdichild.o
CXX gvedit-qrc_mdi.o
CXXLD gvedit
/usr/bin/ld: gvedit-mainwindow.o: undefined reference to symbol 'agseterrf'
/home/peter/work/sdk/graphviz/graphviz-src/graphviz/lib/cgraph/.libs/libcgraph.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[1]: *** [gvedit] Error 1
make[1]: Leaving directory `/home/peter/work/sdk/graphviz/graphviz-src/graphviz/cmd/gvedit'
make: *** [all-recursive] Error 1
Can you point me to the problem?
I found this issue on the github repo: https://github.com/ellson/graphviz/issues/1
It appears there is some issue with the perl plugin, for me building with
./configure --enable-perl=no
was enough to fix the issue (and I didn't lose any functionality I need).
I am trying to install Giza++ and Moses on Ubuntu 12.10 64bit. While make I keep on getting the same problem:
Finished building giza
cp ../lib/libgiza.a /usr/local/lib/
................................
giza-pgplot.o -L/usr/X11R6//lib -lX11 -L/usr/X11R6//lib -lcairo -lm -L/usr/local /lib/x86_64/ -lgfortran
/usr/bin/ld: giza-fortran.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
giza-fortran.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[1]: *** [../lib/libpgplot.so] Error 1
make[1]: Leaving directory `/home/maria/moses/giza/build'
make: *** [install] Error 2 "
Googling did not help much. I would be very grateful for any tip of how to solve this problem. What should I do to recompile it with -fPIC?
This problem existed only with the giza check out from the svn. This one from tar.gz http://code.google.com/p/giza-pp/downloads/list installed without any problems. Whatever it was...