darrylb123 / usbrelay

Control usb relay - based on hidapi
GNU General Public License v2.0
315 stars 98 forks source link

Properly detect multiarch lib directory on Debian systems #68

Closed wentasah closed 3 years ago

wentasah commented 3 years ago

Multiarch in Debian means that multiple architectures can be installed together in a single system. If multiple architectures are installed, we should not end up with installing libraries compiled for the host system the directory for the last detected architecture, which might be different from the host.

In my case, x86 library was installed to /usr/lib/arm-linux-gnueabihf.

To detect the correct directory, we now use the dpkg-architecture command, which knows the correct path. I hope this should work on all Debian/Ubuntu-based systems.

It might be possible that the previously used checks in the Makefile were also effective on some non-Debian distributions and this stops working because those distributions don't have the dpkg-architecture command. The workaround is to specify LIBDIR explicitly on the make command line:

make install LIBDIR=/whatever/lib/path