I am trying to install the GSSAPI module through pip but I receive this error that I don't know how to resolve.
Could not find main GSSAPI shared library. Please try setting GSSAPI_MAIN_LIB yourself or setting ENABLE_SUPPORT_DETECTION to 'false'
I need this to work on Python 2.6 for LDAP3 authentication.
Python-GSSAPI is a Python binding to the Generic Security Service Application Program Interface (GSSAPI). The GSSAPI provides a uniform interface to security services which applications can use without having to worry about implementation details of the underlying mechanisms.
Summary, for the impatient
$ sudo ln -s /usr/bin/krb5-config.mit /usr/bin/krb5-config
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 /usr/lib/libgssapi_krb5.so
$ sudo apt-get install python-pip libkrb5-dev
$ sudo pip install gssapi
And now the details...
I have a Debian system that uses Heimdal Kerberos. I'll take you through what I had to do to get it working for me. Hopefully, this can help someone else as well.
setup.py
for gssapi uses the krb5-config
command to find the GSSAPI library to link against (see here). Because my system was installed using Heimdal instead of MIT Kerberos, the executable command has been renamed to krb5-config.mit
so setup.py
misses it.
$ krb5-config --libs gssapi # doesn't work
bash: krb5-config: command not found
I created a symlink to get it to work for the install:
$ sudo ln -s /usr/bin/krb5-config.mit /usr/bin/krb5-config
$ krb5-config --libs gssapi # does work
-L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err
setup.py
is looking in /usr/lib
for the gssapi library to link against. In Debian Jesse, most libs are now kept in /usr/lib/x86_64-linux-gnu
. Again, a symlink can fix this:
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 /usr/lib/libgssapi_krb5.so
The build fails because it does not recognize a symbol in the library. The reason for this is that it was not able to get the right header file. Silly me, I forgot to include the -dev
package for krb5 headers. Fix this with apt-get:
$ sudo apt-get install libkrb5-dev
Now we should be all ready to go.
$ sudo pip install gssapi
If you want to tidy up, you can remove the symlink to the krb5-config.mit
command:
$ sudo rm /usr/bin/krb5-config
sudo apt install libkrb5-dev
actually installs /usr/bin/krb5-config and /usr/lib/libgssapi_krb5.so
so none of the symlinking was needed, just install libkrb5-dev and you should be good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With