Using the Nitrokey-App under FreeBSD


I recently installed FreeBSD on my computer and tried to compile the Nitrokey-App to use my Nitrokey-Storage with it. But it is stuck with with cmake complaining that the required hidapi-libusb hot found. when checking the modules

I have installed a couple of libs from pkg indicating lLinux compatible libusb functionality. But had no success so far.

Could anybody lend me a helping hand? TIA!

openBSD nitrokey-app

The App needs hidapi library (which uses in turn libusb). If it is not available on your system as a package then perhaps you could compile it yourself and install. See its Github project site for details.


Thanks for the reply! Sadly I have already installed hidapi 0.8.0-r1_3, which seems to be the latest one, so that seems not to be the reason why I’m stuck.


Just a sanity check - is that a development package (that is with headers for compiling libraries depending on it)?


Good idea. I’m new to FreeBSD and actually not sure if the packages contain also the headers. I’ll check it later.


Ok, when the package is installed with via ports then the hidapi header files got installed, but not found automatically. I guess I’m missing something there. However I got the libnitrokey compiled by adding the needed path information to the file (line 57) and afterwards regenerating the Makefile.

Building the Nitrokey-App now fails by not finding the mntent.h file, which seems to be part of the GNUlib. I’ll investigate this later.


Thank you for the update!
Could you share the changed line? Perhaps I could include it conditionally for FreeBSD there. By the way, have you tried to compile it with CMake?
As for Nitrokey App, I am afraid I never heard of mntent.h before. Any chance this is connected with Qt Framework (that is it is using this header)?


Ahh, it seems I have short memory - at Nitrokey App it is used for parsing the mtab file. AFAIR this is only for convenience and could be safely disabled. Link to usage line.
I have made a fast PR (#316 / branch build-freebsd) for this - could you check is it compiling for you?


The PR branch was successfully compiled and the generating the 2FA token for my account worked nicely. Thanks alot!

In the file I changed the unix:!mac block around line 57 to look like

#   SOURCES += $$PWD/hidapi/linux/hid.c
#    LIBS += -lhidapi-libusb
LIBS += -lhidapi

/usr/local/include/hidapi-libusb is a link to /usr/local/include/hidapi but I don’t know why it was not working.

And regarding cmake,yes I tried using it. But it still does complain about not finding the hidapi-libusb library. As I never used cmake before, but had some experience I used the other way discribed in the README at github and it turned out more comfortable for me with the feedback it provided. Because cmake is still complaining about the missing header file I’m suspecting that I’m missing something in my configuration - but I’ll ask about that in the FreeBSD forums.

Again thanks a lot for helping me!