简体   繁体   中英

libusb 1.0.20 wont compile on osx yosemite

I'm trying to install the new libusb 1.0.20 version on my mac for a project i;m working on. Mainly i'm interested in the libusb static libraries .a and .la

I got the source code from online and I go into the directory and type ./configure adn the package configures properly. now after I enter make, it goes all crazy with errors. I cant seem to figure it out. I think it might be something to do with the settings of my machine but I cant seem to figure it out. Can someone please help me. This is what I'm getting:

 make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in libusb
  CC       libusb_1_0_la-core.lo
  CC       libusb_1_0_la-descriptor.lo
  CC       libusb_1_0_la-io.lo
  CC       libusb_1_0_la-strerror.lo
  CC       libusb_1_0_la-sync.lo
  CC       libusb_1_0_la-hotplug.lo
  CC       os/libusb_1_0_la-threads_posix.lo
  CC       os/libusb_1_0_la-darwin_usb.lo
In file included from /usr/include/dispatch/dispatch.h:51:0,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:15,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:13,
                 from /System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:55,
                 from /System/Library/Frameworks/IOKit.framework/Headers/IOCFBundle.h:26,
                 from os/darwin_usb.h:26,
                 from os/darwin_usb.c:43:
/usr/include/dispatch/object.h:143:15: error: expected identifier or '(' before '^' token
 typedef void (^dispatch_block_t)(void);
               ^
/usr/include/dispatch/object.h:362:3: error: unknown type name 'dispatch_block_t'
   dispatch_block_t notification_block);
   ^
In file included from /System/Library/Frameworks/IOKit.framework/Headers/usb/IOUSBLib.h:27:0,
                 from os/darwin_usb.h:27,
                 from os/darwin_usb.c:43:
/System/Library/Frameworks/IOKit.framework/Headers/usb/USB.h:601:9: error: too many #pragma options align=reset
 #pragma options align=reset
         ^
In file included from /System/Library/Frameworks/IOKit.framework/Headers/usb/IOUSBLib.h:27:0,
                 from os/darwin_usb.h:27,
                 from os/darwin_usb.c:43:
/System/Library/Frameworks/IOKit.framework/Headers/usb/USB.h:771:9: error: too many #pragma options align=reset
 #pragma options align=reset
         ^
/System/Library/Frameworks/IOKit.framework/Headers/usb/USB.h:823:9: error: too many #pragma options align=reset
 #pragma options align=reset
         ^
/System/Library/Frameworks/IOKit.framework/Headers/usb/USB.h:841:9: error: too many #pragma options align=reset
 #pragma options align=reset
         ^
/System/Library/Frameworks/IOKit.framework/Headers/usb/USB.h:861:9: error: too many #pragma options align=reset
 #pragma options align=reset
         ^
os/darwin_usb.c: In function 'darwin_get_device_descriptor':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:484:39: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
                                       ^
os/darwin_usb.c: In function 'get_configuration_index':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:495:39: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
                                       ^
os/darwin_usb.c: In function 'darwin_get_active_config_descriptor':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:517:39: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
                                       ^
os/darwin_usb.c: In function 'darwin_get_config_descriptor':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:531:39: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *priv = DARWIN_CACHED_DEVICE(dev);
                                       ^
os/darwin_usb.c: In function 'darwin_open':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:946:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'darwin_close':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:995:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'darwin_get_configuration':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1034:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'darwin_set_configuration':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1042:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'darwin_claim_interface':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1147:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'darwin_reset_device':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1331:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'darwin_kernel_driver_active':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1383:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'submit_control_transfer':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1615:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'cancel_control_transfer':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1685:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
                                        ^
os/darwin_usb.c: In function 'darwin_abort_transfers':
os/darwin_usb.c:58:76: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
 #define DARWIN_CACHED_DEVICE(a) ((struct darwin_cached_device *) (((struct darwin_device_priv *)((a)->os_priv))->dev))
                                                                            ^
os/darwin_usb.c:1700:40: note: in expansion of macro 'DARWIN_CACHED_DEVICE'
   struct darwin_cached_device *dpriv = DARWIN_CACHED_DEVICE(transfer->dev_handle->dev);
                                        ^
make[3]: *** [os/libusb_1_0_la-darwin_usb.lo] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Solvedf it. apparently switching CC from gcc to clang solves the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM