Search code examples
iosbootlibusb

Symbols not found in libusb


Note that I am new to iOS (actually, iDevices) internals. I'm trying to compile iRecovery, a tool used to communicate with iBoot, iOS's bootloader. Sadly... I'm getting errors about libusb while compiling :

./configure: line 15323: syntax error near unexpected token `libusb,'
./configure: line 15323: `PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.3)'

libusb is installed :

$> pkg-config --libs libusb
-L/opt/local/lib -lusb
$> pkg-config --libs libusb-1.0
-L/opt/local/lib -lusb-1.0 

I tried to comment out the line that checks for libusb, but then I get a bunch of not found symbols, such as :

"_libusb_set_configuration", referenced from:
 _irecv_open_with_ecid in libirecovery_la-libirecovery.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

My simple question is... WHY ?! Thanks for any help...


Solution

  • Okay, so here's a dirty workaround :

    • open (NOT RUN) autogen.sh file, and comment out the "PKG_CHECK_MODULES(libusb, libusb-1.0 >= 1.0.3)" line
    • save
    • run autogen.sh modified file provided
    • open the makefile located in /src : add "-lusb-1.0 -L/usr/local/lib/ -I /usr/local/include/ - I /usr/local/include/libusb-1.0" to the "GLOBAL_CFLAGS" variable
    • save
    • cd to main directory (parent of /src)
    • make
    • make install

    Once done, your should be able to run irecovery from your shell. Please note that it is not really clean, and that it is only confirmed to work for iRecovery.

    But - It Works !