其他分享
首页 > 其他分享> > unsupported option ‘--noexecstack‘

unsupported option ‘--noexecstack‘

作者:互联网

问题描述以及验证过程

更新了clang之后编译android aarch64出现如下错误,提示不支持noexecstack选项

../../third_party/llvm-build/macos/Release+Asserts/bin/clang -MMD -MF obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o.d -DHAVE_AV_CONFIG_H -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DFF_API_CONVERGENCE_DURATION=0 -D_ISOC99_SOURCE -D_LARGEFILE_SOURCE -DV8_DEPRECATION_WARNINGS -DUSE_OPENSSL_CERTS=1 -DNO_TCMALLOC -DDISABLE_NACL -DSAFE_BROWSING_DB_REMOTE -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"310694-2\" -D_FILE_OFFSET_BITS=64 -DANDROID -DHAVE_SYS_UIO_H -DANDROID_NDK_VERSION_ROLL=r15b_1 -D__GNU_SOURCE=1 -D__compiler_offsetof=__builtin_offsetof -Dnan=__builtin_nan -Dsnprintf=snprintf -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DOPUS_FIXED_POINT -I../../third_party/ffmpeg/chromium/common -I../../third_party/ffmpeg/chromium/config/android/arm64 -I../../third_party/ffmpeg -I../.. -Igen -I../../third_party/zlib -I../../third_party/opus/src/include -I../../third_party/amr -I../../third_party/x265/source -I../../third_party/rtmpdump -DHAVE_VFP_ARGS=1 -fno-integrated-as -B../../third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -fcolor-diagnostics -std=gnu11 -ffunction-sections -fno-short-enums --target=aarch64-linux-android -g1 -fdebug-info-for-profiling --sysroot=../../third_party/android_tools/ndk/platforms/android-21/arch-arm64 -c ../../third_party/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S -o obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o
clang: error: unsupported option '--noexecstack'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)

于是使用-v查看详细的编译过程

../../third_party/llvm-build/macos/Release+Asserts/bin/clang -v -MMD -MF obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o.d -DHAVE_AV_CONFIG_H -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DFF_API_CONVERGENCE_DURATION=0 -D_ISOC99_SOURCE -D_LARGEFILE_SOURCE -DV8_DEPRECATION_WARNINGS -DUSE_OPENSSL_CERTS=1 -DNO_TCMALLOC -DDISABLE_NACL -DSAFE_BROWSING_DB_REMOTE -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"310694-2\" -D_FILE_OFFSET_BITS=64 -DANDROID -DHAVE_SYS_UIO_H -DANDROID_NDK_VERSION_ROLL=r15b_1 -D__GNU_SOURCE=1 -D__compiler_offsetof=__builtin_offsetof -Dnan=__builtin_nan -Dsnprintf=snprintf -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DOPUS_FIXED_POINT -I../../third_party/ffmpeg/chromium/common -I../../third_party/ffmpeg/chromium/config/android/arm64 -I../../third_party/ffmpeg -I../.. -Igen -I../../third_party/zlib -I../../third_party/opus/src/include -I../../third_party/amr -I../../third_party/x265/source -I../../third_party/rtmpdump -DHAVE_VFP_ARGS=1 -fno-integrated-as -B../../third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -fcolor-diagnostics -std=gnu11 -ffunction-sections -fno-short-enums --target=aarch64-linux-android -g1 -fdebug-info-for-profiling --sysroot=../../third_party/android_tools/ndk/platforms/android-21/arch-arm64 -c ../../third_party/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S -o obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o
clang version 13.0.0 (https://github.com/llvm/llvm-project/ 4017d0335a35334835bfae6fc3e258adcd9ed2dc)
Target: aarch64-unknown-linux-android
Thread model: posix
InstalledDir: /Users/stone/mediacore/out/arm64/../../third_party/llvm-build/macos/Release+Asserts/bin
 "/Users/stone/mediacore/third_party/llvm-build/macos/Release+Asserts/bin/clang" -cc1 -triple aarch64-unknown-linux-android -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name mpegaudiodsp_neon.S -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=non-leaf -relaxed-aliasing -fno-rounding-math -no-integrated-as -mconstructor-aliases -munwind-tables -target-cpu generic -target-feature +neon -target-abi aapcs -mllvm -aarch64-fix-cortex-a53-835769=1 -fallow-half-arguments-and-returns -fdebug-info-for-profiling -debug-info-kind=line-tables-only -dwarf-version=4 -debugger-tuning=gdb -target-linker-version 609.8 -v -ffunction-sections -fcoverage-compilation-dir=/Users/stone/mediacore/out/arm64 -resource-dir /Users/stone/mediacore/third_party/llvm-build/macos/Release+Asserts/lib/clang/13.0.0 -dependency-file obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o.d -MT obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o -D HAVE_AV_CONFIG_H -D _POSIX_C_SOURCE=200112 -D _XOPEN_SOURCE=600 -D PIC -D FF_API_CONVERGENCE_DURATION=0 -D _ISOC99_SOURCE -D _LARGEFILE_SOURCE -D V8_DEPRECATION_WARNINGS -D USE_OPENSSL_CERTS=1 -D NO_TCMALLOC -D DISABLE_NACL -D SAFE_BROWSING_DB_REMOTE -D CHROMIUM_BUILD -D FIELDTRIAL_TESTING_ENABLED -D "CR_CLANG_REVISION=\"310694-2\"" -D _FILE_OFFSET_BITS=64 -D ANDROID -D HAVE_SYS_UIO_H -D ANDROID_NDK_VERSION_ROLL=r15b_1 -D __GNU_SOURCE=1 -D __compiler_offsetof=__builtin_offsetof -D nan=__builtin_nan -D snprintf=snprintf -D NDEBUG -D NVALGRIND -D DYNAMIC_ANNOTATIONS_ENABLED=0 -D OPUS_FIXED_POINT -I ../../third_party/ffmpeg/chromium/common -I ../../third_party/ffmpeg/chromium/config/android/arm64 -I ../../third_party/ffmpeg -I ../.. -I gen -I ../../third_party/zlib -I ../../third_party/opus/src/include -I ../../third_party/amr -I ../../third_party/x265/source -I ../../third_party/rtmpdump -D HAVE_VFP_ARGS=1 -D __DATE__= -D __TIME__= -D __TIMESTAMP__= -isysroot ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64 -internal-isystem /Users/stone/mediacore/third_party/llvm-build/macos/Release+Asserts/lib/clang/13.0.0/include -internal-isystem ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/local/include -internal-externc-isystem ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/include -internal-externc-isystem ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/include -Wno-builtin-macro-redefined -std=gnu11 -fno-dwarf-directory-asm -fdebug-compilation-dir=/Users/stone/mediacore/out/arm64 -ferror-limit 19 -stack-protector 1 -stack-protector-buffer-size 4 -fno-signed-char -fgnuc-version=4.2.1 -fcolor-diagnostics -target-feature +outline-atomics -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /var/folders/g2/zxk9wk612330r2lmlqrly4yr0000gn/T/mpegaudiodsp_neon-81efbf.s -x assembler-with-cpp ../../third_party/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S
clang -cc1 version 13.0.0 based upon LLVM 13.0.0git default target x86_64-apple-darwin21.1.0
ignoring nonexistent directory "../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/local/include"
ignoring nonexistent directory "../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/include"
#include "..." search starts here:
#include <...> search starts here:
 ../../third_party/ffmpeg/chromium/common
 ../../third_party/ffmpeg/chromium/config/android/arm64
 ../../third_party/ffmpeg
 ../..
 gen
 ../../third_party/zlib
 ../../third_party/opus/src/include
 ../../third_party/amr
 ../../third_party/x265/source
 ../../third_party/rtmpdump
 /Users/stone/mediacore/third_party/llvm-build/macos/Release+Asserts/lib/clang/13.0.0/include
 ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/include
End of search list.
 "/usr/bin/as" --noexecstack -EL -I ../../third_party/ffmpeg/chromium/common -I ../../third_party/ffmpeg/chromium/config/android/arm64 -I ../../third_party/ffmpeg -I ../.. -I gen -I ../../third_party/zlib -I ../../third_party/opus/src/include -I ../../third_party/amr -I ../../third_party/x265/source -I ../../third_party/rtmpdump -o obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o /var/folders/g2/zxk9wk612330r2lmlqrly4yr0000gn/T/mpegaudiodsp_neon-81efbf.s
clang: error: unsupported option '--noexecstack'
clang: error: assembler command failed with exit code 1 (use -v to see invocation)

发现是在调用/usr/bin/as的时候自动添加上去的(使用的clang版本是Apple clang version 13.0.0 (clang-1300.0.29.30)),as是汇编程序,用于编译汇编的。这个选项看起来是系统默认添加的,clang版本为12的时候还没有添加(因为没有更新之前没有出现这个问题)
改用NDK的clang来编译试试

../../third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang -v -MMD -MF obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o.d -DHAVE_AV_CONFIG_H -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DFF_API_CONVERGENCE_DURATION=0 -D_ISOC99_SOURCE -D_LARGEFILE_SOURCE -DV8_DEPRECATION_WARNINGS -DUSE_OPENSSL_CERTS=1 -DNO_TCMALLOC -DDISABLE_NACL -DSAFE_BROWSING_DB_REMOTE -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"310694-2\" -D_FILE_OFFSET_BITS=64 -DANDROID -DHAVE_SYS_UIO_H -DANDROID_NDK_VERSION_ROLL=r15b_1 -D__GNU_SOURCE=1 -D__compiler_offsetof=__builtin_offsetof -Dnan=__builtin_nan -Dsnprintf=snprintf -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DOPUS_FIXED_POINT -I../../third_party/ffmpeg/chromium/common -I../../third_party/ffmpeg/chromium/config/android/arm64 -I../../third_party/ffmpeg -I../.. -Igen -I../../third_party/zlib -I../../third_party/opus/src/include -I../../third_party/amr -I../../third_party/x265/source -I../../third_party/rtmpdump -DHAVE_VFP_ARGS=1 -fno-integrated-as -B../../third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -fcolor-diagnostics -std=gnu11 -ffunction-sections -fno-short-enums --target=aarch64-linux-android -g1 --sysroot=../../third_party/android_tools/ndk/platforms/android-21/arch-arm64 -c ../../third_party/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S -o obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o
Android clang version 3.8.256229  (based on LLVM 3.8.256229)
Target: aarch64--linux-android
Thread model: posix
InstalledDir: /Users/stone/mediacore/out/arm64/../../third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin
 "/Users/stone/mediacore/third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang" -cc1 -triple aarch64--linux-android -E -disable-free -disable-llvm-verifier -main-file-name mpegaudiodsp_neon.S -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -no-integrated-as -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu generic -target-feature +neon -target-abi aapcs -backend-option -aarch64-fix-cortex-a53-835769=1 -target-linker-version 2.24 -v -dwarf-column-info -debug-info-kind=line-tables-only -dwarf-version=4 -debugger-tuning=gdb -ffunction-sections -coverage-file /Users/stone/mediacore/out/arm64/obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o -resource-dir /Users/stone/mediacore/third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib64/clang/3.8.256229 -dependency-file obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o.d -MT obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o -D HAVE_AV_CONFIG_H -D _POSIX_C_SOURCE=200112 -D _XOPEN_SOURCE=600 -D PIC -D FF_API_CONVERGENCE_DURATION=0 -D _ISOC99_SOURCE -D _LARGEFILE_SOURCE -D V8_DEPRECATION_WARNINGS -D USE_OPENSSL_CERTS=1 -D NO_TCMALLOC -D DISABLE_NACL -D SAFE_BROWSING_DB_REMOTE -D CHROMIUM_BUILD -D FIELDTRIAL_TESTING_ENABLED -D "CR_CLANG_REVISION=\"310694-2\"" -D _FILE_OFFSET_BITS=64 -D ANDROID -D HAVE_SYS_UIO_H -D ANDROID_NDK_VERSION_ROLL=r15b_1 -D __GNU_SOURCE=1 -D __compiler_offsetof=__builtin_offsetof -D nan=__builtin_nan -D snprintf=snprintf -D NDEBUG -D NVALGRIND -D DYNAMIC_ANNOTATIONS_ENABLED=0 -D OPUS_FIXED_POINT -I ../../third_party/ffmpeg/chromium/common -I ../../third_party/ffmpeg/chromium/config/android/arm64 -I ../../third_party/ffmpeg -I ../.. -I gen -I ../../third_party/zlib -I ../../third_party/opus/src/include -I ../../third_party/amr -I ../../third_party/x265/source -I ../../third_party/rtmpdump -D HAVE_VFP_ARGS=1 -D __DATE__= -D __TIME__= -D __TIMESTAMP__= -isysroot ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64 -internal-isystem ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/local/include -internal-isystem /Users/stone/mediacore/third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib64/clang/3.8.256229/include -internal-externc-isystem ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/include -internal-externc-isystem ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/include -Wno-builtin-macro-redefined -std=gnu11 -fno-dwarf-directory-asm -fdebug-compilation-dir /Users/stone/mediacore/out/arm64 -ferror-limit 19 -fmessage-length 223 -femulated-tls -stack-protector 1 -stack-protector-buffer-size 4 -fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/g2/zxk9wk612330r2lmlqrly4yr0000gn/T/mpegaudiodsp_neon-575834.s -x assembler-with-cpp ../../third_party/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S
clang -cc1 version 3.8.256229 based upon LLVM 3.8.256229 default target x86_64-unknown-linux
ignoring nonexistent directory "../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/local/include"
ignoring nonexistent directory "../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/include"
#include "..." search starts here:
#include <...> search starts here:
 ../../third_party/ffmpeg/chromium/common
 ../../third_party/ffmpeg/chromium/config/android/arm64
 ../../third_party/ffmpeg
 ../..
 gen
 ../../third_party/zlib
 ../../third_party/opus/src/include
 ../../third_party/amr
 ../../third_party/x265/source
 ../../third_party/rtmpdump
 /Users/stone/mediacore/third_party/android_tools/ndk/toolchains/llvm/prebuilt/darwin-x86_64/bin/../lib64/clang/3.8.256229/include
 ../../third_party/android_tools/ndk/platforms/android-21/arch-arm64/usr/include
End of search list.
 "../../third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-as" -I ../../third_party/ffmpeg/chromium/common -I ../../third_party/ffmpeg/chromium/config/android/arm64 -I ../../third_party/ffmpeg -I ../.. -I gen -I ../../third_party/zlib -I ../../third_party/opus/src/include -I ../../third_party/amr -I ../../third_party/x265/source -I ../../third_party/rtmpdump -o obj/third_party/ffmpeg/ffmpeg_gas/mpegaudiodsp_neon.o /var/folders/g2/zxk9wk612330r2lmlqrly4yr0000gn/T/mpegaudiodsp_neon-575834.s

改用NDK的clang是能编译通过的,发现使用的汇编器也是NDK的,它不会默认使用noexecstack选项

方案

标签:__,..,third,--,unsupported,ffmpeg,party,android,option
来源: https://blog.csdn.net/momo0853/article/details/122487876