Open urdh opened 6 years ago
(This seems suspiciously similar to #3125, by the way.)
The fix for this is simpler though:
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index c7ca4e43..ae93743b 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -49,7 +49,7 @@ cpp_suffixes = lang_suffixes['cpp'] + ('h',)
c_suffixes = lang_suffixes['c'] + ('h',)
# List of languages that can be linked with C code directly by the linker
# used in build.py:process_compilers() and build.py:get_dynamic_linker()
-clike_langs = ('objcpp', 'objc', 'd', 'cpp', 'c', 'fortran',)
+clike_langs = ('objcpp', 'cpp', 'd', 'objc', 'c', 'fortran',)
clike_suffixes = ()
for _l in clike_langs:
clike_suffixes += lang_suffixes[_l]
I'm actually surprised; I thought we already changed this.
When linking a C++ application using C++11 threads to a library built from Objective-C sources, it seems like Meson incorrectly selects the Objective-C linker which leaves standard library symbols unresolved since no C++ standard library is linked. Linking a similar application with a library built from Objective-C++ sources works fine, because the Objective-C++ linker is selected (I believe this would be the correct behavior even in the first case).
Example:
The implementation of
lib.m
andlib.mm
is irrelevant, buttest.cpp
must use C++11 threads or atomics. When buildingapp_2
, everything is fine, but buildingapp_1
yields the following: