How to compile this?

I want to compile cryptsetup keyslot_checker , but I get error

gcc -lm -lcryptsetup chk_luks_keyslots.c -o chk_luks_keyslots  chk_luks_keyslots.c:39:27: fatal error: libcryptsetup.h: No such file or directory  #include <libcryptsetup.h>

in FAQ they say

 There is a tool that automatizes this in the cryptsetup distribution from version 1.6.0 onwards.  It is located in misc/keyslot_checker/.  Instructions how to use and how to interpret results are in the README file.  Note that this tool requires a libcryptsetup from cryptsetup 1.6.0 or later (which means libcryptsetup.so.4.5.0 or later).  If the tool complains about missing functions in libcryptsetup, you likely have an earlier version from your distribution still installed.  You can either point the symbolic link(s) from libcryptsetup.so.4 to the new version manually, or you can uninstall the distribution version of cryptsetup and re-install that from cryptsetup >= 1.6.0 again to fix this.  

but I use version newer than 1.6.0

 apt-cache policy cryptsetup cryptsetup:   Installed: 2:1.7.3-4   Candidate: 2:1.7.3-4   Version table:  *** 2:1.7.3-4 100         100 /var/lib/dpkg/status

How can I fix this ? I don't understand how to point the symbolic link(s) from libcryptsetup.so.4 to the new version manually. And I don't want to re-install crypsetup because I'm afraid of damaging my disk.

Does the libcryptsetup.h include file exist anywhere on your system?

find / -print | grep libcryptsetup.h

If it does, add the directory that it contains to your gcc command:

gcc -I<dir>

Thanks for your post and good luck!

2 Likes