Jul 14, 2009
Building libusb and avrdude (no more problems!)
As much for my benefit as for anyone else, this is my recipe for building the 0.1 release of libusb and avrdude 5.8. For the last few months I’ve been unable to successfully build and install libusb. I tried off and on but lacked motivation until recently when I needed the latest avrdude and its support for AT90USB162 parts.
Finally, success thanks to notes on the Arduino playground: Using the AVR ISP mkII (USB) to burn the bootloader on MacOS X.
Start by grabbing the libusb tarball. I used 0.1.12 from the legacy 0.1 branch.
Untar and cd into the libusb source directory. Then, and this was the crucial bit for me:
$ IDIR=/Users/zeveland/temp $ ./configure --prefix=$IDIR --disable-build-docs
Follow up with make and sudo make install. Previous libusb build attempts had left headers and library files scattered all over my system; –prefix let me specify where the install should go so that avrdude could find it. –disable-build-docs may be optional for you – I have an old version of jade that was causing build to fail on the docs.
After this, avrdude built fine for me but every programming attempt with an AVRISP mkII started with a five minute timeout while avrdude did… something. Even though programming always worked eventually, the timeout was annoying. An old message on comp.hardware.avr.avrdude.devel pointed to the cause: the function stk500v2_getsync() in stk500v2.c in the avrdude distribution has a problem on some Intel Macs. Like the OP’s author, I commented-out the function’s contents and recompiled. The step-by-step (thanks again to the Playground post):
export CFLAGS=-I$IDIR/include export LDFLAGS=-L$IDIR/lib cd avrdude-5.8/ ./configure --prefix=$IDIR make sudo make install
So it only took a few months, but libusb is working for me again. Yay!