mccdaq / uldaq

MCC Universal Library for Linux
MIT License
97 stars 35 forks source link

libusb problem on M1 Mac #44

Open etjensen opened 2 years ago

etjensen commented 2 years ago

I cannot build the library on an M1 Mac- ./configure gives an error:

checking operating system... arm-apple-darwin21.4.0
 Mac OS X
checking for libusb_init in -lusb-1.0... no

  Library libusb-1.0 was not found on this system.
  Please install it and re-run ./configure

even though I have installed libusb using homebrew and it claims that it is a universal build.

config.log says: configure:16180: checking for libusb_init in -lusb-1.0 configure:16205: gcc -o conftest -O3 conftest.c -libusb-1.0 -framework IOKit -framework CoreFoundation >&5 ld: library not found for -libusb-1.0 clang: error: linker command failed with exit code 1 (use -v to see invocation) configure:16205: $? = 1 configure: failed program was: | /* confdefs.h */

The build on my x86 iMac seemed to work fine.

jeffreyg3 commented 2 years ago

Hello, unfortunately, uldaq is not currently compatible with MacBook Pro with M1 apple silicon. At this time, I do not have a timeframe for when it will be.

Sorry for the inconvenience.

jeffreyg3 commented 2 years ago

see also #43 #27

jeffreyg3 commented 2 years ago

This worked for me:

Download the source from github.com: https://github.com/libusb/libusb/releases/tag/v1.0.26

Build it in the standard way:

$ tar xvfj libusb-1.0.26.tar.bz2 $ cd libusb-1.0.26 $ ./configure $ make $ make check $ sudo make install

Then you can continue on with uldaq installation at ./configure && make

etjensen commented 2 years ago

Oddly I still get the same error on ./configure- possibly not connecting to the right "libusb"? I am stumped by this. `checking how to hardcode library paths into programs... immediate checking operating system... arm-apple-darwin21.4.0 Mac OS X checking for libusb_init in -lusb-1.0... no

Library libusb-1.0 was not found on this system. Please install it and re-run ./configure`

jeffreyg3 commented 2 years ago

no promises but something else you could try, would be to install MacPorts https://www.macports.org/install.php

While I was working on the solution on my MacBook Pro 14, I had installed this along the way.

sbazaz commented 2 years ago

@etjensen could you please check your /opt/homebrew/lib/ folder to see if the libusb-1.0.0.dylib file is installed there?

jaschawilcox commented 1 year ago

I was able to get past this by adding some additional flags pointing directly at homebrew: $./configure LDFLAGS="-L/opt/homebrew/lib" CPPFLAGS="-I/opt/homebrew/include"

Then we can make normally $make

larer commented 2 months ago

Hi, I'm new here, so bear with me. I have a Mac M2, with MacPorts, I got the same problem with configure complaining about libusb not being installed, which it was. I got past the configure problem by pointing the flags to MacPorts library: ./configure LDFLAGS="-L/opt/local/lib" CPPFLAGS="-I/opt/local/include" Hope this helps someone.

Then I got some 27 warnings during make Most of them on "anonymous non-C-compatible type..." when void is used, some other were "'kIOMasterPortDefault' is deprecated:" and "'sprintf' is deprecated:"

In summary I got it working and I can now collect data with my MCC USB-1808X, on my Mac.