[libcamera-devel] [PATCH v2] test: threads: Fix link failure due to missing dependency
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Oct 5 17:40:42 CEST 2022
Commit 036d26d6677e ("test: threads: Test thread cleanup upon abnormal
termination") added calls to functions provided by the pthread library
in the threads test, but didn't add the corresponding dependency. This
caused a link breakage on some platforms:
/usr/bin/ld: test/threads.p/threads.cpp.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.4'
/usr/bin/ld: /lib/arm-linux-gnueabihf/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
The threads test binary needs to be linked with the pthread library. To
keep meson.build simple, link all internal tests to pthread
unconditionally.
Fixes: 036d26d6677e ("test: threads: Test thread cleanup upon abnormal termination")
Reported-by: Naushir Patuck <naush at raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Naushir Patuck <naush at raspberrypi.com>
Tested-by: Naushir Patuck <naush at raspberrypi.com>
---
By popular request, a simplified version. I personally think it's much
more of a quick & dirty solution than v1, which I still prefer over v2.
---
src/libcamera/base/meson.build | 2 +-
src/libcamera/meson.build | 1 +
test/meson.build | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build
index 3b9d74efe935..7a75914ab2a8 100644
--- a/src/libcamera/base/meson.build
+++ b/src/libcamera/base/meson.build
@@ -38,9 +38,9 @@ if libunwind.found()
endif
libcamera_base_deps = [
- dependency('threads'),
libatomic,
libdw,
+ libthreads,
libunwind,
]
diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
index 63b47b177fd2..7fcbb2ddc9e7 100644
--- a/src/libcamera/meson.build
+++ b/src/libcamera/meson.build
@@ -58,6 +58,7 @@ includes = [
]
libatomic = cc.find_library('atomic', required : false)
+libthreads = dependency('threads')
subdir('base')
subdir('ipa')
diff --git a/test/meson.build b/test/meson.build
index 6cc778415dc8..f39f537035be 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -75,7 +75,7 @@ endforeach
foreach t : internal_tests
exe = executable(t[0], t[1],
- dependencies : libcamera_private,
+ dependencies : [libcamera_private, libthreads],
link_with : test_libraries,
include_directories : test_includes_internal)
base-commit: 487989eec64aa9f57f39b3bdcf619a5d435efac6
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list