- Android ndk googlesource github
- Android ndk googlesource github
- Android ndk googlesource github
- Android ndk googlesource github
- ndk-build always links libstdc++ #105
- Comments
- DanAlbert commented May 24, 2016
- DanAlbert commented Aug 22, 2017
- AstralStorm commented Sep 6, 2017 •
- java4ada commented Oct 16, 2017
- DanAlbert commented Oct 16, 2017
- DanAlbert commented Dec 6, 2017
- wang-bin commented Dec 7, 2017
- DanAlbert commented Dec 7, 2017
- wang-bin commented Dec 7, 2017 •
- thughes commented Apr 3, 2018
- DanAlbert commented May 3, 2018
- cybertk commented Jun 5, 2018
- cybertk commented Jun 5, 2018
- DanAlbert commented Jun 5, 2018
- cybertk commented Jun 6, 2018 •
- DanAlbert commented Jul 9, 2018
- pengzhendong commented Jun 3, 2021
- enh-google commented Jun 3, 2021
- DanAlbert commented Jun 3, 2021
Android ndk googlesource github
Android Native Development Kit (NDK)
The NDK allows Android application developers to include native code in their Android application packages, compiled as JNI shared libraries.
See the changelist for a list of changes since the previous release.
Finally, discussions related to the Android NDK happen on the android-ndk Google Group.
Building the NDK
Note: This document is for developers of the NDK, not developers that use the NDK.
Both Linux and Windows host binaries are built on Linux machines. Windows host binaries are built via MinGW cross compiler. Systems without a working MinGW compiler can use build/tools/build-mingw64-toolchain.sh to generate their own and be added to the PATH for build scripts to discover.
Building binaries for Mac OS X requires at least 10.8.
Target headers and binaries are built on Linux.
The NDK consists of three parts: host binaries, target prebuilts, and others (build system, docs, samples, tests).
- toolchains/ contains GCC, Clang, and Renderscript toolchains.
- $TOOLCHAIN/config.mk contains ARCH and ABIS this toolchain can handle.
- $TOOLCHAIN/setup.mk contains toolchain-specific default CFLAGS/LDFLAGS when this toolchain is used.
- prebuilt/$HOST_ARCH/ contains various tools to make the build system hermetic.
- make, awk, sed, perl, python, yasm, and for Windows: cmp.exe and echo.exe
- ndk-depends and ndk-stack should probably go in prebuilt/ to avoid collisions between host variants.
Target Headers and Binaries
- platforms/android-N/arch-$ARCH_NAME/ contains headers and libraries for each API level.
- The build system sets —sysroot to one of these directories based on user-specified APP_ABI and APP_PLATFORM .
- sources/cxx-stl/$STL/$ABI/ contains the headers and libraries for the various C++ STLs.
- prebuilt/android-$ARCH/gdbserver/ contains gdbserver.
- build/ contains the ndk-build system and scripts to rebuild NDK.
- docs/
- samples/
- sources/ contains modules useful in samples and apps via $(call import-module, $MODULE)
- tests/
Check out the branch master-ndk
The only difference between the NDK branch and master is that the NDK repository already has the toolchain repository checked out and patched.
Additional Linux Dependencies (available from apt):
Источник
Android ndk googlesource github
Android Native Development Kit (NDK)
Note: This document is for developers of the NDK, not developers that use the NDK.
The NDK allows Android application developers to include native code in their Android application packages, compiled as JNI shared libraries.
This doc gives a high level overview of the NDK’s build, packaging, and test process. For other use cases, or more in depth documentation, refer to the following sources:
- User documentation is available on the Android Developer website.
- Adding a new NDK API or platform version? Check Generating Sysroots.
- Working on Clang or GCC? See Toolchains.md.
- Discussions related to the Android NDK happen on the android-ndk Google Group.
- File bugs against the NDK at https://github.com/android-ndk/ndk/issues.
Building the NDK
Both Linux and Windows host binaries are built on Linux machines. Windows host binaries are built via MinGW cross compiler. Systems without a working MinGW compiler can use build/tools/build-mingw64-toolchain.sh to generate their own and be added to the PATH for build scripts to discover.
Building binaries for Mac OS X requires at least 10.8.
Target headers and binaries are built on Linux.
The NDK consists of three parts: host binaries, target prebuilts, and others (build system, docs, samples, tests).
- toolchains/ contains GCC and Clang toolchains.
- $TOOLCHAIN/config.mk contains ARCH and ABIS this toolchain can handle.
- $TOOLCHAIN/setup.mk contains toolchain-specific default CFLAGS/LDFLAGS when this toolchain is used.
- prebuilt/$HOST_TAG contains build dependencies and additional tools.
- make, awk, python, yasm, and for Windows: cmp.exe and echo.exe
- ndk-depends , ndk-stack and ndk-gdb can also be found here.
Target Headers and Binaries
- platforms/android-$VERSION/arch-$ARCH_NAME/ contains headers and libraries for each API level.
- The build system sets —sysroot to one of these directories based on user-specified APP_ABI and APP_PLATFORM .
- sources/cxx-stl/$STL contains the headers and libraries for the various C++ STLs.
- prebuilt/android-$ARCH/gdbserver contains gdbserver.
- build/ contains the ndk-build system and scripts to rebuild NDK.
- sources/android and sources/third_party contain modules that can be used in apps (cpufeatures, native_app_glue, etc) via $(call import-module, $MODULE)
- tests/
Check out the branch master-ndk
Additional Linux Dependencies (available from apt):
- bison
- flex
- libtool
- mingw-w64
- pbzip2 (optional, improves packaging times)
- texinfo
- python3 (used for Vulkan validation layer generation)
- python-lxml (used for Vulkan validation layer generation)
Источник
Android ndk googlesource github
NDK Samples
This repository contains Android NDK samples with Android Studio C++ integration.
These samples use the new CMake Android plugin with C++ support.
Samples could also be built with other build systems:
- for ndk-build with Android Studio, refer to directory other-builds/ndkbuild
- for gradle-experimental plugin, refer to directory other-builds/experimental. Note that gradle-experimental does not work with unified headers yet: use NDK version up to r15 and Android Studio up to version 2.3. When starting new project, please use CMake or ndk-build plugin.
Additional Android Studio samples:
- For Studio related issues, refer to Android Studio known issues page
- For NDK issues, refer to ndk issues
For samples using Android.mk build system with ndk-build see the android-mk branch.
- With Android Studio: «Open An Existing Android Studio Project» or «File» > «Open», then navigate to & select project’s build.gradle file.
- On Command Line: set up ANDROID_HOME and ANDROID_NDK_HOME to your SDK and NDK path, cd to individual sample dir, and do «gradlew assembleDebug»
For any issues you found in these samples, please
- submit patches with pull requests, see CONTRIBUTING.md for more details, or
- create bugs here.
For Android NDK generic questions, please ask on Stack Overflow, Android teams are periodically monitoring questions there.
Copyright 2018 The Android Open Source Project, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the «License»); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an «AS IS» BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Источник
Android ndk googlesource github
Android Native Development Kit (NDK)
The NDK allows Android application developers to include native code in their Android application packages, compiled as JNI shared libraries.
For what we’re working on, see the milestones.
For further into the future, see the NDK Roadmap.
This section lists any in-progress features with open discussion bugs. We’re still working on these and want to hear from you, so please read the thread and join the discussion if you have anything to add!
Tutorial and API reference documentation is available on the Android Developer website:
- The NDK Guides help you get started with the NDK.
- Information about building or debugging and profiling.
- Tutorial information for High-Performance Audio, Vulkan, and Neural Networks.
- The NDK API Reference covers all Android-specific APIs.
C library («bionic») and dynamic linker documentation
The documentation for Android’s C library («bionic») may be useful:
- Android bionic status talks about what APIs are available in what releases, and behaviors that have changed between API levels.
- Android changes for NDK developers details important dynamic linker changes in various Android releases. Invaluable if you’re having trouble loading your .so files.
- 32-bit ABI bugs documents issues for 32-bit code.
The documentation for Android OS developers has:
Источник
ndk-build always links libstdc++ #105
Comments
DanAlbert commented May 24, 2016
This is actually because ndk-build always links libstdc++ since we don’t use -nodefaultlibs . We should fix this.
The text was updated successfully, but these errors were encountered:
DanAlbert commented Aug 22, 2017
Went to add -nostdlib++ to Clang and found that @nico beat me to it: https://reviews.llvm.org/D35780 (thanks!)
@srhines @pirama-arumuga-nainar: Not sure if you’ve picked a revision for the next update yet. Could you make sure that patch is included?
AstralStorm commented Sep 6, 2017 •
Also affects cmake builds in 16.0.4293906 rc1 and older.
Hacky workaround if you want to patch it in android.toolchain.cmake (replace to ANDROID_*_FLAGS in that case) follows. This workaround doesn’t seem to break anything, but might be adding a few too many libs in fact.
Workaround:
if(NOT CMAKE_CXX_FLAGS MATCHES «nostdlib» AND NOT CMAKE_CXX_FLAGS MATCHES «nodefaultlibs»)
set(CMAKE_POLICY_DEFAULT_CMP0056 NEW)
string(CONCAT CMAKE_CXX_FLAGS «-nodefaultlibs » «$
string(CONCAT CMAKE_SHARED_LINKER_FLAGS «-lc -lm -ldl » «$
string(CONCAT CMAKE_EXE_LINKER_FLAGS «-lc -lm -ldl » «$
endif()
Equivalent could be applied in ndk-build scripts.
java4ada commented Oct 16, 2017
DanAlbert commented Oct 16, 2017
Whenever we get a clang update. Probably r17.
DanAlbert commented Dec 6, 2017
wang-bin commented Dec 7, 2017
Why a new option -nostdlib++ ? libstdc++ is the default for clang, but explicitly setting -stdlib=libc++ is enough. I use the option since r13 without any problem.
DanAlbert commented Dec 7, 2017
That is not equivalent. libc++.so and libc++.a in the NDK are linker scripts that link all their dependencies. These exist to facilitate standalone toolchains. It is not possible for the link order to be exactly correct using this method, and you run the risk of hitting #379.
wang-bin commented Dec 7, 2017 •
Yes. -nostdlib++ disables both libc++ and libstdc++
libc++.so and libc++.a in the NDK are linker scripts that link all their dependencies
I knew it. In fact I wondered why not removing the full path of libc++.so in linker flags. -stdlib=libc++ will replace -lstdc++ by -lc++ , and because of libc++.so is a script, libc++_shared.so and some other libraries are linked. I got exactly the same binary without the full path libc++.so. But I can’t remove it without modifying android.toolchain.cmake.
These exist to facilitate standalone toolchains
It is not possible for the link order to be exactly correct using this method, and you run the risk of hitting #379
Not sure. No problem found yet
thughes commented Apr 3, 2018
DanAlbert commented May 3, 2018
Sorry, missed this update.
Bionic’s libstdc++ is really more akin to libc++about or libsupc++ (though not complete). It contains an implementation of new and delete, and not much else. Stlport does not include these, so it gets new/delete from bionic’s libstdc++.
Not that this is very relevant now. There’s not much reason to use stlport starting with r16 and it doesn’t exist at all in master.
cybertk commented Jun 5, 2018
The issue still exists in NDK r17 while building with ndk-build , is there any fix plan or workaround?
cybertk commented Jun 5, 2018
NDK r16b works fine with same project configuration
DanAlbert commented Jun 5, 2018
cybertk commented Jun 6, 2018 •
Here is my error with r17,
DanAlbert commented Jul 9, 2018
That doesn’t seem to have anything to do with this bug. You’ll need to file a new bug with a test case.
pengzhendong commented Jun 3, 2021
Same error, have you fixed that?
enh-google commented Jun 3, 2021
r17 is no longer supported. please try again with a current NDK, and file a new bug if you still have trouble with that.
DanAlbert commented Jun 3, 2021
Please file new bugs if you have new bugs. As I responded to the original commenter for that error, it has nothing to do with the topic of this thread. We want to help, but we can’t fix r17 and we can’t fix bugs we can’t see, so we need a bug filed with a repro case to do so.
Источник