PDA

View Full Version : Problem with libusb in macOS high Sierra



Eduardo Huerta
8th January 2019, 03:46
hi, I add libusb through "external library" and add the file libusb.h to the project folder and when I run one of the examples (listdevs.c) of this library I get the following problem. I understand it's a compatibility problem. Does anyone know how to fix this problem?

ld: warning: ignoring file /Users/eduardo/My Cloud/Programas/dataMonitor 10 copy/libusb-1.0-2.22/MinGW64/static//libusb-1.0.a, file was built for archive which is not the architecture being linked (x86_64): /Users/eduardo/My Cloud/Programas/dataMonitor 10 copy/libusb-1.0-2.22/MinGW64/static//libusb-1.0.a
Undefined symbols for architecture x86_64:
"_libusb_get_bus_number", referenced from:
configureGraph::print_devs(libusb_device**) in configuregraph.o
"_libusb_get_device_address", referenced from:
configureGraph::print_devs(libusb_device**) in configuregraph.o
"_libusb_get_device_descriptor", referenced from:
configureGraph::print_devs(libusb_device**) in configuregraph.o
"_libusb_get_port_numbers", referenced from:
configureGraph::print_devs(libusb_device**) in configuregraph.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [dataMonitor.app/Contents/MacOS/dataMonitor] Error 1
22:35:33: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project dataMonitor (kit: Desktop Qt 5.11.1 clang 64bit)
When executing step "Make"


Does anyone know if there is a generic driver in macOS like the Microsoft winUSB for Qt?
thanks for help me

d_stranz
8th January 2019, 18:02
Does anyone know how to fix this problem?

You probably either need to get a 64-bit version of a compiled libusb-1.0.a or built it yourself from the source code using the same compiler tool chain you are using for your app.

Changing to a different library won't help if it is built for the wrong architecture.

Eduardo Huerta
11th January 2019, 00:41
Compile the libusb source code with my program and show an error similar to the previous one.
Thanks

d_stranz
11th January 2019, 16:25
Are your libraries being linked into your executable in the correct order? Unlike Microsoft C++, linux linkers usually require libraries to be linked in order of dependence. That is, if library A requires symbols that are defined in library B, then library A must be listed first, followed by library B. If you have them listed in reverse order, then the symbols needed by library A will not be loaded from library B and you will get an undefined symbol error.

ChrisW67
13th January 2019, 00:09
Compile the libusb source code with my program and show an error similar to the previous one.

Still looks like you have a library built for something other than 64-bit x86. Is the old one still present on your machine?

Seems odd...I am no Mac person, but I did not think that there was such a beast as a 32-bit OS X... and therefore little call for non-64-bit libraries.