Skip to content

Commit 43dc9ba

Browse files
authored
[monodroid] Attempt to fix a macOS lib{c,m} link error (#7891)
Context: 0e4c29a 0e4c29a introduced builds of two library stubs, for libc and libm libraries, to be used when no NDK is installed. It appears that it can sometimes cause these link errors: ld : error : undefined symbol: vtable for __cxxabiv1::__function_type_info [/Users/builder/azdo/_work/3/s/xamarin-android/src/monodroid/monodroid.csproj] >>> referenced by stub.cc >>> CMakeFiles/c.dir/libstub/stub.cc.o:(typeinfo for void ()) >>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction) >clang++ : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/builder/azdo/_work/3/s/xamarin-android/src/monodroid/monodroid.csproj] The missing symbol suggests that the problem lies in the lack of RTTI infrastructure in the library stub. Attempt to mitigate the issue by disabling both exceptions and RTTI when building the stubs.
1 parent 0e4c29a commit 43dc9ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/monodroid/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,12 @@ if(ANDROID AND ENABLE_NET)
735735

736736
target_compile_options(
737737
c
738-
PRIVATE -nostdlib
738+
PRIVATE -nostdlib -fno-exceptions -fno-rtti
739739
)
740740

741741
target_link_options(
742742
c
743-
PRIVATE -nostdlib
743+
PRIVATE -nostdlib -fno-exceptions -fno-rtti
744744
)
745745

746746
set_target_properties(
@@ -761,12 +761,12 @@ if(ANDROID AND ENABLE_NET)
761761

762762
target_compile_options(
763763
m
764-
PRIVATE -nostdlib
764+
PRIVATE -nostdlib -fno-exceptions -fno-rtti
765765
)
766766

767767
target_link_options(
768768
m
769-
PRIVATE -nostdlib
769+
PRIVATE -nostdlib -fno-exceptions -fno-rtti
770770
)
771771

772772
set_target_properties(

0 commit comments

Comments
 (0)