An NDK app can chose to bundle in a (c++_shared) library in your app, or you 
can link with a static (c++_static) standard library.   This is actually 
dependant on what setting you chose for this in your gradle build file, as 
gradle will pass that along to cmake which will link it in.  

That cxx runtime test doesn't quite work correctly using an android toolchain.  
But if you want to configure your ndk app using c++_static you can remove that 
test section from CMakeLists.txt and add in manually below:

set(CXXRT_IS_STDLIB true)
target_link_libraries(objc c++_static stdc++)

I will also note, that I am still thinking about a way to run that test suite 
while cross compiling...     


> On Feb 13, 2019, at 6:41 AM, Gregory Casamento <greg.casame...@gmail.com> 
> wrote:
> 
> 
> A little more context...  my build environment is a MacPro 2010 running the 
> latest version of Mojave.  I have downloaded and installed the latest of 
> Android studio and installed the latest SDK and NDK using the menu under 
> tools and the SDK manager.  The version of the NDK I'm using is 19.0.5232133. 
>   I am utterly stumped as to why this is not working.  Also, it seems as 
> though Ivan's installation of this is working which seems to indicate that 
> this is a configuration issue.
> 
> Any input would be appreciated.
> 
> On Wed, Feb 13, 2019 at 7:09 AM Gregory Casamento <greg.casame...@gmail.com 
> <mailto:greg.casame...@gmail.com>> wrote:
> 
> ### Build libobjc2
> -- The ASM compiler identification is Clang
> -- Found assembler: 
> /Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
> -- Check for working C compiler: 
> /Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
> -- Check for working C compiler: 
> /Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang
>  -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Check for working CXX compiler: 
> /Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
> -- Check for working CXX compiler: 
> /Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
>  -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Testing C++ interop
> -- Testing C++ standard library
> -- No useable C++ runtime found
> -- Looking for pthread.h
> -- Looking for pthread.h - found
> -- Looking for pthread_create
> -- Looking for pthread_create - found
> -- Found Threads: TRUE  
> -- GNUstep install type set to NONE
> -- Performing Test CXA_ALLOCATE_EXCEPTION_NOEXCEPT_COMPILES
> -- Performing Test CXA_ALLOCATE_EXCEPTION_NOEXCEPT_COMPILES - Success
> -- Configuring done
> -- Generating done
> -- Build files have been written to: 
> /Users/heron/Development/Algoriddim/gnustep-toolchain/gnustep-android/gnustep/libobjc2/build
> /Users/heron/Development/Algoriddim/gnustep-toolchain/gnustep-android/gnustep/libobjc2/build/CMake
> [1/1] Linking CXX executable test_cxx_runtime
> FAILED: test_cxx_runtime 
> : && 
> /Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++
>  --target=armv7-none-linux-androideabi16 
> --gcc-toolchain=/Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64
>   --sysroot 
> /Users/heron/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/sysroot
>  -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables 
> -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig 
> -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++  
> -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ 
> -Wl,--build-id -Wl,--warn-shared-textrel  -Wl,--exclude-libs,libunwind.a 
> -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -Wl,-z,relro 
> -Wl,-z,now -Wl,--gc-sections 
> CMakeFiles/test_cxx_runtime.dir/typeinfo_test.cc.o  -o test_cxx_runtime  
> -latomic -lm && :
> CMakeFiles/test_cxx_runtime.dir/typeinfo_test.cc.o:typeinfo_test.cc:vtable 
> for type_info2: error: undefined reference to 
> 'std::type_info::__do_upcast(__cxxabiv1::__class_type_info const*, void**) 
> const'
> clang++: error: linker command failed with exit code 1 (use -v to see 
> invocation)
> ninja: build stopped: subcommand failed.
> ### LIBOBJC2 BUILD FAILED!!!
> 
> I am running into the above error when trying to build for Android.  I have 
> the latest ndk and sdk installed with Android studio.  Does anyone have any 
> idea offhand why C++ isn't finding it's runtime?   I will attach the build 
> script I am using to generate the ninja script....
> 
> GC
> 
> -- 
> Gregory Casamento
> GNUstep Lead Developer / OLC, Principal Consultant
> http://www.gnustep.org 
> <https://mailtrack.io/trace/link/ddde09d325c4a435e025a98cecb523c42a3faad5?url=http%3A%2F%2Fwww.gnustep.org&userId=2790543&signature=7d37ec23bb82ff44>
>  - http://heronsperch.blogspot.com 
> <https://mailtrack.io/trace/link/df5b3556d0922a9f737f08b0905d6385e611c5f0?url=http%3A%2F%2Fheronsperch.blogspot.com&userId=2790543&signature=6bb167a403644460>
> http://ind.ie/phoenix/ 
> <https://mailtrack.io/trace/link/92bcebdbb9fc372e2cf08a7e499372cc1cd5d151?url=http%3A%2F%2Find.ie%2Fphoenix%2F&userId=2790543&signature=8fd8e7cffa9021e7>
> 
> -- 
> Gregory Casamento
> GNUstep Lead Developer / OLC, Principal Consultant
> http://www.gnustep.org 
> <https://mailtrack.io/trace/link/1247d0089e9dd2e1ac83c838552d393752c8b833?url=http%3A%2F%2Fwww.gnustep.org&userId=2790543&signature=5a652f77cc91a2ea>
>  - http://heronsperch.blogspot.com 
> <https://mailtrack.io/trace/link/ff75bfb4c582f91790e81a5fdd96eeb51aab0274?url=http%3A%2F%2Fheronsperch.blogspot.com&userId=2790543&signature=59cf8dcbd3b3253d>
> http://ind.ie/phoenix/ 
> <https://mailtrack.io/trace/link/5bd6878a79f878c78ef8f1630a2dfde8e09e51af?url=http%3A%2F%2Find.ie%2Fphoenix%2F&userId=2790543&signature=043c717e06ac9c32>_______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org <mailto:Discuss-gnustep@gnu.org>
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep 
> <https://lists.gnu.org/mailman/listinfo/discuss-gnustep>
_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to