libssh2 ver. 0.18
I am trying to build libssh2 on a Linux SUSE 10.2 on an AMD 64 Opteron and I encounter problems. I have successfully built and installed zlib and openssl but I cannot build libssh2. The error I get is:
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -fPIC -I/usr/local/ssl/include -I/usr/local/include -L/usr/local/ssl/lib -lcrypto -L/usr/local/lib -lz -o libssh2.la -rpath /usr/local/lib -version-info 1:0:0 -no-undefined channel.lo comp.lo crypt.lo hostkey.lo kex.lo mac.lo misc.lo packet.lo publickey.lo scp.lo session.lo sftp.lo userauth.lo pem.lo transport.lo openssl.lo
gcc -shared .libs/channel.o .libs/comp.o .libs/crypt.o .libs/hostkey.o .libs/kex.o .libs/mac.o .libs/misc.o .libs/packet.o .libs/publickey.o .libs/scp.o .libs/session.o .libs/sftp.o .libs/userauth.o .libs/pem.o .libs/transport.o .libs/openssl.o -L/usr/local/ssl/lib -lcrypto -L/usr/local/lib -lz -Wl,-soname -Wl,libssh2.so.1 -o .libs/libssh2.so.1.0.0
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: /usr/local/ssl/lib/libcrypto.a(x86_64cpuid.o): relocation R_X86_64_PC32 against `OPENSSL_cpuid_setup' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [libssh2.la] Error 1
Please note the color highlighting... I am asked to use -fPIC which I had already used. I built my zlib and my openssl with -fPIC too.
Any advice, anybody?
Well this is a very rare error, with only about 7 entries in Google and another 2 or 3 in languages that I don't understand. :) Unfortunately, none of those entries have the answer. Its just radio silence. I got this error when trying to copile the tomcat library that uses the Apache Portable Runtime ( apr ). Since this was completely frustrating to me and the internet community has served me well in the past I thought I would repay the favor in the hopes that someone else suffers a few less hours in their life. :)
After tearing my hair out for several hours and hitting the bottle, I stumbled upon a very simple answer. You need to install openssl-devel. If you are using CentOS like moi, then simply do "yum install openssl-devel". Voila.
All the best,
Bulldog Data Services
BulldogData - Since I can't post a url to other sites without having posted more than once you will have to just add the .com here to get to my site if you so desire to go there. Since I have actually posted an answer to a valid question here, hopefully the admins on the forum will look kindly on my little ploy to get around this limitation, since I am a busy man and don't have time to post multiple messages on internet forums all day. :)
Well, "I solved" the problem but I cannot say I really understand what solved it. I talked to the sysadmin who has magic powers on that server and he re-installed a bunch of libraries updated libtools and next thing I knew, the darn code compiles and links just fine. It all happened on a SuSE 10.2 and apparently you gotta use it's Yast to pull in updates, not just build and install them yourself... which is a bit bizarre, to say the least (doesn't sound Linux-like...)
|All times are GMT -5. The time now is 04:44 AM.|