I'm trying to include a lib into my code (libssh) but nothing works... At this point I'm unsure what to do as no results are popping up in search engines for the errors i'm recieving.
I downloaded libssh here: https://github.com/substack/libssh
I installed these:
yum install cmake zlib-devel libpng-devel openssl-devel -y;
Created a "build" directory as parent of libssh, moved there, typed this:
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
make
[root@ build]# cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug LD_DEBUG=all ..
-- Could NOT find NaCl (missing: NACL_LIBRARIES NACL_INCLUDE_DIRS)
-- ********************************************
-- ********** libssh build options : **********
-- zlib support: ON
-- libgcrypt support: OFF
-- libnacl support: OFF
-- SSH-1 support: OFF
-- SFTP support: ON
-- Server support : ON
-- GSSAPI support : ON
-- Pcap debugging support : ON
-- With static library: OFF
-- Unit testing: OFF
-- Client code Unit testing: OFF
-- Public API documentation generation
-- Benchmarks: OFF
-- ********************************************
-- Configuring done
-- Generating done
-- Build files have been written to: /root/libssh/build
And then it fails...
Scanning dependencies of target exec
[ 2%] Building C object examples/CMakeFiles/exec.dir/exec.c.o
[ 5%] Building C object examples/CMakeFiles/exec.dir/authentication.c.o
[ 8%] Building C object examples/CMakeFiles/exec.dir/knownhosts.c.o
[ 11%] Building C object examples/CMakeFiles/exec.dir/connect_ssh.c.o
Linking C executable exec
/usr/bin/ld: cannot find -lssh_shared
collect2: ld a retourné 1 code d'état d'exécution
make[2]: *** [examples/exec] Erreur 1
make[1]: *** [examples/CMakeFiles/exec.dir/all] Erreur 2
make: *** [all] Erreur 2
Anyone know what the problem is? "cannot find -lssh_shared" showed me nothing related on google.
The error message is resulted from the linker
/usr/bin/ld
is failed to link to the libraryssh_shared.so
while compiling.I checked the file
libssh/build/src/CMakeFiles/ssh_shared.dir/build.make
, there's some linking messages inside:You can notice that during the build process,
cmake
would try to link some libraries under my system path/usr/lib/x86_64-linux-gnu/
. And go to check yours.