-
Notifications
You must be signed in to change notification settings - Fork 12
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
Allow using custom mir libraries directory #198
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this! I have a few questions about the implementation, but it looks like the right idea
@@ -24,6 +29,7 @@ pkg_check_modules(MIRCOMMON mircommon REQUIRED) | |||
pkg_check_modules(MIRCOMMON_INTERNAL mircommon-internal REQUIRED) | |||
pkg_check_modules(MIRSERVER mirserver REQUIRED) | |||
pkg_check_modules(MIRSERVER_INTERNAL mirserver-internal REQUIRED) | |||
pkg_check_modules(MIRWAYLAND mirwayland REQUIRED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would Mirwayland be required here? I don't remember using it in the project anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only required at link time, otherwise building fails with
/usr/bin/ld: warning: libmirwayland.so.5, needed by <mir_install_directory>/lib/libmirplatform.so, not found (try using -rpath or -rpath-link)
and a bunch of undefined symbols.
Maybe mirplatform
should require mirwayland
in its pc file ? Currently it's just:
prefix=<mir_install_directory>
libdir=${prefix}/lib
includedir=${prefix}/include
Name: mirplatform
Description: Mir platform library
Version: 2.18.0
Requires: mircommon, mircore
Libs: -L${libdir} -lmirplatform
Cflags: -I${includedir}/mirplatform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay that's probably an issue on their end, but I am happy to patch it on our end in the meantime.
Filed the bug: canonical/mir#3536
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this :) Just letting CI do its thing then I'll merge
@TibboddiT One last thing to make this work: We're going to need to install the libmirwayland-dev and package in CI: https://github.com/mattkae/miracle-wm/blob/ea33fb1c7212a8a3b9633e0b9fd909aab186028c/.github/workflows/cmake.yml#L33 |
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
option(SNAP_BUILD "Building as a snap?" OFF) | ||
|
||
set(ENV{PKG_CONFIG_PATH} "${MIR_LIBRARIES_PKGCONFIG_DIRECTORY}:/usr/local/lib/pkgconfig/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This breaks any existing PKG_CONFIG_PATH
setup.
$ echo $PKG_CONFIG_PATH
/nix/store/b3a0wh9v9md9kc4qdixsbwjy3799077r-boost-1.81.0-dev/lib/pkgconfig:/nix/store/sa2vr5rkh19pvy9j4hkb4lk95nlhqpix-glib-2.80.4-dev/lib/pkgconfig:/nix/store/vsygj2vzwqr9x7rzq4v3prcv2blkggmx-zlib-1.3.1-dev/lib/pkgconfig:/nix/store/niabvl1jq1hl7s3n1yx5zxa27l9mipkm-libffi-3.4.6-dev/lib/pkgconfig:[...]
$ $PKG_CONFIG --cflags miral
-I/nix/store/457888a9j750b2skjvi33h4xn66y05gi-mir-2.17.0-dev/include/miral -I/nix/store/457888a9j750b2skjvi33h4xn66y05gi-mir-2.17.0-dev/include/mircommon -I/nix/store/457888a9j750b2skjvi33h4xn66y05gi-mir-2.17.0-dev/include/mircore
/build/source/CMakeLists.txt(15): set(MIR_LIBRARIES_PKGCONFIG_DIRECTORY CACHE STRING Search for Mir libraries pc files in this directory )
/build/source/CMakeLists.txt(16): option(SNAP_BUILD Building as a snap? OFF )
/build/source/CMakeLists.txt(18): set(ENV{PKG_CONFIG_PATH} :/var/empty/local/lib/pkgconfig/ )
[...]
/nix/store/sa1yjb7xxrzcbd1bysj3r561vidfxxvb-cmake-3.29.6/share/cmake-3.29/Modules/FindPkgConfig.cmake(435): set(ENV{PKG_CONFIG_PATH} /var/empty/local/lib/pkgconfig )
[...]
-- Checking for module 'miral'
-- No package 'miral' found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry. The pre-existing code already broke it, and I see this was supposed to close the issue for this: #196
Why is setting PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
and further messing around with it in CMake even necessary, is something wrong with some build environment somewhere? I feel like this setup should just be left to whatever build environment CMake is executed in, prepending a custom Mir path as desired.
Submitted #211 to instead use the existing ENV{PKG_CONFIG_PATH}
, or set /usr/local/lib/pkgconfig
as a fallback if it's empty.
Allow invoking cmake with
-DMIR_LIBRARIES_PKGCONFIG_DIRECTORY=<dir>
to search Mir pc files in a custom directory.If
-DMIR_LIBRARIES_PKGCONFIG_DIRECTORY
is not set, behavior remains unchanged.Note: to successfully build locally, linking to libmirwayland.so was neeeded, so I added it to
target_link_libraries
.Building on Debian with a local build of the Mir main branch works now without modifying miracle-wm sources.
Fix #196.