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
[SR-4977] Building stdlib swiftStdlibStubs-android-armv7 FAILED #47554
Comments
Comment by Amr Aboelela (JIRA) What I ran was: |
Comment by Amr Aboelela (JIRA) // Guard compilation on the typedef for __swift_pthread_key_t in LibcShims.h SWIFT_RUNTIME_STDLIB_INTERFACE SWIFT_RUNTIME_STDLIB_INTERFACE SWIFT_RUNTIME_STDLIB_INTERFACE [stdlib] Shims for UBreakIterator and thread local storage. Introduce shims for using UBreakIterators from ICU. Also introduce We will be relying on ICU and UBreakIterators for grapheme Note: Currently, pthread_key_t is hard coded for a single platform Michael Ilseman May 16, 2017 |
I don't have access to an NDK. Could you tell me what pthread_key_t is there? |
Comment by Amr Aboelela (JIRA) Hi Michael, Not sure, but I found this: https://stackoverflow.com/questions/22164564/cannot-build-local-shared-library-in-android-ndk |
Can you try changing: #if defined(__linux__)
typedef unsigned int __swift_pthread_key_t;
#else
typedef unsigned long __swift_pthread_key_t;
#endif to be #if defined(__linux__)
typedef unsigned int __swift_pthread_key_t;
#elif defined(__android__)
typedef int __swift_pthread_key_t;
#else
typedef unsigned long __swift_pthread_key_t;
#endif Does that fix it for you? If so then I can prepare a patch (or help you do so if you're interested). |
Comment by Amr Aboelela (JIRA) You are right, I checked ~/Library/Android/sdk/ndk-bundle/platforms/android-21/arch-x86/usr/include/pthread.h |
Comment by Amr Aboelela (JIRA) I'll try your suggestion and let you know. |
Comment by Amr Aboelela (JIRA) Got the same error 🙁 /home/user/swift/swift/stdlib/public/stubs/LibcShims.cpp:103:1: error: static_assert failed "This platform's pthread_key_t differs. If you hit this assert, fix __swift_pthread_key_t's typedef in LibcShims.h by adding an #if guard and definition for your platform" |
Comment by Amr Aboelela (JIRA) I tried this and it worked: #if defined(ANDROID) |
Aha, Android probably defines linux so that was hitting sooner. Could you try the following? It uses lowercase single-underscore to be consistent with other uses in the file: #if defined(__android__)
typedef int __swift_pthread_key_t;
#elif defined(__linux__)
typedef unsigned int __swift_pthread_key_t;
#else
typedef unsigned long __swift_pthread_key_t;
#endif If that works, would you be interested in contributing the fix (I can help walk you through it), or should I? |
Comment by Amr Aboelela (JIRA) The reason I put ANDROID because I found that all the other files in swift project is using ANDROID capital letters, and only LibcShims.h is using android small letters. As seen in the attached file ![](Screen Shot 2017-05-24 at 11.41.48 PM.png) |
All caps it is! |
Comment by Amr Aboelela (JIRA) do u want to change the other one to all caps too? |
Yes please! You can add me as the reviewer for that PR. |
Comment by Amr Aboelela (JIRA) Here u r 🙂 How to add u as a reviewer? |
Attachment: Download
Additional Detail from JIRA
md5: 0eb5fa53f558bd95b70998f9b1aae9d6
Issue Description:
[753/984] Building CXX object stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-android-armv7.dir/UnicodeNormalization.cpp.o
FAILED: /home/amr/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64/./bin/clang++ -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Istdlib/public/stubs -I/home/amr/swift/swift/stdlib/public/stubs -Iinclude -I/home/amr/swift/swift/include -I/home/amr/swift/llvm/include -I/home/amr/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64/include -I/home/amr/swift/build/Ninja-ReleaseAssert/llvm-linux-x86_64/tools/clang/include -I/home/amr/swift/llvm/tools/clang/include -I/home/amr/swift/cmark/src -I/home/amr/swift/build/Ninja-ReleaseAssert/cmark-linux-x86_64/src -isystem /home/amr/swift/libiconv-libicu-android/armeabi-v7a/icu/source/common -isystem /home/amr/swift/libiconv-libicu-android/armeabi-v7a/icu/source/i18n -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -std=c+11 -fcolor-diagnostics -ffunction-sections -fdata-sections -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -fno-sanitize=all -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 -O3 -UNDEBUG -fno-exceptions -fno-rtti -Wglobal-constructors -Wexit-time-destructors -fvisibility=hidden -DswiftCore_EXPORTS -DSWIFT_RUNTIME_ENABLE_COW_EXISTENTIALS=1 -target armv7-none-linux-androideabi --sysroot=/home/amr/android-ndk-r14b/platforms/android-21/arch-arm --sysroot=/home/amr/android-ndk-r14b/platforms/android-21/arch-arm -B /home/amr/android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin/ -O2 -g0 -UNDEBUG -I/home/amr/android-ndk-r14b/sources/cxx-stl/llvm-libc /include -I/home/amr/android-ndk-r14b/sources/cxx-stl/llvm-libc+abi/include -I/home/amr/android-ndk-r14b/sources/android/support/include -DSWIFT_RUNTIME_ENABLE_COW_EXISTENTIALS=1 -MMD -MT stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-android-armv7.dir/LibcShims.cpp.o -MF stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-android-armv7.dir/LibcShims.cpp.o.d -o stdlib/public/stubs/CMakeFiles/swiftStdlibStubs-android-armv7.dir/LibcShims.cpp.o -c /home/amr/swift/swift/stdlib/public/stubs/LibcShims.cpp
/home/amr/swift/swift/stdlib/public/stubs/LibcShims.cpp:103:1: error: static_assert failed "This platform's pthread_key_t differs. If you hit this assert, fix __swift_pthread_key_t's typedef in LibcShims.h by adding an #if guard and definition for your platform"
static_assert(std::is_same<__swift_pthread_key_t, pthread_key_t>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/amr/swift/swift/stdlib/public/stubs/LibcShims.cpp:113:10: error: no matching function for call to 'pthread_key_create'
return pthread_key_create(key, destructor);
^~~~~~~~~~~~~~~~~~
/home/amr/android-ndk-r14b/platforms/android-21/arch-arm/usr/include/pthread.h:195:5: note: candidate function not viable: no known conversion from '__swift_pthread_key_t * _Nonnull' (aka 'unsigned int *') to 'pthread_key_t *' (aka 'int *') for 1st argument
int pthread_key_create(pthread_key_t*, void ()(void)) __nonnull((1));
The text was updated successfully, but these errors were encountered: