Skip to main content

Troubleshooting

Fix common SPECS NDK build problems on macOS and Windows hosts, from toolchain selection to libc++ headers.

Fixes for common problems when you build with the SPECS NDK's CMake toolchain on a macOS or Windows host. In SPECS NDK v1.3.0, CMake with SpecsNDK-Toolchain-Clang.cmake is the supported way to build for SPECS; see Build your first Native Lens.

SPECS NDK build problems and fixes

SymptomHostLikely causeFix
cannot find -lgcc_s / missing libgcc / unresolved CRT symbols (Windows Clang)Windows--gcc-install-dir not set, for example, when invoking llvm-mingw clang.exe directly without the SpecsNDK toolchain fileUse SpecsNDK-Toolchain-Clang.cmake (it adds --gcc-install-dir=<sysroot>/usr/lib/aarch64-snap-linux/13.4.0 automatically), or pass that flag yourself
_LIBCPP_VERSION mismatch / unexpected libc++ headersWindowsllvm-mingw's bundled libc++ headers won by defaultUse SpecsNDK-Toolchain-Clang.cmake (it injects -nostdinc++ -cxx-isystem <target-sysroot>/usr/include/c++/v1 to pin the target libc++ 1.0 headers)
CMake picks the host's clang instead of the SDK'smacOS / Windows-DCMAKE_TOOLCHAIN_FILE not passed, or passed after first configurePass on first configure, or wipe build/ and re-configure
Re-running CMake after moving the SDK failsmacOS / WindowsPaths cached in build/Delete build/ and reconfigure
Output binary runs on host instead of failingmacOS / WindowsWrong toolchain selectedCheck file <output> (macOS) or llvm-readelf.exe -h <output> (Windows); it must report ARM aarch64 / machine AArch64