From 88236b1cc01ab68c8d42e00b963a08025bfd0e27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Fri, 19 Jan 2024 16:22:25 +0100 Subject: [PATCH] Build system: under Linux, do not try to statically link libgomp even with -Dprefer_static=true MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Under Debian 12, it fails with: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/libgomp.a(team.o): réadressage R_X86_64_TPOFF32 vers symbole caché « gomp_tls_data » ne peut pas être utilisé en créant un objet partagé --- meson.build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 2b3d9fb0dc..261efb0765 100644 --- a/meson.build +++ b/meson.build @@ -294,8 +294,11 @@ if get_option('prefer_static') # NB: constructing a dependency object with link_args : ['-Wl,-Bstatic', '-lgomp', '-Wl,-Bdynamic'] does not work, # because it reorders the three arguments and puts -lgomp at the end - openmp_dep_tmp = cpp_compiler.find_library('gomp', static : true) - openmp_dep = declare_dependency(dependencies : [ openmp_dep, openmp_dep_tmp ]) + if host_machine.system() != 'linux' + # Under Debian 12, trying to link (static) libgomp.a in a MEX fails. + openmp_dep_tmp = cpp_compiler.find_library('gomp', static : true) + openmp_dep = declare_dependency(dependencies : [ openmp_dep, openmp_dep_tmp ]) + endif endif # For use when creating intermediate static libraries to be incorporated in MEX files -- GitLab