Opened 13 months ago

Last modified 7 months ago

#67189 assigned defect

hidapi @0.12.0_0: hidapi_darwin.h missing

Reported by: UNIVAC-Colonel-Panic Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: ryandesign (Ryan Carsten Schmidt)
Port: hidapi

Description (last modified by ryandesign (Ryan Carsten Schmidt))

My first report -- please be kind :) as I am not very familiar with the MacPorts ecosystem.

I'm compiling a program and it fails with this error:

fatal error: 'hidapi/hidapi_darwin.h' file not found; #include <hidapi/hidapi_darwin.h>

When I extract the source tarball: https://github.com/libusb/hidapi/archive/refs/tags/hidapi-0.12.0.tar.gz

there are two hidapi-related headers:

  • hidapi-0.12.0/mac/hidapi_darwin.h (about 4k bytes)
  • hidapi-0.12.0/hidapi/hidapi.h (about 18k bytes)

After I do sudo port install hidapi the only hidapi-related header file on my Big Sur is located here:

  • /opt/local/include/hidapi/hidapi.h (about 18k bytes)

In case it helps, Homebrew puts these headers here:

  • /usr/local/include/hidapi/hidapi.h -> /usr/local/Cellar/hidapi/... (about 18k bytes)
  • /usr/local/opt/hidapi/include/hidapi/hidapi.h -> /usr/local/Cellar/hidapi/... (about 18k bytes)
  • /usr/local/include/hidapi/hidapi_darwin.h -> /usr/local/Cellar/hidapi/... (about 4k bytes)
  • /usr/local/opt/hidapi/include/hidapi/hidapi_darwin.h -> /usr/local/Cellar/hidapi/... (about 4k bytes)

Change History (4)

comment:1 Changed 13 months ago by jmroot (Joshua Root)

Cc: raimue@… removed
Owner: set to raimue
Status: newassigned

comment:2 Changed 13 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

The hidapi Portfile contains no special directives affecting what gets installed, so it's entirely up to the hidapi build system what gets installed, and I guess they don't install hidapi_darwin.h.

To the extent that I understand its syntax, the Homebrew formula doesn't seem to mention anything about hidapi_darwin.h either. However, Homebrew is installing 0.13.1 while we are installing 0.12.0. Maybe we should start by updating the port to the latest version. That may already fix it. Maybe there was a bug in 0.12.0 that caused that file not to get installed. I do see one place (in dist/hidapi.podspec) where they forgot to mention that header in 0.12.0 and fixed it afterward but I don't know if that file is involved in the installation process.

comment:3 Changed 8 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign added

I've tried updating the port to 0.14.0 and that didn't fix it. hidapi_darwin.h is still not installed. I discovered the cause is that we are using the autotools build system. If we switch to the cmake build system, the header is installed. I reported this deficiency to the developers and they will not fix it because the autotools build system is deprecated. Meanwhile, switching to cmake has other problems, such as that the library version number will regress, which means we would have to revbump every port that links with libhidapi. I'd rather not do that, so I'll submit a PR that updates the port to 0.14.0, still using autotools, and manually copies in this header.

comment:4 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

I haven't forgotten about this.

Just to document it somewhere in MacPorts space, the other problem with switching hidapi to cmake is that it would no longer make both the dynamic and static libraries at the same time. Upstream has a recommended set of steps for how to make them separately. It doesn't fit well into the model used by the MacPorts cmake portgroup which expects to run cmake and make once each but the astyle Portfile provides a possible example we could follow for hidapi.

Note: See TracTickets for help on using tickets.