clang:錯誤:未知參數:'-no-pie'

clang:錯誤:未知參數:'-no-pie'

我正在嘗試編譯,但出現此錯誤:

clang: error: unknown argument: '-no-pie'
clang: error: unknown argument: '-no-pie'
clang: error: unknown argument: '-no-pie'

   compilation of semantic_checks.c failed
   compilation of build_rtds_skeletons.c failed
   compilation of build_c_glue.c failed

gprbuild: *** compilation phase failed
Makefile:11: recipe for target 'build' failed
make: *** [build] Error 4

答案1

可能您使用的是太舊的 clang 版本。

對我來說, clang 接受該-no-pie選項,因此在執行以下操作時不會出現錯誤:

clang -no-pie test.c 

用於clang --version檢查您正在使用哪個版本。這是我得到的:

$ clang --version
clang version 8.0.0-3 (tags/RELEASE_800/final)
Target: x86_64-pc-linux-gnu
Thread model: posix

嘗試以某種方式安裝更新的 clang 版本。一種方法可能是做類似的事情sudo apt install clang-8

相關內容