Skip to content
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

libudev: add "Libs.private: -lrt -pthread" to libudev.pc #20188

Merged
merged 1 commit into from Jul 11, 2021

Conversation

floppym
Copy link
Contributor

@floppym floppym commented Jul 9, 2021

This resolves a failure when linking cryptsetup.static against libudev.a.

libtool: link: x86_64-pc-linux-gnu-gcc -Wall -O2 -pipe -march=amdfam10 -static -O2 -o cryptsetup.static lib/utils_crypt.o lib/utils_loop.o lib/utils_io.o lib/utils_blkid.o src/utils_tools.o src/utils_password.o src/utils_luks2.o src/utils_blockdev.o src/cryptsetup.o -pthread -pthread  -Wl,--as-needed ./.libs/libcryptsetup.a -largon2 -lrt -ljson-c -lpopt -luuid -lblkid -lssl -lcrypto -lz -ldl -ldevmapper -lm -lpthread -ludev -pthread
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libudev.a(src_libsystemd_sd-daemon_sd-daemon.c.o): in function `sd_is_mq':
(.text.sd_is_mq+0x3a): undefined reference to `mq_getattr'

@github-actions github-actions bot added the udev label Jul 9, 2021
src/libudev/libudev.pc.in Outdated Show resolved Hide resolved
This resolves a failure when linking cryptsetup.static against libudev.a.

```
libtool: link: x86_64-pc-linux-gnu-gcc -Wall -O2 -pipe -march=amdfam10 -static -O2 -o cryptsetup.static lib/utils_crypt.o lib/utils_loop.o lib/utils_io.o lib/utils_blkid.o src/utils_tools.o src/utils_password.o src/utils_luks2.o src/utils_blockdev.o src/cryptsetup.o -pthread -pthread  -Wl,--as-needed ./.libs/libcryptsetup.a -largon2 -lrt -ljson-c -lpopt -luuid -lblkid -lssl -lcrypto -lz -ldl -ldevmapper -lm -lpthread -ludev -pthread
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../lib64/libudev.a(src_libsystemd_sd-daemon_sd-daemon.c.o): in function `sd_is_mq':
(.text.sd_is_mq+0x3a): undefined reference to `mq_getattr'
```
@floppym floppym changed the title libudev: add "Libs.private: -lrt" to libudev.pc libudev: add "Libs.private: -lrt -pthread" to libudev.pc Jul 9, 2021
@bluca bluca added build-system good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed labels Jul 9, 2021
Copy link
Member

@bluca bluca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bluca
Copy link
Member

bluca commented Jul 10, 2021

Thinking about this some more - it's not libudev calling that symbol from lrt, it's libsystemd which gets linked statically in libudev. Which raises the general point - we should have an automated system to percolate these dependencies through from meson to pkgconfig. @keszybz any opinion?

@floppym
Copy link
Contributor Author

floppym commented Jul 10, 2021

we should have an automated system to percolate these dependencies through from meson

I actually looked into that a bit, and I wasn't able to find any way to enumerate dependencies in meson to be able to pass them into the custom pc files that are merged using jinja.

meson's pkgconfig generator module would handle this automatically, but the structure of meson.build would need to be updated. To get correct output for both shared and static linking in the same pc file, libsystemd and libudev would need to be declared as using the plain library() function, instead of having the shared and static libs split into separate targets.

@bluca
Copy link
Member

bluca commented Jul 11, 2021

Ok, let's fix the immediate isssue for now

@bluca bluca merged commit f2c57d4 into systemd:main Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-system ci-failure-appears-unrelated good-to-merge/waiting-for-ci 👍 PR is good to merge, but CI hasn't passed at time of review. Please merge if you see CI has passed udev
Development

Successfully merging this pull request may close these issues.

None yet

2 participants