googlesamples / vulkan-basic-samples

Other
498 stars 111 forks source link

Build errors when building samples on Windows from Android Studio #10

Closed qchong closed 7 years ago

qchong commented 7 years ago

NDK version = 13.1.3345770

Seeing this Gradle Console output when trying to build the 'drawcube' project on Android Studio. Same for other samples.

Executing tasks: [:LunarGSamples/API-Samples/android/:drawcube:assembleDebug]

Configuration on demand is an incubating feature.
:LunarGSamples/API-Samples/android/:drawcube:build_shaderc
make: Nothing to be done for `libshaderc_combined'.
:LunarGSamples/API-Samples/android/:drawcube:preBuild UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:preDebugBuild UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:checkDebugManifest
:LunarGSamples/API-Samples/android/:drawcube:prepareDebugDependencies
:LunarGSamples/API-Samples/android/:drawcube:compileDebugAidl UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:compileDebugRenderscript UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:generateDebugBuildConfig UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:generateDebugResValues UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:generateDebugResources UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:mergeDebugResources UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:processDebugManifest UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:processDebugResources
:LunarGSamples/API-Samples/android/:drawcube:generateDebugSources
:LunarGSamples/API-Samples/android/:drawcube:incrementalDebugJavaCompilationSafeguard
:LunarGSamples/API-Samples/android/:drawcube:compileDebugJavaWithJavac
:LunarGSamples/API-Samples/android/:drawcube:generateJsonModelDebug UP-TO-DATE
:LunarGSamples/API-Samples/android/:drawcube:externalNativeBuildDebug
  building C:\dev\github-projects\vulkan-basic-samples\LunarGSamples\API-Samples\android\drawcube\build\intermediates\cmake\debug\obj\x86\libvulkan_sample.so
:LunarGSamples/API-Samples/android/:drawcube:externalNativeBuildDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':LunarGSamples/API-Samples/android/:drawcube:externalNativeBuildDebug'.
> Build command failed.
Error while executing 'C:\Android\sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {--build C:\dev\github-projects\vulkan-basic-samples\LunarGSamples\API-Samples\android\drawcube\.externalNativeBuild\cmake\debug\x86 --target vulkan_sample}
[1/8] Building C object utils/CMakeFiles/native_app_glue.dir/C_/Android/sdk/ndk-bundle/sources/android/native_app_glue/android_native_app_glue.c.o
[2/8] Linking C static library utils\libnative_app_glue.a
[3/8] Building CXX object utils/CMakeFiles/vsamputils.dir/util_init.cpp.o
[4/8] Building CXX object utils/CMakeFiles/vsamputils.dir/util.cpp.o
[5/8] Linking CXX static library utils\libvsamputils.a
[6/8] Building CXX object CMakeFiles/vulkan_sample.dir/vulkan_wrapper/vulkan_wrapper.cpp.o
[7/8] Building CXX object CMakeFiles/vulkan_sample.dir/C_/dev/github-projects/vulkan-basic-samples/LunarGSamples/API-Samples/drawcube/drawcube.cpp.o
[8/8] Linking CXX shared library ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libvulkan_sample.so
FAILED: cmd.exe /C "cd . && C:\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe  -target i686-none-linux-android -gcc-toolchain C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 --sysroot=C:/Android/sdk/ndk-bundle/platforms/android-24/arch-x86 -fPIC -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -Wa,--noexecstack -Wformat -Werror=format-security -fno-exceptions -fno-rtti  -std=c++11  -Werror -D VK_USE_PLATFORM_ANDROID_KHR -O0 -fno-limit-debug-info -O0 -fno-limit-debug-info  -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libvulkan_sample.so -o ..\..\..\..\build\intermediates\cmake\debug\obj\x86\libvulkan_sample.so CMakeFiles/vulkan_sample.dir/C_/dev/github-projects/vulkan-basic-samples/LunarGSamples/API-Samples/drawcube/drawcube.cpp.o CMakeFiles/vulkan_sample.dir/vulkan_wrapper/vulkan_wrapper.cpp.o  -llog utils/libvsamputils.a C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a -landroid -llog utils/libnative_app_glue.a -lm "C:/Android/sdk/ndk-bundle/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/libgnustl_static.a" && cd ."
C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function (anonymous namespace)::CompileToSpecifiedOutputType(shaderc_compiler*, char const*, unsigned int, shaderc_shader_kind, char const*, char const*, shaderc_compile_options*, shaderc_util::Compiler::OutputType): error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function (anonymous namespace)::CompileToSpecifiedOutputType(shaderc_compiler*, char const*, unsigned int, shaderc_shader_kind, char const*, char const*, shaderc_compile_options*, shaderc_util::Compiler::OutputType): error: undefined reference to 'std::__ndk1::locale::locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function (anonymous namespace)::CompileToSpecifiedOutputType(shaderc_compiler*, char const*, unsigned int, shaderc_shader_kind, char const*, char const*, shaderc_compile_options*, shaderc_util::Compiler::OutputType): error: undefined reference to 'std::__ndk1::locale::~locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function (anonymous namespace)::CompileToSpecifiedOutputType(shaderc_compiler*, char const*, unsigned int, shaderc_shader_kind, char const*, char const*, shaderc_compile_options*, shaderc_util::Compiler::OutputType): error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::__hash_table<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::__unordered_map_hasher<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::hash<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::__unordered_map_equal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::equal_to<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::allocator<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > > >::rehash(unsigned int): error: undefined reference to 'std::__ndk1::__next_prime(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::__hash_table<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::__unordered_map_hasher<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::hash<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::__unordered_map_equal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::equal_to<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::allocator<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > > >::rehash(unsigned int): error: undefined reference to 'std::__ndk1::__next_prime(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::__hash_table<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::__unordered_map_hasher<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::hash<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::__unordered_map_equal<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, std::__ndk1::equal_to<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > >, true>, std::__ndk1::allocator<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > > > >::__rehash(unsigned int): error: undefined reference to 'std::logic_error::logic_error(char const*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >::~basic_stringstream(): error: undefined reference to 'std::__ndk1::locale::~locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >::~basic_stringstream(): error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char> >::~basic_istream(): error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char> >::~basic_istream(): error: undefined reference to 'std::__ndk1::ios_base::~ios_base()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >::~basic_stringstream(): error: undefined reference to 'std::__ndk1::locale::~locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(shaderc.o):function non-virtual thunk to std::__ndk1::basic_stringstream<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >::~basic_stringstream(): error: undefined reference to 'std::__ndk1::locale::~locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*, glslang::TShader::Includer&): error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*, glslang::TShader::Includer&): error: undefined reference to 'std::__ndk1::locale::locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*, glslang::TShader::Includer&): error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*, glslang::TShader::Includer&): error: undefined reference to 'std::__ndk1::ctype<char>::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function glslang::TShader::preprocess(TBuiltInResource const*, int, EProfile, bool, bool, EShMessages, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >*, glslang::TShader::Includer&): error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::vector<glslang::TXfbBuffer, std::__ndk1::allocator<glslang::TXfbBuffer> >::__append(unsigned int): error: undefined reference to 'std::logic_error::logic_error(char const*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function void std::__ndk1::vector<glslang::TSymbolTableLevel*, std::__ndk1::allocator<glslang::TSymbolTableLevel*> >::__push_back_slow_path<glslang::TSymbolTableLevel* const&>(glslang::TSymbolTableLevel* const&): error: undefined reference to 'std::logic_error::logic_error(char const*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function void std::__ndk1::vector<glslang::TSymbolTableLevel*, std::__ndk1::allocator<glslang::TSymbolTableLevel*> >::__push_back_slow_path<glslang::TSymbolTableLevel*>(glslang::TSymbolTableLevel*&&): error: undefined reference to 'std::logic_error::logic_error(char const*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function (anonymous namespace)::SourceLineSynchronizer::syncToMostRecentString(): error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function (anonymous namespace)::SourceLineSynchronizer::syncToMostRecentString(): error: undefined reference to 'std::__ndk1::ctype<char>::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function (anonymous namespace)::SourceLineSynchronizer::syncToMostRecentString(): error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function (anonymous namespace)::SourceLineSynchronizer::syncToLine(int): error: undefined reference to 'std::__ndk1::ctype<char>::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function (anonymous namespace)::SourceLineSynchronizer::syncToLine(int): error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function (anonymous namespace)::SourceLineSynchronizer::syncToLine(int): error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>::operator()(int&&, std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>, bool&&, std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>, char const*&&): error: undefined reference to 'std::__ndk1::ios_base::getloc() const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>::operator()(int&&, std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>, bool&&, std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>, char const*&&): error: undefined reference to 'std::__ndk1::ctype<char>::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>::operator()(int&&, std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>, bool&&, std::__ndk1::__function::__func<(anonymous namespace)::DoPreprocessing::operator()(glslang::TParseContextBase&, glslang::TPpContext&, glslang::TInputScanner&, bool, glslang::TSymbolTable&, glslang::TIntermediate&, EShOptimizationLevel, EShMessages)::{lambda(int, int, bool, int, char const*)#1}, std::__ndk1::allocator<{lambda(int, int, bool, int, char const*)#1}>, void (int, int, bool, int, char const*)>, char const*&&): error: undefined reference to 'std::__ndk1::locale::use_facet(std::__ndk1::locale::id&) const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::operator<<(int): error: undefined reference to 'std::__ndk1::num_put<char, std::__ndk1::ostreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::operator<<(int): error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::operator<<(int): error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::flush(): error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(ShaderLang.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::flush(): error: undefined reference to 'std::__ndk1::ios_base::clear(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(Scan.o):function glslang::TScanContext::fillInKeywordMap(): error: undefined reference to 'std::__ndk1::__next_prime(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(Scan.o):function glslang::TScanContext::fillInKeywordMap(): error: undefined reference to 'std::__ndk1::__next_prime(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(Scan.o):function glslang::TInfoSinkBase::location(glslang::TSourceLoc const&): error: undefined reference to 'std::__ndk1::to_string(long long)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(binary.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::operator<<(unsigned int): error: undefined reference to 'std::__ndk1::num_put<char, std::__ndk1::ostreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(binary.o):function libspirv::DiagnosticStream::DiagnosticStream(spv_position_t, std::__ndk1::function<void (spvtools::MessageLevel, char const*, spv_position_t const&, char const*)> const&, spv_result_t): error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(binary.o):function libspirv::DiagnosticStream::DiagnosticStream(spv_position_t, std::__ndk1::function<void (spvtools::MessageLevel, char const*, spv_position_t const&, char const*)> const&, spv_result_t): error: undefined reference to 'std::__ndk1::locale::locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(binary.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::operator<<(unsigned short): error: undefined reference to 'std::__ndk1::num_put<char, std::__ndk1::ostreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(version_profile.o):function shaderc_util::ParseVersionProfile(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, int*, EProfile*): error: undefined reference to 'std::__ndk1::ios_base::init(void*)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(version_profile.o):function shaderc_util::ParseVersionProfile(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, int*, EProfile*): error: undefined reference to 'std::__ndk1::locale::locale()'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(version_profile.o):function std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char> >::operator>>(int&): error: undefined reference to 'std::__ndk1::num_get<char, std::__ndk1::istreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(compiler.o):function shaderc_util::Compiler::CleanupPreamble(shaderc_util::string_piece const&, shaderc_util::string_piece const&, shaderc_util::string_piece const&, int, bool) const: error: undefined reference to 'std::__ndk1::to_string(int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(compiler.o):function shaderc_util::Compiler::GetShaderStageFromSourceCode(shaderc_util::string_piece, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::to_string(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(compiler.o):function shaderc_util::Compiler::GetShaderStageFromSourceCode(shaderc_util::string_piece, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&) const: error: undefined reference to 'std::__ndk1::to_string(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(Pp.o):function std::__ndk1::basic_ostream<char, std::__ndk1::char_traits<char> >::operator<<(bool): error: undefined reference to 'std::__ndk1::num_put<char, std::__ndk1::ostreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(Pp.o):function glslang::TSourceLoc::getStringNameOrNum(bool) const: error: undefined reference to 'std::__ndk1::to_string(long long)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(propagateNoContraction.o):function (anonymous namespace)::TSymbolDefinitionCollectingTraverser::visitSymbol(glslang::TIntermSymbol*): error: undefined reference to 'std::__ndk1::to_string(int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(propagateNoContraction.o):function (anonymous namespace)::TSymbolDefinitionCollectingTraverser::visitBinary(glslang::TVisit, glslang::TIntermBinary*): error: undefined reference to 'std::__ndk1::to_string(unsigned int)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(text.o):function std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char> >::operator>>(unsigned int&): error: undefined reference to 'std::__ndk1::num_get<char, std::__ndk1::istreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(disassemble.o):function spvBinaryToText: error: undefined reference to 'std::__ndk1::cout'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(disassemble.o):function (anonymous namespace)::DisassembleHeader(void*, spv_endianness_t, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int): error: undefined reference to 'std::__ndk1::cout'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(disassemble.o):function (anonymous namespace)::DisassembleHeader(void*, spv_endianness_t, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int): error: undefined reference to 'std::__ndk1::cout'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(disassemble.o):function (anonymous namespace)::DisassembleInstruction(void*, spv_parsed_instruction_t const*): error: undefined reference to 'std::__ndk1::cout'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(diagnostic.o):function spvDiagnosticPrint: error: undefined reference to 'std::__ndk1::cerr'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(GlslangToSpv.o):function std::__ndk1::basic_filebuf<char, std::__ndk1::char_traits<char> >::imbue(std::__ndk1::locale const&): error: undefined reference to 'std::__ndk1::codecvt<char, char, mbstate_t>::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(GlslangToSpv.o):function std::__ndk1::basic_filebuf<char, std::__ndk1::char_traits<char> >::basic_filebuf(): error: undefined reference to 'std::__ndk1::locale::locale(std::__ndk1::locale const&)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(GlslangToSpv.o):function std::__ndk1::basic_filebuf<char, std::__ndk1::char_traits<char> >::basic_filebuf(): error: undefined reference to 'std::__ndk1::codecvt<char, char, mbstate_t>::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(GlslangToSpv.o):function std::__ndk1::basic_filebuf<char, std::__ndk1::char_traits<char> >::basic_filebuf(): error: undefined reference to 'std::__ndk1::locale::has_facet(std::__ndk1::locale::id&) const'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(GlslangToSpv.o):function std::__ndk1::basic_filebuf<char, std::__ndk1::char_traits<char> >::basic_filebuf(): error: undefined reference to 'std::__ndk1::locale::locale(std::__ndk1::locale const&)'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(parse_number.o):function std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char> >::operator>>(long long&): error: undefined reference to 'std::__ndk1::num_get<char, std::__ndk1::istreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  C:/Android/sdk/ndk-bundle/sources/third_party/shaderc/libs/gnustl_static/x86/libshaderc.a(parse_number.o):function std::__ndk1::basic_istream<char, std::__ndk1::char_traits<char> >::operator>>(unsigned long long&): error: undefined reference to 'std::__ndk1::num_get<char, std::__ndk1::istreambuf_iterator<char, std::__ndk1::char_traits<char> > >::id'
  clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
  ninja: build stopped: subcommand failed.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
ggfan commented 7 years ago

thank you for the findings: will have a look at it ( something to do with shaderc lib in windows NDK )

ggfan commented 7 years ago

The root cause for this is: stl type mis-match between shaderc binary and samples':

documentation on d.a.c only covers one possible of usage of running samples, missed the "changing sample to match shaderc" setting portion; and the sample is a collection of samples -- all of their stl-types should be changed if to build shaderc with other stl types

Technically this issue is solved, we would chat to for doc and sample matching off-line. thank you for bring it up.

crabcat commented 7 years ago

Excuse me, but I am seeing this issue as well - is there a workaround? What was the fix for this issue?

ggfan commented 7 years ago

Sample uses gnustl_static, when building NDK Shaderc binaries on command line, different type of stl was built. So the solution is to build NDK shaderc binaries for the same stl type: gnustl_static: cd %YOUR-NDK-HOME%\source\third_party\shaderc ..\..\..\ndk-build.cmd NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_STL=gnustl_static -j8 APP_ABI=all libshaderc_combined

suarezu commented 7 years ago

Even changing to gnustl_static, errors come up:

Information:Gradle tasks [:API-Samples/android/:draw_textured_cube:generateDebugSources, :API-Samples/android/:draw_textured_cube:generateDebugAndroidTestSources, :API-Samples/android/:draw_textured_cube:mockableAndroidJar, :API-Samples/android/:draw_textured_cube:compileDebugAndroidTestSources, :API-Samples/android/:draw_textured_cube:compileDebugUnitTestSources, :API-Samples/android/:draw_textured_cube:compileDebugSources] Error:error: undefined reference to 'std::__ndk1::ios_base::getloc() const' Error:error: undefined reference to 'std::__ndk1::codecvt<char, char, mbstate_t>::id' Error:error: linker command failed with exit code 1 (use -v to see invocation) Information:BUILD FAILED in 3s Information:3 errors Information:0 warnings Information:See complete output in console

tigrannajaryan commented 7 years ago

@suarezu make sure to delete the built shaderc files and re-build it from clean state. Simply re-issuing the build command with APP_STL=gnustl_static is not going to make any difference since it doesn't rebuild.

I submitted a documentation bug here: https://issuetracker.google.com/u/1/issues/66822027

ggfan commented 7 years ago

thanks for reporting the issue! ( removed ndk-r15 comment because I downloaded wrong file )

If previous already built for one type of stl flavor, then want to re-build for another flavor, it should still build: if you have gnustl_shared, then re-build gnustl_static, it should still fire up the build for gnustl_static. @tigrannajaryan may you double check that? We could also add clean into the build target as: cd %YOUR-NDK-HOME%\source\third_party\shaderc ......\ndk-build.cmd NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_STL=gnustl_static APP_ABI=all -j8 clean libshaderc_combined

With the above command, shaderc are built on windows 10, and draw-cube could be built fine with ndk-r15c.

I am not fully confident that @suarezu's issue is the same: which NDK version you are using? or you could just retry the above command and see if your problem goes away. thanks

tigrannajaryan commented 7 years ago

@ggfan I double checked. It doesn't work without cleaning.

Re-issuing the build with a different APP_STL flag simply results in copying of *.a files from obj\local subdirectory to libs\<buildtype> subdirectory. The <buildtype> is correctly substituted by c++_shared or gnustl_static, however no attempt is made to recompile the object files in obj\local, the new build simply re-uses the object and library files produced by the previous build.

So for example issuing 2 consecutive builds with these commands:

..\..\..\ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_STL:=c++_shared APP_ABI=all libshaderc_combined
..\..\..\ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_STL:=gnustl_static APP_ABI=all libshaderc_combined

simply results in completely identical *.a files placed in libs\c++_shared and libs\gnustl_static and the first build type wins.

For this to work correctly one possible solution is to place the object and other intermediary build files in a different directory based on <buildtype>.

I am using NDK r15c, Pkg.Revision = 15.2.4203891.

P.S. I agree, a clean make target would be nice to have too.

ggfan commented 7 years ago

Thanks for confirmation! will add "clean" target into the instruction as ( + android-24 platform too):

cd %YOUR-NDK-HOME%\source\third_party\shaderc ......\ndk-build.cmd NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_STL=gnustl_static APP_ABI=all APP_PLATFORM=android-24 -j8 clean libshaderc_combined

ggfan commented 7 years ago

closing down this one: doc will be published pretty soon. thanks again for your help along the way (explanation and creating bugs etc).

tigrannajaryan commented 7 years ago

@ggfan my pleasure.

suarezu commented 7 years ago

@tigrannajaryan @ggfan Thank you two very much for the help, now I can see the sample run on device