Skip to content

Commit

Permalink
[monodroid] Attempt to fix a macOS lib{c,m} link error (#7891)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
grendello authored Mar 17, 2023
1 parent 0e4c29a commit 43dc9ba
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/monodroid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -735,12 +735,12 @@ if(ANDROID AND ENABLE_NET)

target_compile_options(
c
PRIVATE -nostdlib
PRIVATE -nostdlib -fno-exceptions -fno-rtti
)

target_link_options(
c
PRIVATE -nostdlib
PRIVATE -nostdlib -fno-exceptions -fno-rtti
)

set_target_properties(
Expand All @@ -761,12 +761,12 @@ if(ANDROID AND ENABLE_NET)

target_compile_options(
m
PRIVATE -nostdlib
PRIVATE -nostdlib -fno-exceptions -fno-rtti
)

target_link_options(
m
PRIVATE -nostdlib
PRIVATE -nostdlib -fno-exceptions -fno-rtti
)

set_target_properties(
Expand Down

0 comments on commit 43dc9ba

Please sign in to comment.