Šimon Tóth
Šimon Tóth

Reputation: 36441

Linking issue on Debian8

I'm trying to recompile my software for debian 8, but i have run into this strange issue of libgssappi refusing to link with anything.

>~/torque_github$ gcc test.c -lgssapi
/usr/bin/ld: cannot find -lgssapi
collect2: error: ld returned 1 exit status

The library is present in the system, as seen here:

>~/torque_github$ /sbin/ldconfig -p | grep gssapi
        libgssapi_krb5.so.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2
        libgssapi.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgssapi.so.3

Upvotes: 0

Views: 283

Answers (1)

On my Debian/Jessie/x86-64 system, /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so is provided (according to dpkg -S) by the libkrb5-dev package and /usr/lib/x86_64-linux-gnu/libgssapi.so.3 is provided by libgssapi3-heimdal package (and I don't have any libgssapi*dev package).

You probably should install both of them (with sudo aptitude install libkrb5-dev libgssapi3-heimdal command), and use pkg-config with krb5-gssapi to get compilation and linking flags.

gcc -Wall -g $(pkg-config --cflags krb5-gssapi) \
   test.c \
   $(pkg-config --libs krb5-gssapi) \
   -o myprog

(you could have to change your test.c source code if some API has changed; perhaps you'll need to #include <krb5/krb5.h>)

You might even use gcc -v instead of gcc above.

Remember that order of arguments to gcc matters a big lot. Your initial question had a different order (and that is enough to make gcc fail)!

Upvotes: 1

Related Questions