I'm writting a extension for pyton3.6. My develop machine run gcc7.3, and production environment os is centos6. I use the following link option to static link glibc to avoid upgrade glibc2.12 to glibc2.14+.
-Wl,-Bdynamic -lpython3.6m -Wl,-Bstatic -lboost_python36
But get error:
[ 50%] Linking CXX shared module helloext.so
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgcc_s
/usr/bin/x86_64-linux-gnu-ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
CMakeFiles/helloext.dir/build.make:94: recipe for target 'helloext.so' failed
make[2]: *** [helloext.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/helloext.dir/all' failed
make[1]: *** [CMakeFiles/helloext.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Anyone known? Thanks.
The reason might be although libgcc is present it may not be in the paths known to ldconfig. Check this by doing
/sbin/ldconfig -p | grep libgcc
Does the output show that there is a link to libgcc corresponds to paths that you have listed above?
A work around for you may be to add the link to the relevant library to your compile command e.g.
... -L /usr/lib/gcc/x86_64-linux-gnu/4.6/
Another may be to create a symbolic link to the library yourself.
ln -s /usr/lib/gcc/x86_64-linux-gnu/4.6/libgcc_s.so /usr/lib/gcc/libgcc_s.so
You have not informed us about Linux you are using. Update 4.6 with the proper number in the command above.
Related
According to the Linux and macOS: Installation guide for Armadillo, on Debian machine(ubuntu-16.04) I was trying for installing the armadillo library and after executing the command : $cmake .
The full stop separated from "cmake" by a space is important.
I executed the command : $ make (also tried with root privileges still), the following error was thrown.
piyush#ubuntu:~/armadillo$ sudo make
Scanning dependencies of target armadillo
[ 33%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper1.cpp.o
[ 66%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper2.cpp.o
[100%] Linking CXX shared library libarmadillo.so
/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
CMakeFiles/armadillo.dir/build.make:123: recipe for target 'libarmadillo.so.9.800.2' failed
make[2]: *** [libarmadillo.so.9.800.2] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/armadillo.dir/all' failed
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
This library is available in Ubuntu. Just do
sudo apt install libarmadillo-dev
P.S. Never run sudo make, it's a very bad practice.
environment
ubuntu 18.04
I want to install ISSM (ice sheet system model)
In this process, it needs to install many external packages.
In the make, I got the following error message.
/usr/bin/ld: cannot find -l/home/testuser/issm/trunk//externalpackages/mpich/install/lib/libmpifort.so
I follow two(?) general solutions, but I don't yet find a fittable solution.
I wonder -l<NameOfLibrary>, but, in my case, I got -l<AddrOfLibrary>.
Is this a normal case?
Is there a general solution?
My original question:
/usr/bin/ld: cannot find ld -l
I install CMake in a docker container with volume sharing.
So, I can finish to execute ./configure.sh.
But among make, I got these error /usr/bin/ld: cannot find -l<xxx>
CXXLD libISSMCore.la
*** Warning: Linking the shared library libISSMCore.la against the
*** static library /home/testuser/issm/trunk//externalpackages/m1qn3/install/libm1qn3.a is not portable!
*** Warning: Linking the shared library libISSMCore.la against the
*** static library /home/testuser/issm/trunk//externalpackages/m1qn3/install/libddot.a is not portable!
/usr/bin/ld: cannot find -l/home/testuser/issm/trunk//externalpackages/mpich/install/lib/libmpifort.so
collect2: error: ld returned 1 exit status
Makefile:4505: recipe for target 'libISSMCore.la' failed
make[3]: *** [libISSMCore.la] Error 1
make[3]: Leaving directory '/home/testuser/issm/trunk/src/c'
Makefile:460: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/testuser/issm/trunk/src'
Makefile:582: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/testuser/issm/trunk'
Makefile:479: recipe for target 'all' failed
make: *** [all] Error 2
user01#opendataserver:/home/testuser/issm/trunk$ ls ./externalpackages/mpich/install/lib/
libfmpich.so libmpicxx.la libmpifort.so libmpi.so.12.1.0
libmpi.a libmpicxx.so libmpifort.so.12 libmpl.so
libmpichcxx.so libmpicxx.so.12 libmpifort.so.12.1.0 libopa.so
libmpichf90.so libmpicxx.so.12.1.0 libmpi.la pkgconfig
libmpich.so libmpifort.a libmpi.so
libmpicxx.a libmpifort.la libmpi.so.12
Question in ISSM forum
Solution1: general solution ~ FAILED
/usr/bin/ld: cannot find -lpgm
이는 링크 단계에서 libpgm.so.<숫자> 인 라이브러리를 링크시키지 못했다는 말입니다.
1) find / -name libpgm* -print 를 하여 libpgm.so.x 파일이 존재하는지를 파악하고, 없으면 라이브러리가 제대로 설치가 안된 것입니다.
2) 파일이 존재한다면 LD_LIBRARY_PATH 에 해당 디렉토리가 들어가 있지 않기 때문입니다.
bash의 경우 (libpgm.so.x 파일이 /xxx/xxx1/xxx2/ 디렉토리 밑에 존재한다면)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/xxx/xxx1/xxx2/
3) 다시 컴파일 해보길.. 행운을 빕니다.
Nothing will be happen.
Done
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/testuser/issm/trunk/externalpackages/mpich/install/lib/
Ref
Solution2: similar solution ~ FAILED
First, you need to know the naming rule of lxxx:
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find -lltdl
/usr/bin/ld: cannot find -lXtst
lc means libc.so, lltdl means libltdl.so, lXtst means libXts.so.
So, it is lib + lib-name + .so
Once we know the name, we can use locate to find the path of this lxxx.so file.
$ locate libiconv.so
/home/user/anaconda3/lib/libiconv.so # <-- right here
/home/user/anaconda3/lib/libiconv.so.2
/home/user/anaconda3/lib/libiconv.so.2.5.1
/home/user/anaconda3/lib/preloadable_libiconv.so
/home/user/anaconda3/pkgs/libiconv-1.14-0/lib/libiconv.so
/home/user/anaconda3/pkgs/libiconv-1.14-0/lib/libiconv.so.2
/home/user/anaconda3/pkgs/libiconv-1.14-0/lib/libiconv.so.2.5.1
/home/user/anaconda3/pkgs/libiconv-1.14-0/lib/preloadable_libiconv.so
If you cannot find it, you need to install it by yum (I use CentOS). Usually you have this file, but it does not link to right place.
Link it to the right place, usually it is /lib64 or /usr/lib64
$ sudo ln -s /home/user/anaconda3/lib/libiconv.so /usr/lib64/
Done!
ref: https://i-pogo.blogspot.jp/2010/01/usrbinld-cannot-find-lxxx.html
Done
sudo ln -s /home/testuser/issm/trunk/externalpackages/mpich/install/lib/libmpifort.so /usr/lib/
Ref
The -l (lower-case L) option is to specify a library name not a path.
To add a path to search for libraries use the -L option.
You can also list the full path of the library as an input file, but then without any options.
So either use the options -L/home/testuser/issm/trunk/externalpackages/mpich/install/lib -lmpifort
Or use plain /home/testuser/issm/trunk//externalpackages/mpich/install/lib/libmpifort.so as an inout file (after the other object files).
When I tried to compile example from Anvil framework for Vulkan I get following errors:
[ 97%] Linking CXX executable OutOfOrderRasterization
/usr/bin/ld: cannot find -lvulkan
collect2: error: ld returned 1 exit status
CMakeFiles/OutOfOrderRasterization.dir/build.make:126: recipe for target 'OutOfOrderRasterization' failed
make[2]: *** [OutOfOrderRasterization] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/OutOfOrderRasterization.dir/all' failed
make[1]: *** [CMakeFiles/OutOfOrderRasterization.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
How i need to configure Vulkan to resolve it? (Ubuntu)
Check you LIBRARY paths. You might need to download and install vulkan. There should a .so file in one your library paths(/usr/lib{,64},/lib{,64}, /usr/share/lib{,64}) named to the effect of libvulkan.numbers.so.
See this ask ubuntu question: https://askubuntu.com/questions/796442/ld-cannot-find-lvulkan
CMake versions 3.7 and later ship with a FindVulkan.cmake module that finds the Vulkan includes and library for you if you have a Vulkan SDK installed and the VULKAN_SDK environment variable set. The CMake module also finds the includes and library if you have installed a Vulkan package to your system directories. The Getting Started guide on the LunarXchange website has some additional detail.
I am installing software on a server with no root privileges. I come across the following error during installation:
make[1]: *** [hgaprec] Error 1
make[1]: Leaving directory `/seq/.../SOFTWARE/hgaprec/src'
make: *** [all-recursive] Error 1
Making install in src
make[1]: Entering directory `/seq/.../SOFTWARE/hgaprec/src'
g++ -O3 -o hgaprec ratings.o main.o log.o hgaprec.o -larpack -llapack -
lblas -lgsl -lpthread -lgslcblas
/.../software/free/Linux/redhat_6_x86_64/pkgs/gcc_5.2.0/bin/ld: cannot
find -larpack
collect2: error: ld returned 1 exit status
make[1]: *** [hgaprec] Error 1
make[1]: Leaving directory `/seq/.../SOFTWARE/hgaprec/src'
make: *** [install-recursive] Error 1
Since library arpack could not be found, I then installed it here /seq/.../SOFTWARE/hgaprec/ARPACK and found that the process generated a static file libarpack_LINUX.a. To link this static library to gcc the following command was used:
gcc -larpack -L/seq/.../SOFTWARE/hgaprec/ARPACK/libarpack_LINUX.a
However, I keep getting the same error while installation of the software that larpack was not found. Am I using the linking command wrong?
You either want gcc main.c /seq/../SOFTWARE/hgaprec/ARPACK/libarpack_LINUX.a (you don't need -l and -L if you're specifying the full path to static library), or as #Julian_Cienfuegos suggested gcc main.c -L/seq/../SOFTWARE/hgaprec/ARPACK/ -larpack_LINUX. This assumes you're only compiling a single file called main.c which contains your main() function, and outputs the a.out binary.
EDIT: Added explanation of main.c.
My issue got solved after including the ARPACK library path as part of LD flag in configure like so:
./configure --prefix=/seq/.../SOFTWARE/hgaprec LDFLAGS="-L/seq/.../SOFTWARE/hgaprec/ARPACK/"
I tried to make qt 5.4.1 with openSsl configuration but i got some errors during make it.
I configured it as bellow :
OPENSSL_LIBS='-L/usr/local/ssl/lib -lssl -lcrypto' ./configure -prefix $PWD/qtbase -opensource -debug-and-release -nomake tests -openssl-linked -I/usr/local/ssl/include -L/usr/local/ssl/lib
and then make.
the last 10 line of output is:
/usr/bin/ld: /usr/local/ssl/lib/libssl.a(s2_srvr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libssl.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[3]: *** [../../lib/libQt5Network.so.5.4.1] Error 1
make[3]: Leaving directory `/mnt/l/software/qt-everywhere-opensource-src-5.4.1/qtbase/src/network'
make[2]: *** [sub-network-make_first] Error 2
make[2]: Leaving directory `/mnt/l/software/qt-everywhere-opensource-src-5.4.1/qtbase/src'
make[1]: *** [sub-src-make_first] Error 2
make[1]: Leaving directory `/mnt/l/software/qt-everywhere-opensource-src-5.4.1/qtbase'
make: *** [module-qtbase-make_first] Error 2
To link a static library into a shared library on x86_64, the static library needs to be compiled with -fPIC. You could now build OpenSSL manually with -fPIC set, but that'd be a bit of a hassle.
I'd suggest to configure Qt with -openssl instead of -openssl-linked. Then SSL won't be linked at compile time but loaded dynamically (dlopen) at runtime. It's the usual way to handle OpenSSL in Qt, also because of the incompabilities between the OpenSSL and GPL licenses.