Unable to install teensy_loader_cli on Raspberry Pi. Can't install libusb-dev

dlab

Active member
Running make throws the following error:

Code:
cc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb 
teensy_loader_cli.c:228:17: fatal error: usb.h: No such file or directory
 #include <usb.h>
                 ^
compilation terminated.
Makefile:15: recipe for target 'teensy_loader_cli' failed
make: *** [teensy_loader_cli] Error 1

running "sudo apt install libusb-dev" says that the package does not have an installation candidate

Is there any way to install libusb-dev on Raspbian Stretch?
 
I am able to build it on a RPI4, I have built it both for Ubuntu as well as Raspian... But I am running 64 bit.

Code:
kurte@kurte-rpi4:~ $ uname -a
Linux kurte-rpi4 5.15.76-v8+ #1597 SMP PREEMPT Fri Nov 4 12:16:41 GMT 2022 aarch64 GNU/Linux

kurte@kurte-rpi4:~/github $ git clone https://github.com/PaulStoffregen/teensy_loader_cli.git
Cloning into 'teensy_loader_cli'...
remote: Enumerating objects: 255, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 255 (delta 13), reused 29 (delta 12), pack-reused 223
Receiving objects: 100% (255/255), 313.67 KiB | 3.20 MiB/s, done.
Resolving deltas: 100% (119/119), done.
kurte@kurte-rpi4:~/github $ cd teensy_loader_cli/
kurte@kurte-rpi4:~/github/teensy_loader_cli $ make
cc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb
teensy_loader_cli.c:228:10: fatal error: usb.h: No such file or directory
  228 | #include <usb.h>
      |          ^~~~~~~
compilation terminated.
make: *** [Makefile:15: teensy_loader_cli] Error 1

kurte@kurte-rpi4:~/github/teensy_loader_cli $ sudo apt-get install libusb-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libusb-0.1-4
The following NEW packages will be installed:
  libusb-0.1-4 libusb-dev
0 upgraded, 2 newly installed, 0 to remove and 9 not upgraded.
Need to get 59.0 kB of archives.
After this operation, 299 kB of additional disk space will be used.
..
kurte@kurte-rpi4:~/github/teensy_loader_cli $ make
cc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb
...
kurte@kurte-rpi4:~/github/teensy_loader_cli $ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
kurte@kurte-rpi4:~/github/teensy_loader_cli $ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ bullseye main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ bullseye main
...
kurte@kurte-rpi4:~/github/teensy_loader_cli $ ./teensy_loader_cli
Filename must be specified

Usage: teensy_loader_cli --mcu=<MCU> [-w] [-h] [-n] [-b] [-v] <file.hex>
        -w : Wait for device to appear
        -r : Use hard reboot if device not online
        -s : Use soft reboot if device not online (Teensy 3.x & 4.x)
        -n : No reboot after programming
        -b : Boot only, do not program
        -v : Verbose output

Use `teensy_loader_cli --list-mcus` to list supported MCUs.

For more information, please visit:
http://www.pjrc.com/teensy/loader_cli.html
kurte@kurte-rpi4:~/github/teensy_loader_cli $
I believe this confirms I am running Raspian Bullseye...


And for what it is worth, I was also able to build the TyTools on this as well:
Code:
kurte@kurte-rpi4:~/github $ git clone https://github.com/Koromix/tytools.git
Cloning into 'tytools'...
...
kurte@kurte-rpi4:~/github $ sudo apt-get install build-essential cmake libudev-dev qtbase5-dev pkg-config
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
build-essential is already the newest version (12.9).
pkg-config is already the newest version (0.29.2-1).
...
...
kurte@kurte-rpi4:~/github/tytools $ # You can of course use another directory if you prefer.
mkdir -p build/linux && cd build/linux
cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../..
make

...

...

kurte@kurte-rpi4:~/github/tytools/build/linux $ sudo make install
...
kurte@kurte-rpi4:~/github/tytools/build/linux $ tycmd
usage: tycmd <command> [options]

General options:
       --help               Show help message
       --version            Display version information

   -B, --board <tag>        Work with board <tag> instead of first detected
   -q, --quiet              Disable output, use -qqq to silence errors

Commands:
   identify                 Identify models compatible with firmware
   list                     List available boards
   monitor                  Open serial (or emulated) connection with board
   reset                    Reset board
   upload                   Upload new firmware

Supported models:
   - Teensy++ 1.0           (at90usb646)
   - Teensy 2.0             (atmega32u4)
   - Teensy++ 2.0           (at90usb1286)
   - Teensy 3.0             (mk20dx128)
   - Teensy 3.1             (mk20dx256)
   - Teensy LC              (mkl26z64)
   - Teensy 3.2             (mk20dx256)
   - Teensy 3.5             (mk64fx512)
   - Teensy 3.6             (mk66fx1m0)
   - Teensy 4.0 (beta 1)    (imxrt_b1)
   - Teensy 4.0             (imxrt)
   - Teensy 4.1             (imxrt_t41)
   - Teensy MicroMod        (imxrt_mm)
kurte@kurte-rpi4:~/github/tytools/build/linux $
 
Also works on "buster"

Code:
paul@pi4:~ $ sudo apt install libusb-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libusb-dev is already the newest version (2:0.1.12-32).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
paul@pi4:~ $ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
 
Works on Pi-zero-W with stretch

Code:
 sudo apt-get install libusb-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libusb-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.4 kB of archives.
After this operation, 217 kB of additional disk space will be used.
Get:1 http://raspbian.phirephly.design/raspbian stretch/main armhf libusb-dev armhf 2:0.1.12-30 [35.4 kB]
Fetched 35.4 kB in 1s (32.3 kB/s)
Selecting previously unselected package libusb-dev.
(Reading database ... 141361 files and directories currently installed.)
Preparing to unpack .../libusb-dev_2%3a0.1.12-30_armhf.deb ...
Unpacking libusb-dev (2:0.1.12-30) ...
Setting up libusb-dev (2:0.1.12-30) ...
Processing triggers for man-db (2.7.6.1-2) ...
 
I have an SD card for my 3B with stretch on it. I have the same version of libusb-dev installed on it (2:0.1.12-30) that bicycleguy mentioned. And I've built the teensy_loader_cli on it as well. libusb-dev depends on libusb-0.1.4 (=2:0.1.12-30) and one of libc6-dev or libc-dev.
 
Thanks for all the responses, I was able to install the package finally, not sure what exactly went wrong.
Will try to find out
 
Back
Top