Android NDK: rebuild with c++_shared to avoid double libc++ when mixing prebuilts
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 50/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- android, cmake, cpp
- Ambito
- documentation
Direzione di ricerca
The proposed change is a new docs/android-ndk.md covering the ANDROID_STL=c++_shared rebuild recipe in the issue body. Check include/yaml-cpp/dll.h to confirm the YAML_CPP_API visibility mapping the notes cite, and look at the existing docs layout before adding the file. Done means a maintainer has agreed to the doc PR and the recipe is written up accurately, with no proprietary binaries.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
When integrating a prebuilt libyaml-cpp.so into an Android app/native module that already uses the NDK shared C++ runtime (libc++_shared.so / ANDROID_STL=c++_shared), it is easy to end up with two C++ runtimes in one process ("double libc++").
Symptoms are typically load/link failures or hard-to-debug crashes around STL types crossing .so boundaries—not YAML parsing logic itself.
Cause
STL linkage mismatch between:
- the prebuilt
yaml-cpp(often built with a different STL / static vs shared), and - the app / other native libs that expect a single shared
libc++_shared.
Workaround that worked for us
Rebuild yaml-cpp from source with the same shared STL as the host app, then replace the mismatched prebuilt.
Verified with tag yaml-cpp-0.6.3 (also tried newer trees; 0.6.3 matched our ABI needs):
cmake -S . -B build-android \
-DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-30 \
-DANDROID_STL=c++_shared \
-DYAML_BUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="-fvisibility=hidden -fvisibility-inlines-hidden"
cmake --build build-android --config Release
Notes:
- Keep one
libc++_shared.soin the final APK (prefer the NDK/app copy; do not ship a second conflicting copy). include/yaml-cpp/dll.halready mapsYAML_CPP_APIto__attribute__((visibility("default")))on non-MSVC when building the shared library. That matters if you compile with-fvisibility=hiddenso exported symbols stay visible across.soboundaries.- This report is a generic rebuild recipe only—no proprietary binaries attached.
Question for maintainers
Would you accept a short doc PR (e.g. docs/android-ndk.md) capturing the ANDROID_STL=c++_shared shared-library rebuild notes above? Happy to open one if useful.
- Lingua principale
- C++
- Stelle
- 6.1k
- Fork
- 2.2k
- Merge medio
- 22h 2m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di jbeder/yaml-cpp
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
Tutte le issue di jbeder/yaml-cpp
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
meshcore-dev/MeshCore#3760 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
deepseek-ai/DeepGEMM-Ascend#29 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
EchoTools/nevr-runtime#2042 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
emscripten-core/emscripten#28160 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Download size and speed show scientific notation between 1000 and 1023 unitsForse già presa @RaphaelFakhri l’ha presa oggi. Aperta
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 88/100
kiwix/kiwix-desktop#1570 ·
I maintainer di solito rispondono entro 1 giorno