2

Because I want my binaries to run on older distributions, I decided to build a statically linked binary.

My application depends on libhid-hidraw and through that, on libudev.

I have the development packages installed:

sudo apt install libudev-dev libhidapi-dev

When I try to link, I get this error:

cc -g -Wall -Wextra -static daemon/turboledzd.c -o daemon/turboledzd -lhidapi-hidraw -ludev
/usr/bin/ld: cannot find -ludev
collect2: error: ld returned 1 exit status

On my system, there is a libhidapi-hidraw.a file present:

$ dpkg -S hidraw.a
libhidapi-dev:amd64: /usr/lib/x86_64-linux-gnu/libhidapi-hidraw.a

But no such static library for udev:

$ dpkg -S libudev.
libudev1:i386: /usr/lib/i386-linux-gnu/libudev.so.1
libudev-dev:amd64: /usr/lib/x86_64-linux-gnu/pkgconfig/libudev.pc
python3-pyudev: /usr/lib/python3/dist-packages/pyudev/_ctypeslib/libudev.py
libudev1:amd64: /usr/lib/x86_64-linux-gnu/libudev.so.1.7.1
libudev-dev:amd64: /usr/lib/x86_64-linux-gnu/libudev.so
libudev1:amd64: /usr/lib/x86_64-linux-gnu/libudev.so.1
libudev-dev:amd64: /usr/include/libudev.h
libudev1:i386: /usr/lib/i386-linux-gnu/libudev.so.1.7.1
libudev-dev:amd64: /usr/share/man/man3/libudev.3.gz

Which Ubuntu package will contain the libudev.a library?

1 Answer 1

3

Well, it is not available upstream and at Debian either.

Here is a related bug report #915566 in Debian and they end up not implementing solution due to the large resulting static files and no demand from users.

It is part of systemd, you will able to compile it using these flags: -Dstatic-libsystemd=true -Dstatic-libudev=true . See referenced bug report.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .