Skip to content

use pkg-config to properly link to xkbcommon library when build without dlopen feature#198

Merged
elinorbgr merged 2 commits intoSmithay:masterfrom
semarie:pkgconfig
Aug 23, 2021
Merged

use pkg-config to properly link to xkbcommon library when build without dlopen feature#198
elinorbgr merged 2 commits intoSmithay:masterfrom
semarie:pkgconfig

Conversation

@semarie
Copy link
Contributor

@semarie semarie commented Aug 23, 2021

some OS (like OpenBSD or NetBSD) places third-parties libraries in no default paths, and requires explicit configuration to link to them. It makes smithay-client-toolkit difficult to build on such systems, as when not using dlopen feature, the build will fail.

For example, with alacritty build:

Building [=======================> ] 188/189: alacritty(bin)

error: linking with `cc` failed: exit status: 1
  |
  = note: [annoying stuff]
  = note: ld: error: unable to find library -lxkbcommon
          cc: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error

error: could not compile `alacritty`

To learn more, run the command again with --verbose.

Currently, there is no way to specify a directory in smithay-client-toolkit to found the library and properly link to it.

This PR uses pkg-config crate to configure build script to properly locate the library based on pkg-config configuration file.

@semarie
Copy link
Contributor Author

semarie commented Aug 23, 2021

for reference, the problem was originally reported to alacritty/alacritty#5422

Copy link
Member

@elinorbgr elinorbgr left a comment

Choose a reason for hiding this comment

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

Thanks a lot, this is a clear oversight of when we added support for directly linking to xkbcommon rather than always dlopen-ing it.

I just have a small issue with the build-script logic, and could you also add an entry in the changelog, under the ## Unreleased section and as a ### Bugfixes subection (following the previous entries structure) ?

- always assumes pkg-config configuration will be present (and not just the library)
- add CHANGELOG entry
@semarie
Copy link
Contributor Author

semarie commented Aug 23, 2021

feel free to told me if you present I push amended commit instead of adding new commits on top of previous one.

Copy link
Member

@elinorbgr elinorbgr left a comment

Choose a reason for hiding this comment

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

Okay, this is good for me, thanks!

Regarding the commits, I tend to try maintaining a succinct git history, so if you can amend your PR to make it as a single commit that would be appreciated. Otherwise I'll just squash-merge it.

@elinorbgr elinorbgr merged commit 14612de into Smithay:master Aug 23, 2021
@semarie semarie deleted the pkgconfig branch August 23, 2021 09:55
afh added a commit to afh/winit that referenced this pull request Oct 16, 2021
to fix libxcbcommon linking on OpenBSD by using pkg-config when
building without dlopen feature.
For details see Smithay/client-toolkit#198
kchibisov pushed a commit to rust-windowing/winit that referenced this pull request Oct 30, 2021
Fixes libxcbcommon linking on OpenBSD by using pkg-config when
building without dlopen feature. For details see [1].

[1] - Smithay/client-toolkit#198
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.

2 participants