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!

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?

1 Like

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!

Sorry for reviving this one, but I’m trying to get my newly acquired Nitrokey Pro to work under FreeBSD 12. I suspect some behaviour moved in 2 years, however I’m getting another situation trying to compile the nitrokey-app using gmake that fails on crockford.hpp :

    --- hotpslot.o ---
    ../src/hotpslot.cpp:38:10: fatal error: 'cppcodec/base32_crockford.hpp' file not found
    #include <cppcodec/base32_crockford.hpp>

Note that on cmake, I also had the same behaviour as @bAvatar .

Any hints on what I should be looking at ?


Hi @PorCus!
Sorry for the delay.

Have you checked that all Git modules were downloaded? Please run the following on your downloaded Git repository and the build again:

git submodule update  --init --recursive

In case you are running the build from the zip archive, the submodules will not be provided there unfortunately.

Hi @szszszsz,

Indeed that worked out. I double checked and here is my situation :

  • No hidapi installed either from ports or pkg
  • Adding this in after line 61 as previously mentioned was necessary :
  • using qmake … and make -j4 for building
  • and my first mistake was that I missed the --recursive when doing my first git clone.

Also I noticed there is a typo in your command, it’s “submodule” rather than “submodules”

So I’ll test with my key later on tonight, but I guess I’ll confirm it works also on FreeBSD 12.

Thanks for the support !

1 Like

Indeed, thanks and welcome!
In case you would have any suggestions to make it working out-of-the-box for FreeBSD please feel free to make a PR. I will try to look into it while working on the next release.

Edit: ticket: nitrokey-app#449