Skip to content

Instantly share code, notes, and snippets.

@cdwilson
Created April 6, 2012 23:29
Show Gist options
  • Save cdwilson/2323931 to your computer and use it in GitHub Desktop.
Save cdwilson/2323931 to your computer and use it in GitHub Desktop.
Rebuild libusb for OSX Lion 64-bit
#!/bin/sh
# If you're getting errors like:
#
# dyld: Library not loaded: /usr/local/lib/libusb-1.0.0.dylib
# Referenced from: /Users/cwilson/stow/bin/JLinkExe
# Reason: no suitable image found. Did find:
# /opt/local/lib/libusb-1.0.0.dylib: mach-o, but wrong architecture
# Trace/BPT trap: 5
tar xjvf libusb-1.0.8.tar.bz2
cd libusb-1.0.8/
env CFLAGS="-arch i386" ./configure --prefix=$HOME/stow/repository/libusb-1.0.8
make
mv libusb/.libs/libusb-1.0.0.dylib /tmp/libusb-1.0.0.dylib.i386
make clean
env CFLAGS="-arch x86_64" ./configure --prefix=$HOME/stow/repository/libusb-1.0.8
make
mv libusb/.libs/libusb-1.0.0.dylib /tmp/libusb-1.0.0.dylib.x86_64
lipo -create /tmp/libusb-1.0.0.dylib.i386 /tmp/libusb-1.0.0.dylib.x86_64 -output libusb/.libs/libusb-1.0.0.dylib
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment