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 をインストールしてみてください。これを行う 1 つの方法は、次のようなことですsudo apt install clang-8

関連情報