Skip to content

Issue with libusb 1.0.22 / function 'libusb_set_debug' is deprecated #703

Closed

Description

@LeisureLadi

Compiling stlink with 'make release' and 'make debug' with libusb 1.0.22 currently throws these warning messages:

...
Scanning dependencies of target stlink
[ 3%] Building C object CMakeFiles/stlink.dir/src/chipid.c.o
[ 6%] Building C object CMakeFiles/stlink.dir/src/common.c.o
[ 10%] Building C object CMakeFiles/stlink.dir/src/usb.c.o
[ 13%] Building C object CMakeFiles/stlink.dir/src/sg.c.o
/home/pi/stlink/src/sg.c: In function ‘stlink_open’:
/home/pi/stlink/src/sg.c:957:5: warning: ‘libusb_set_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
libusb_set_debug(slsg->libusb_ctx, 3);
^~~~~~~~~~~~~~~~
In file included from /home/pi/stlink/include/stlink/sg.h:17:0,
from /home/pi/stlink/include/stlink.h:229,
from /home/pi/stlink/src/sg.c:85:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
^~~~~~~~~~~~~~~~
...
Scanning dependencies of target stlink-static
[ 43%] Building C object CMakeFiles/stlink-static.dir/src/chipid.c.o
[ 46%] Building C object CMakeFiles/stlink-static.dir/src/common.c.o
[ 50%] Building C object CMakeFiles/stlink-static.dir/src/usb.c.o
[ 53%] Building C object CMakeFiles/stlink-static.dir/src/sg.c.o
/home/pi/stlink/src/sg.c: In function ‘stlink_open’:
/home/pi/stlink/src/sg.c:957:5: warning: ‘libusb_cc1: all warnings being treated as errors
CMakeFiles/stlink.dir/build.make:134: die Regel für Ziel „CMakeFiles/stlink.dir/src/sg.c.o“ scheiterte
make[3]: *** [CMakeFiles/stlink.dir/src/sg.c.o] Fehler 1
CMakeFiles/Makefile2:141: die Regel für Ziel „CMakeFiles/stlink.dir/all“ scheiterte
make[2]: *** [CMakeFiles/stlink.dir/all] Fehler 2
Makefile:149: die Regel für Ziel „all“ scheiterte
make[1]: *** [all] Fehler 2
Makefile:27: die Regel für Ziel „release“ scheiterte
make: *** [release] Fehler 2
_debug’ is deprecated: Use libusb_set_option instead [-Wdeprecated-declarations]
libusb_set_debug(slsg->libusb_ctx, 3);
^~~~~~~~~~~~~~~~
In file included from /home/pi/stlink/include/stlink/sg.h:17:0,
from /home/pi/stlink/include/stlink.h:229,
from /home/pi/stlink/src/sg.c:85:
/usr/include/libusb-1.0/libusb.h:1300:18: note: declared here
void LIBUSB_CALL libusb_set_debug(libusb_context *ctx, int level);
^~~~~~~~~~~~~~~~

Should I revert back to earlier releases of libusb and if so which one?

Thank you,

Activity

  1. added a commit that references this issue on Apr 1, 2018
    5c730c3
  2. slyshykO commented on Apr 1, 2018

    @slyshykO
    Collaborator

    Hi @LeisureLadi .
    I've added PR with a fix. Please check it.

  3. added this to the milestone on Apr 1, 2018
  4. LeisureLadi commented on Apr 1, 2018

    @LeisureLadi
    Author

    Problem solved! Compiles now without errors. Great.

    However, 'libstlink.so.1' was missing initially. I'm not sure, if the libraries are correctly saved in '/usr/local/lib/lib'. I changed the directory name to '/usr/local/lib/stlink' and added this path to '/etc/ld.so.conf.d/libc.conf'. After running 'sudo ldconfig', all is fine now.

    Thanks a lot for the quick reply!
    Happy Easter!

  5. xor-gate commented on Apr 1, 2018

    @xor-gate
    Contributor

    Thanks guys for catching up

  6. linked a pull request that will close this issuefix libusb deprecation. fix #703 #704on Mar 18, 2020
  7. locked as resolved and limited conversation to collaborators on Apr 14, 2020
  8. added a commit that references this issue on Nov 3, 2025
    aaf8e92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions