question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Make] Libusb error

See original GitHub issue

Hello,

Can’t make because of libusb :

pierrearnoud@macbook-pro-de-pierre usbboot % make
cc -Wall -Wextra -g -o rpiboot main.c -lusb-1.0
main.c:1:10: fatal error: 'libusb-1.0/libusb.h' file not found
#include <libusb-1.0/libusb.h>
         ^~~~~~~~~~~~~~~~~~~~~
1 error generated.

I have libusb insatlled

pierrearnoud@macbook-pro-de-pierre usbboot % brew info libusb
libusb: stable 1.0.24 (bottled), HEAD
Library for USB device access
https://libusb.info/
/opt/homebrew/Cellar/libusb/1.0.24 (22 files, 560.5KB) *
  Poured from bottle on 2021-05-30 at 18:06:35
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libusb.rb
License: LGPL-2.1-or-later
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 64,482 (30 days), 211,215 (90 days), 813,259 (365 days)
install-on-request: 6,988 (30 days), 19,139 (90 days), 77,925 (365 days)
build-error: 0 (30 days)

I’m working on MacBook Pro : image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Parnoudcommented, May 31, 2021

Thank for your answer. Finally I just figured out how solutions my problem ! You was right, we need to include homebrew libusb : we can juste modify the Makefile with this :

  1. Find the libusb include :
% brew ls libusb
/opt/homebrew/Cellar/libusb/1.0.24/include/libusb-1.0/libusb.h
/opt/homebrew/Cellar/libusb/1.0.24/lib/libusb-1.0.0.dylib
/opt/homebrew/Cellar/libusb/1.0.24/lib/pkgconfig/libusb-1.0.pc
/opt/homebrew/Cellar/libusb/1.0.24/lib/ (2 other files)
/opt/homebrew/Cellar/libusb/1.0.24/share/libusb/ (9 files)
  1. Add include to Makefile Warning do not include the “/libusb-1.0/libusb.h” and “/libusb-1.0.0.dylib”
rpiboot: main.c msd/bootcode.h msd/start.h msd/bootcode4.h msd/start4.h
        $(CC) -Wall -Wextra -g -o $@ $< -lusb-1.0 -I/opt/homebrew/Cellar/libusb/1.0.24/include -L/opt/homebrew/Cellar/libusb/1.0.24/lib
  1. Make
% make
cc -Wall -Wextra -g -o rpiboot main.c -lusb-1.0 -I/opt/homebrew/Cellar/libusb/1.0.24/include -L/opt/homebrew/Cellar/libusb/1.0.24/lib

Or the main.c and MakeFile for greater durability : Makefile :

rpiboot: main.c msd/bootcode.h msd/start.h msd/bootcode4.h msd/start4.h
        $(CC) -Wall -Wextra -g -o $@ $<  `pkg-config --cflags --libs libusb-1.0`

main.c :

#include <libusb.h>
1reaction
thesuperzappercommented, Jan 6, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Libusb error while running make · Issue #12 - GitHub
It's as I suspected you have a (probably older) libusb installation in /usr/local which is used instead of the correct official version. This ......
Read more >
fatal error: libusb/libusb.h: No such file or directory librtlsdr ...
... I suspect my problem was actually that I hadn't installed gr-osmosdr with ... cd rtl-sdr mkdir build cd build cmake .. sudo...
Read more >
gcc: error: /usr/lib/libusb-1.0.so: No such file or directory
First install the dev package: sudo apt update sudo apt install libusb-1.0-0-dev. Next, we can locate the file by listing all the files...
Read more >
libusb-1.0 API Reference
Error handling. libusb functions typically return 0 on success or a negative error code on failure. These negative error codes relate to LIBUSB_ERROR...
Read more >
[libusb] compile error with libusb-1.0 - SourceForge
I am trying to make a flightgear program using a usb input device (LS1208). I have compiled and run the program before on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found