[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dynamic Library Linking


Hello,

I am currently trying to create a c program that shall ssh into a couple of remote server and execute commands. This program must work independent of windows environment. The problem I am facing is difficulty in linking the library. I have no idea where to go for here and would kindly appreciate any help anyone could offer.

Main File:

#include <stdio.h>
#include <stdlib.h>
#include "libssh/libssh.h"

int main(){\n
    printf("Attempting Library Call!\n");
    ssh_session my_ssh_session=ssh_new();
    printf("Exiting Program!\n");
    ssh_free(my_ssh_session);
    return (EXIT_SUCCESS);
}


Makefile:


gcc -Wall -v -I./libssh-0.5.0/include -I./openssl-0.9.8k_WIN32/include -I./zlib128-dll/include -L./libssh-0.5.0/bin -L./openssl-0.9.8k_WIN32/bin -L./zlib128-dll/bin main.c -o ssh -lssh -lssleay32 -llibeay32


File Makes Correctly:



gcc -Wall -v -I./libssh-0.5.0/include -I./openssl-0.9.8k_WIN32/include -I./zlib128-dll/include -L./libssh-0.5.0/bin -L./openssl-0.9.8k_WIN32/bin -L./zlib128-dll/bin main.c -o ssh -lssh -lssleay32 -llibeay32
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-cygwin/4.8.2/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc4/gcc-4.8.2-2/src/gcc-4.8.2/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc4/gcc-4.8.2-2/src/gcc-4.8.2 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=i686-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__cxa_atexit --with-dwarf2 --with-arch=i686 --with-tune=generic --disable-sjlj-exceptions --enable-languages=ada,c,c++,fortran,java,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support --enable-libssp --enable-libada --enable-libjava --enable-libgcj-sublibs --disable-java-awt --disable-symvers --with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --libexecdir=/usr/lib
Thread model: posix
gcc version 4.8.2 (GCC)
COLLECT_GCC_OPTIONS='-Wall' '-v' '-I' './libssh-0.5.0/include' '-I' './openssl-0.9.8k_WIN32/include' '-I' './zlib128-dll/include' '-L./libssh-0.5.0/bin' '-L./openssl-0.9.8k_WIN32/bin' '-L./zlib128-dll/bin' '-o' 'ssh.exe' '-mtune=generic' '-march=i686'
/usr/lib/gcc/i686-pc-cygwin/4.8.2/cc1.exe -quiet -v -I ./libssh-0.5.0/include -I ./openssl-0.9.8k_WIN32/include -I ./zlib128-dll/include -Dunix -idirafter /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../include/w32api -idirafter ../../include/w32api main.c -quiet -dumpbase main.c -mtune=generic -march=i686 -auxbase main -Wall -version -o /tmp/ccREGbQO.s
GNU C (GCC) version 4.8.2 (i686-pc-cygwin)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
warning: GMP header version 5.1.3 differs from library version 6.0.0.
warning: MPC header version 1.0.1 differs from library version 1.0.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/include"
ignoring nonexistent directory "../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
./libssh-0.5.0/include
./openssl-0.9.8k_WIN32/include
./zlib128-dll/include
/usr/lib/gcc/i686-pc-cygwin/4.8.2/include
/usr/lib/gcc/i686-pc-cygwin/4.8.2/include-fixed
/usr/include
/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../include/w32api
End of search list.
GNU C (GCC) version 4.8.2 (i686-pc-cygwin)
        compiled by GNU C version 4.8.2, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
warning: GMP header version 5.1.3 differs from library version 6.0.0.
warning: MPC header version 1.0.1 differs from library version 1.0.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ea6119f678bf3f4d2bd25c1777844d24
COLLECT_GCC_OPTIONS='-Wall' '-v' '-I' './libssh-0.5.0/include' '-I' './openssl-0.9.8k_WIN32/include' '-I' './zlib128-dll/include' '-L./libssh-0.5.0/bin' '-L./openssl-0.9.8k_WIN32/bin' '-L./zlib128-dll/bin' '-o' 'ssh.exe' '-mtune=generic' '-march=i686'
/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/as.exe -v -I ./libssh-0.5.0/include -I ./openssl-0.9.8k_WIN32/include -I ./zlib128-dll/include -o /tmp/ccHMSXts.o /tmp/ccREGbQO.s
GNU assembler version 2.24.51 (i686-pc-cygwin) using BFD version (GNU Binutils) 2.24.51.20140326
COMPILER_PATH=/usr/lib/gcc/i686-pc-cygwin/4.8.2/:/usr/lib/gcc/i686-pc-cygwin/4.8.2/:/usr/lib/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/4.8.2/:/usr/lib/gcc/i686-pc-cygwin/:/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../../i686-pc-cygwin/bin/
LIBRARY_PATH=/usr/lib/gcc/i686-pc-cygwin/4.8.2/:/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-Wall' '-v' '-I' './libssh-0.5.0/include' '-I' './openssl-0.9.8k_WIN32/include' '-I' './zlib128-dll/include' '-L./libssh-0.5.0/bin' '-L./openssl-0.9.8k_WIN32/bin' '-L./zlib128-dll/bin' '-o' 'ssh.exe' '-mtune=generic' '-march=i686'
/usr/lib/gcc/i686-pc-cygwin/4.8.2/collect2.exe --wrap _Znwj --wrap _Znaj --wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwjRKSt9nothrow_t --wrap _ZnajRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap _ZdaPvRKSt9nothrow_t -Bdynamic --dll-search-prefix=cyg --large-address-aware --tsaware -o ssh.exe /usr/lib/gcc/i686-pc-cygwin/4.8.2/../../../crt0.o /usr/lib/gcc/i686-pc-cygwin/4.8.2/crtbegin.o -L./libssh-0.5.0/bin -L./openssl-0.9.8k_WIN32/bin -L./zlib128-dll/bin -L/usr/lib/gcc/i686-pc-cygwin/4.8.2 -L/usr/lib/gcc/i686-pc-cygwin/4.8.2/../../.. /tmp/ccHMSXts.o -lssh -lssleay32 -llibeay





When I try to run it:

/home/alexionescu/SSH_CON/ssh.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory


I am using 32 bit Cygwin for developing the c program, with 32 bit gcc and make tools.

What library can it not open? Which library '?' is it looking for?

Thank you,
Alex Ionescu, Co-Op Student
TELUS Communications Inc.
Technology Strategy & Operations
Consilium Place, Scarborough, Ontario
Mobile: 647-462-2093



Archive administrator: postmaster@lists.cynapses.org