Static compilation of linux C libcurl applications (missing library)

//to-long-didnt-read -> missing lgssapi_krb5 library and can't seem to find it 

I'm having problems with static libcurl binding using one of them test applications.

ive read the forums, and someone said that you run the curl-config -libs command and enable all of these libraries, but the command returns

 ~/Desktop# curl-config --libs -lcurl 

while returns them

 [ root@zabbix ~]# curl-config --libs -L/usr/kerberos/lib -lcurl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv -ldl -lidn -lssl -lcrypto -lz 

I also read this post

Static libcurl link using c

and my conclusion

 ~/Desktop# ldd /usr/lib/libcurl.so linux-gate.so.1 => (0xb78be000) libidn.so.11 => /usr/lib/libidn.so.11 (0xb7837000) liblber-2.4.so.2 => /usr/lib/liblber-2.4.so.2 (0xb782a000) libldap_r-2.4.so.2 => /usr/lib/libldap_r-2.4.so.2 (0xb77e2000) librt.so.1 => /lib/tls/i686/cmov/librt.so.1 (0xb77d9000) libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0xb77aa000) libz.so.1 => /lib/libz.so.1 (0xb7795000) libgnutls.so.26 => /usr/lib/libgnutls.so.26 (0xb76fa000) libgcrypt.so.11 => /lib/libgcrypt.so.11 (0xb7686000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb752c000) libresolv.so.2 => /lib/tls/i686/cmov/libresolv.so.2 (0xb7518000) libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0xb7500000) libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb74e7000) /lib/ld-linux.so.2 (0xb78bf000) libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0xb7436000) libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0xb7411000) libcom_err.so.2 => /lib/libcom_err.so.2 (0xb740d000) libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0xb7405000) libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7401000) libkeyutils.so.1 => /lib/libkeyutils.so.1 (0xb73fd000) libtasn1.so.3 => /usr/lib/libtasn1.so.3 (0xb73eb000) libgpg-error.so.0 => /lib/libgpg-error.so.0 (0xb73e6000) 

and when I try to compile with

 ~/Desktop# gcc -static test.c -o down -lcurl -lidn -llber -lldap -lrt -lgssapi_krb5 -lgssapi_krb5 -lz -lgnutls -lgcrypt 

I get

 /usr/bin/ld: cannot find -lgssapi_krb5 collect2: ld returned 1 exit status 

I tried searching for this library, but I cannot find it through search queries. I also tried apt-get cache search, but it did not give any results. I am running Ubuntu and any help is much appreciated.

+4
source share
1 answer

found a job that works.

 $ wget http://curl.haxx.se/download/curl-7.24.0.tar.lzma $ tar xf curl-7.24.0.tar.lzma $ cd curl-7.24.0 $ ./configure --disable-shared --enable-static --prefix=/tmp/curl --disable-ldap --disable-sspi $ make && make install $ cat << EOF > ac #include <curl/curl.h> int main() { printf("%s\n", curl_version()); return 0; } EOF $ gcc ac -static $(/tmp/curl/bin/curl-config --static-libs --cflags) -ldl $ file a.out a.out: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.15, not stripped $ ./a.out libcurl/7.24.0 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 
+9
source

Source: https://habr.com/ru/post/1400753/


All Articles