From df160fafca901d3101d802446b5047db499bc50d Mon Sep 17 00:00:00 2001 From: waffle2k Date: Wed, 6 May 2026 23:50:54 -0700 Subject: [PATCH] meson: fix build for FreeBSD/clang compatibility Remove GCC-specific static link args (-static, -static-libgcc, -static-libstdc++) that fail under clang. Add threads_dep via dependency('threads') to all targets so Boost ASIO's pthread usage links correctly on FreeBSD where clang does not pull it in implicitly. Linux/GCC builds are unaffected. --- meson.build | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index a796b15..ab94a94 100644 --- a/meson.build +++ b/meson.build @@ -6,30 +6,32 @@ project('finger', 'cpp', # Find Boost dependencies - prefer static libraries boost_dep = dependency('boost', modules : ['system'], static : true) +# pthreads — required by Boost ASIO; clang on FreeBSD does not link it implicitly +threads_dep = dependency('threads') + # Find Google Test and Google Mock dependencies gtest_dep = dependency('gtest', main : true, required : true) gmock_dep = dependency('gmock', main : true, required : true) executable('finger', 'main.cpp','handler.cpp', - dependencies : [boost_dep], - link_args : ['-static', '-static-libgcc', '-static-libstdc++'], + dependencies : [boost_dep, threads_dep], install : true) # Test executable test_exe = executable('test_handler', 'test_handler.cpp', 'handler.cpp', - dependencies : [boost_dep, gtest_dep, gmock_dep]) + dependencies : [boost_dep, threads_dep, gtest_dep, gmock_dep]) # Mock test executable test_mock_exe = executable('test_handler_mock', 'test_handler_mock.cpp', 'handler.cpp', - dependencies : [boost_dep, gtest_dep, gmock_dep]) + dependencies : [boost_dep, threads_dep, gtest_dep, gmock_dep]) # Real filesystem test executable test_real_fs_exe = executable('test_handler_real_filesystem', 'test_handler_real_filesystem.cpp', 'handler.cpp', - dependencies : [boost_dep, gtest_dep, gmock_dep]) + dependencies : [boost_dep, threads_dep, gtest_dep, gmock_dep]) # Register the tests test('handler_tests', test_exe)