]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
meson: Fix build with glibc 2.31
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 25 Feb 2025 14:49:50 +0000 (08:49 -0600)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Wed, 26 Feb 2025 13:59:04 +0000 (07:59 -0600)
In order to use dlopen it may be required to link with libdl depending
on the libc. Add the proper dependency to fix the build in Debian
Bullseye.

Closes: https://github.com/kmod-project/kmod/issues/298
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/299
(cherry picked from commit bddca5c9de3286be8e68913093fbb46b21f3221b)

meson.build

index 800b6e4c9577772180663f079067ab82a81a825d..f8f26aee11bd61ae4ac7637cb8ee0111c8796269 100644 (file)
@@ -394,6 +394,11 @@ libkmod_files = files(
 )
 
 libkmod_deps = []
+cdeps = []
+
+if not cc.has_function('dlopen')
+  cdeps += cc.find_library('dl', required : true)
+endif
 
 if dep_map.get('zstd').found()
   libkmod_files += files('libkmod/libkmod-file-zstd.c')
@@ -419,7 +424,7 @@ install_headers('libkmod/libkmod.h')
 libkmod = shared_library(
   'kmod',
   libkmod_files,
-  dependencies : libkmod_deps,
+  dependencies : libkmod_deps + cdeps,
   link_with : libshared,
   link_args : ['-Wl,--version-script', meson.current_source_dir() /
                                                   'libkmod/libkmod.sym'],
@@ -434,12 +439,13 @@ pkg.generate(
   description : 'Library to deal with kernel modules',
   libraries : libkmod,
   requires_private : libkmod_deps,
+  libraries_private : cdeps,
 )
 
 libkmod_internal = static_library(
   'kmod-internal',
   objects : libkmod.extract_all_objects(recursive : true),
-  dependencies : libkmod_deps,
+  dependencies : libkmod_deps + cdeps,
   install : false,
 )