Closed qchong closed 7 years ago
thank you for the findings: will have a look at it ( something to do with shaderc lib in windows NDK )
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.
Excuse me, but I am seeing this issue as well - is there a workaround? What was the fix for this issue?
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
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
@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
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
@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.
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
closing down this one: doc will be published pretty soon. thanks again for your help along the way (explanation and creating bugs etc).
@ggfan my pleasure.
@tigrannajaryan @ggfan Thank you two very much for the help, now I can see the sample run on device
NDK version = 13.1.3345770
Seeing this Gradle Console output when trying to build the 'drawcube' project on Android Studio. Same for other samples.