Skip to content

build on Alpine Linux, require libusb 1.0.9 (2008)#24

Open
andres-erbsen wants to merge 1 commit intof32c:masterfrom
andres-erbsen:build-on-alpine
Open

build on Alpine Linux, require libusb 1.0.9 (2008)#24
andres-erbsen wants to merge 1 commit intof32c:masterfrom
andres-erbsen:build-on-alpine

Conversation

@andres-erbsen
Copy link
Copy Markdown

@andres-erbsen andres-erbsen commented Mar 28, 2026

I tried to build ujprog on Alpine Linux and ran into errors:

Details
~/tools/ujprog $ make -B -f Makefile.linux 
cc -Wall -D__linux__ -std=gnu99 -static ujprog.c /usr/lib/x86_64-linux-gnu/libftdi.a /usr/lib/x86_64-linux-gnu/libusb.a -o ujprog
ujprog.c:78:10: fatal error: ftdi.h: No such file or directory
   78 | #include <ftdi.h>
      |          ^~~~~~~~
compilation terminated.
make: *** [Makefile.linux:15: ujprog] Error 1
~/tools/ujprog $ env CFLAGS="-I /usr/include/libftdi1/ -I /usr/include/libusb-1.0/" FTLIB=/usr/lib/libftdi1.a 
USBLIB=/usr/lib/libusb-1.0.a make -B -f Makefile.linux 
cc -I /usr/include/libftdi1/ -I /usr/include/libusb-1.0/ -Wall -D__linux__ -std=gnu99 -static ujprog.c /usr/lib/x86_64-linux-gnu/libftdi.a /usr/lib/x86_64-linux-gnu/libusb.a -o ujprog
ujprog.c: In function 'shutdown_usb':
ujprog.c:1048:9: error: implicit declaration of function 'usb_reset'; did you mean 'ftdi_usb_reset'? [-Wimplicit-function-declaration]
 1048 |         usb_reset((void *) fc.usb_dev);
      |         ^~~~~~~~~
      |         ftdi_usb_reset
ujprog.c: In function 'txfile':
ujprog.c:3338:17: warning: 'ftdi_usb_purge_buffers' is deprecated [-Wdeprecated-declarations]
 3338 |                 ftdi_usb_purge_buffers(&fc);
      |                 ^~~~~~~~~~~~~~~~~~~~~~
In file included from ujprog.c:78:
/usr/include/libftdi1/ftdi.h:566:20: note: declared here
  566 |     int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
      |                    ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libftdi1/ftdi.h:247:55: note: in definition of macro 'DEPRECATED'
  247 | #define DEPRECATED(func) __attribute__ ((deprecated)) func
      |                                                       ^~~~
ujprog.c: In function 'term_emul':
ujprog.c:3936:25: warning: 'ftdi_usb_purge_buffers' is deprecated [-Wdeprecated-declarations]
 3936 |                         ftdi_usb_purge_buffers(&fc);
      |                         ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libftdi1/ftdi.h:566:20: note: declared here
  566 |     int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
      |                    ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libftdi1/ftdi.h:247:55: note: in definition of macro 'DEPRECATED'
  247 | #define DEPRECATED(func) __attribute__ ((deprecated)) func
      |                                                       ^~~~
make: *** [Makefile.linux:15: ujprog] Error 1

This PR is the patch that got me to a successful build with the following command:

env CFLAGS="-I /usr/include/libftdi1/ -I /usr/include/libusb-1.0/" FTLIB=/usr/lib/libftdi1.a USBLIB=/usr/lib/libusb-1.0.a make -B -f Makefile.linux

I believe the libusb change bumps the minimum version requirement for libusb to what looks like 1.0.9 from 2008. Alternatively, fujprog seems to have similar changes that also work for me.

Thanks!

@andres-erbsen andres-erbsen changed the title build on Alpine Linux, require libusb 1.0 (2008) build on Alpine Linux, require libusb 1.0.9 (2008) Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant