Skip to content

picotool cannot be built because libUSB is not found. #339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
holmbuar opened this issue Jul 16, 2023 · 5 comments
Closed

picotool cannot be built because libUSB is not found. #339

holmbuar opened this issue Jul 16, 2023 · 5 comments
Labels
question Further information is requested

Comments

@holmbuar
Copy link

holmbuar commented Jul 16, 2023

I am using Ubuntu 22.04.2 on my Pi 4, trying to install Pico SDK. The installation went fine, until:

Cloning into 'picotool'...
remote: Enumerating objects: 175, done.
remote: Counting objects: 100% (93/93), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 175 (delta 81), reused 64 (delta 61), pack-reused 82
Receiving objects: 100% (175/175), 113.62 KiB | 1.01 MiB/s, done.
Resolving deltas: 100% (103/103), done.
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Using PICO_SDK_PATH from environment ('/home/pi/pico/pico-sdk')
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
-- Could NOT find LIBUSB (missing: LIBUSB_INCLUDE_DIR) 
CMake Error at CMakeLists.txt:34 (message):
  picotool cannot be built because libUSB is not found


-- Configuring incomplete, errors occurred!
See also "/home/pi/pico/picotool/build/CMakeFiles/CMakeOutput.log".

Error from running manual build as in Appendix B in getting started guide, after confirming

pi@pi4:~/pico/picotool/build$ sudo apt install libusb-1.0-0-dev
[sudo] password for pi: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libusb-1.0-0-dev is already the newest version (2:1.0.25-1ubuntu2).
pi@pi4:~/pico/picotool/build$ cmake ../
Using PICO_SDK_PATH from environment ('/home/pi/pico/pico-sdk')
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
-- Could NOT find LIBUSB (missing: LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR) 
CMake Error at CMakeLists.txt:34 (message):
  picotool cannot be built because libUSB is not found


-- Configuring incomplete, errors occurred!
See also "/home/pi/pico/picotool/build/CMakeFiles/CMakeOutput.log".

I have tried modifying /home/pi/pico/picotool/cmakeFindLIBUSB.cmake as in the hints from this thread, but it seems it is not the solution.

https://stackoverflow.com/a/48614573

At first I thought it was the same error as raspberrypi/pico-examples#357, but to me this does not seem like a TinyUSB error.

My GCC version:

pi@pi4:~/pico/picotool/build$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/11/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04.1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1) 
@holmbuar holmbuar changed the title libUSB is not found. picotool cannot be built because libUSB is not found. Jul 16, 2023
@holmbuar
Copy link
Author

holmbuar commented Jul 16, 2023

The solution was to sudo apt install pkg-config, as it says in

https://github.com/raspberrypi/picotool#linux--macos

The FindLIBUSB.cmake file should be left as is.

The information about installing the pkg-config is found in the README of picotools repo, but not in appendix B of the getting started guide, where I started looking after the setup script failed in the first place.

I suggest adding pkg-config to the OPENOCD_DEPS in the pico_setup.sh file.

@lurch
Copy link
Contributor

lurch commented Jul 17, 2023

pico_setup.sh is explicitly written to run on Raspberry Pi OS, and isn't tested on any 3rd-party distributions.

@aallan aallan transferred this issue from raspberrypi/pico-examples Jul 17, 2023
@aallan aallan added the question Further information is requested label Jul 17, 2023
@aallan
Copy link
Contributor

aallan commented Jul 17, 2023

As @lurch mentioned the pico_setup.sh is intended to be run on Raspberry Pi OS, and hasn't been designed or tested on other distributions. See Chapters 1 and 2 of the Getting Started with Raspberry Pi Pico book.

@aallan aallan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2023
@holmbuar
Copy link
Author

@aallan I understand that better than yesterday at least. Still, for total noobs like me, reading

If you are developing for Raspberry Pi Pico on the Raspberry Pi 4B, or the Raspberry Pi 400, most of the installation
steps in this Getting Started guide can be skipped by running the setup script.

as the first paragraph in Chapter 1, I saw no reason to not try the setup script. I am running a Pi 4B, targeting the Pico.

Why use Ubuntu on the Pi though? Robotics: ROS 2 on the Pi 4, and Micro-ROS on the Pico.

Changing my suggestion to add a warning in the Getting Started book, meant for those running a Pi 4B with a different OS than Pi OS.

@M-Andoh
Copy link

M-Andoh commented Apr 21, 2024

sudo apt install pkg-config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants