Home > database >  clang : error: linker command failed with exit code 1 in Cocos Creator Android Studio. Possibly _st
clang : error: linker command failed with exit code 1 in Cocos Creator Android Studio. Possibly _st

Time:09-08

I am trying to build and Android game using Cocos Creator. But to build the .apk I will need to use Android Studio.

When I try to build APK(s) in Android Studio via menu Build > Build Bundle(s) / APK(s) > Build APK(s) it throw me this error:

Build command failed.
Error while executing process D:\_dev\android\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C D:\minkymomo\2022\github_repo\main_refactor_0904\trunk\build\android-001\proj\build\cmake\debug\x86 cocos}
ninja: Entering directory `D:\minkymomo\2022\github_repo\main_refactor_0904\trunk\build\android-001\proj\build\cmake\debug\x86'
[1/1] Linking CXX shared library D:\minkymomo\2022\github_repo\main_refactor_0904\trunk\build\android-001\proj\build\MuscleMan\intermediates\cmake\debug\obj\x86\libcocos.so
FAILED: D:/minkymomo/2022/github_repo/main_refactor_0904/trunk/build/android-001/proj/build/MuscleMan/intermediates/cmake/debug/obj/x86/libcocos.so 
cmd.exe /C "cd . && D:\_dev\android\ndk\25.0.8775105\toolchains\llvm\prebuilt\windows-x86_64\bin\clang  .exe --target=i686-none-linux-android21 --sysroot=D:/_dev/android/ndk/25.0.8775105/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security  -frtti -fexceptions -fsigned-char -fno-limit-debug-info  -static-libstdc   -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libcocos.so -o D:\minkymomo\2022\github_repo\main_refactor_0904\trunk\build\android-001\proj\build\MuscleMan\intermediates\cmake\debug\obj\x86\libcocos.so @CMakeFiles/cocos.rsp  && cd ."
ld: error: undefined hidden symbol: __stack_chk_fail_local
>>> referenced by uv-common.o:(uv__unknown_err_code) in archive D:/CocosDashboard/resources/.editors/Creator/3.5.0/resources/resources/3d/engine/native/external/cmake/../android/x86/libuv.a
>>> referenced by uv-common.o:(uv_ip6_addr) in archive D:/CocosDashboard/resources/.editors/Creator/3.5.0/resources/resources/3d/engine/native/external/cmake/../android/x86/libuv.a
>>> referenced by inet.o:(inet_ntop4) in archive D:/CocosDashboard/resources/.editors/Creator/3.5.0/resources/resources/3d/engine/native/external/cmake/../android/x86/libuv.a
>>> referenced 26 more times
clang  : error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

But when I just do a run(debug), the debug.apk was successfully made.

I am using Cocos Creator 3.5.0 and Android Studio Chipmunk.

Anyone can give me insight about it?

-----EDIT----

It only happen when I opt to use APP ABI x86 and x86_64. When I remove both of them, the .APK is compiled successfully

CodePudding user response:

Build -> Refresh Linked C Projects resolved this error for me.

CodePudding user response:

I just realized that the x86 have been removed from the latest NDK and then tried to use older NDK version (21.1.6352462) and it works.

  • Related