mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-20 14:08:36 +02:00
meson: fix cross-compilation issues
Strip newline from GI_TYPELIB_PATH and LD_LIBRARY_PATH
run_command().stdout() returns the raw shell output including a trailing
newline. When the value is used to build a colon-separated path, the newline
gets embedded at the end of the last path component, making the directory
invalid and causing GObject Introspection to fail with:
ImportError: Typelib file for namespace 'Gio', version '2.0' not found
Use .strip() to remove leading/trailing whitespace from both env variable
reads.
Fix jansson SONAME detection for cross-compilation
When cross-compiling, jansson's pkg-config 'libdir' variable returns a
path relative to the sysroot (e.g., /usr/lib) without the actual sysroot
prefix. The host readelf binary cannot find the library at that path.
Fix this by using meson.get_external_property('sys_root', '') to obtain
the sysroot path set by the cross-compilation environment and prepend it
to the library path before calling readelf.
Signed-off-by: Andrej Kozemcak <andrej.kozemcak@siemens.com>
This commit is contained in:
parent
bb50e8f0f4
commit
e5d2c7cc6d
2 changed files with 4 additions and 3 deletions
|
|
@ -296,7 +296,8 @@ config_h.set10('WITH_JANSSON', jansson_dep.found())
|
|||
jansson_msg = 'no'
|
||||
if jansson_dep.found()
|
||||
jansson_libdir = jansson_dep.get_variable(pkgconfig: 'libdir')
|
||||
res = run_command(find_program('eu-readelf', 'readelf'), '-d', join_paths(jansson_libdir, 'libjansson.so'), check: false)
|
||||
jansson_sysroot = meson.is_cross_build() ? meson.get_external_property('sys_root', '') : ''
|
||||
res = run_command(find_program('eu-readelf', 'readelf'), '-d', jansson_sysroot + join_paths(jansson_libdir, 'libjansson.so'), check: false)
|
||||
jansson_soname = ''
|
||||
foreach line: res.stdout().split('\n')
|
||||
if line.strip().contains('SONAME')
|
||||
|
|
|
|||
|
|
@ -167,13 +167,13 @@ if enable_introspection
|
|||
install: true,
|
||||
)
|
||||
|
||||
gi_typelib_path = run_command('printenv', 'GI_TYPELIB_PATH', check: false).stdout()
|
||||
gi_typelib_path = run_command('printenv', 'GI_TYPELIB_PATH', check: false).stdout().strip()
|
||||
if gi_typelib_path != ''
|
||||
gi_typelib_path = ':' + gi_typelib_path
|
||||
endif
|
||||
gi_typelib_path = meson.current_build_dir() + gi_typelib_path
|
||||
|
||||
ld_library_path = run_command('printenv', 'LD_LIBRARY_PATH', check: false).stdout()
|
||||
ld_library_path = run_command('printenv', 'LD_LIBRARY_PATH', check: false).stdout().strip()
|
||||
if ld_library_path != ''
|
||||
ld_library_path = ':' + ld_library_path
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue