Seite 1 von 1

libusb on MacOSX 10.6

Verfasst: 19 Apr 2012, 08:45
von hvn
Hello,

I'm trying to get libroboint (new name for libft by defiant) running on MacOSX, but it has a dependency on libusb. It has been ported as libusb-devel using Macports, but I'm not sure this will work. Before I start "(re)inventing the wheel", can anyone tell me if this works and how?

Thank you.

Re: libusb on MacOSX 10.6

Verfasst: 19 Apr 2012, 09:03
von Defiant
It has been tested once, a few years ago. So it should work. Just go to http://www.libusb.org/, Download libusb-0.1 and follow the install instructions.

Re: libusb on MacOSX 10.6

Verfasst: 19 Apr 2012, 09:24
von hvn
I downloaded v. 0.1.12. While ./configure goes well, make shows this:

cc1: warnings being treated as errors
darwin.c: In function ‘usb_get_next_device’:
darwin.c:257: warning: passing argument 5 of ‘IOCreatePlugInInterfaceForService’ from incompatible pointer type
darwin.c: In function ‘claim_interface’:
darwin.c:560: warning: passing argument 5 of ‘IOCreatePlugInInterfaceForService’ from incompatible pointer type
darwin.c: In function ‘rw_completed’:
darwin.c:772: warning: cast from pointer to integer of different size
darwin.c:772: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 4 has type ‘unsigned int’
darwin.c:774: warning: cast from pointer to integer of different size
darwin.c: In function ‘usb_os_find_devices’:
darwin.c:1067: warning: format ‘%08lx’ expects type ‘long unsigned int’, but argument 3 has type ‘UInt32’
darwin.c:1095: warning: format ‘%08lx’ expects type ‘long unsigned int’, but argument 5 has type ‘UInt32’
make[2]: *** [darwin.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

So I wonder if this is due to OSX having changed or other things. Unfortunately, the libusb FAQ is only about Linux. How many are using libft/libroboint on Linux/Mac ?

Re: libusb on MacOSX 10.6

Verfasst: 19 Apr 2012, 14:44
von thomass
That's because MacOSX is now 64bit per default.
The code assumes 32bit pointers.
After modifiying it a little bit it compiles without warning but I haven't checked funtionality though.

Cheers,
Thomas

Re: libusb on MacOSX 10.6

Verfasst: 19 Apr 2012, 16:32
von hvn
Hi Thomas,

Didn't think about the 64 bit thing. Can you tell me which modifications you've made? Or send me your new version..?

Thank you.

Re: libusb on MacOSX 10.6

Verfasst: 19 Apr 2012, 17:19
von Defiant
Maybe it works with the ports version now: https://trac.macports.org/ticket/20131

Re: libusb on MacOSX 10.6

Verfasst: 19 Apr 2012, 17:27
von thomass
Hi,

Since I don't know if there is a way to easily post files on this for8um I will give you some instructions to modify darwin.c by yourself.

1. change the type of "score" in line 250 from "long" to "SInt32"
2. Same in line 450, change the type of "score" from "long" to "SInt32"
3. In line 761 change the type of "io_size" from "UInt32" to "unsigned long int"
4. In lines 772 and 774 change the type cast of "io_size" from "(UInt32)" to "(unsigned long int)"
5. In lines 1067 and 1094 change the conversion specifiers from "%08lx" to "%08x"

That's all to get at least libusb running. However libusbpp crashes but it seems to be not necessary for libft/libroboint.

-Thomas

Re: libusb on MacOSX 10.6

Verfasst: 20 Apr 2012, 09:11
von hvn
Ok. I installed libusb from macports so libusb is installed in /opt/local/lib. I adjusted .profile, but apparently I don't get the PATH correct because I get this:

$ cmake .
-- Found Python: /Library/Frameworks/Python.framework/Versions/2.7/bin/python
-- Could not find Doxygen
-- Unable to create documentation!
CMake Error at LIBUSBConfig.cmake:14 (MESSAGE):
Could not find libusb
Call Stack (most recent call first):
lib/CMakeLists.txt:4 (FIND_PACKAGE)

So unless I can figure out what I did wrong here, I'm considering following Thomas's description, although that's for an obsolete version.

Re: libusb on MacOSX 10.6

Verfasst: 20 Apr 2012, 15:36
von Defiant

Re: libusb on MacOSX 10.6

Verfasst: 20 Apr 2012, 21:51
von hvn
Thank you for this link. I've been trying but and far no luck. But I'll keep trying.