-
Notifications
You must be signed in to change notification settings - Fork 470
[android] Put in fixes for librt and armv7-a #554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,14 @@ function(add_unit_test name) | |
target_compile_options(${name} PRIVATE -fblocks) | ||
target_compile_options(${name} PRIVATE -Wall -Wno-deprecated-declarations) | ||
endif() | ||
# Without this flag, cross-compiling static test executables for Android armv7 | ||
# fails with the multiple definition errors seen in android/ndk#176, so I | ||
# pulled in this workaround noted there. The tests build and run with this | ||
# flag applied. | ||
if(NOT BUILD_SHARED_LIBS AND CMAKE_SYSTEM_NAME STREQUAL Android AND | ||
CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a) | ||
target_link_options(${name} PRIVATE "LINKER:--allow-multiple-definition") | ||
endif() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this needs a huge comment. This is indicative of an issue - the multiple definitions shouldnt be there. The warnings indicate that there is a mix up between libgcc and libunwind, which is a really bad thing as it will crash at runtime in a difficult to diagnose manner (the internal layouts of the unwind context is not compatible/guaranteed). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I don't know exactly what's going on here, their doc doesn't clear it up for me. All I know is that applying this workaround flag gets the test executables to build, and I tried moving a handful to Android and they ran fine. I will add a comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the comment. |
||
target_link_libraries(${name} | ||
PRIVATE | ||
dispatch | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine to do, but really unfortunate. CMake already already can deal with librt properly on various targets, but we don't use CMake properly :-(.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you could use
CMAKE_FIND_ROOT_PATH
, like I do when cross-compiling the corelibs, if there is anlibrt.so
to find, but there is none on Android- it's just part oflibc.so
- so this is the right change for Android.