web-dev-qa-db-ja.com

致命的なエラー:gnu / stubs-soft.h:そのようなファイルまたはディレクトリはありません

32ビットCortex A9プラットフォーム用の64ビットUbuntu 16.04でhelloworldプログラムをクロスコンパイルしているときに、以下のエラーが発生しました。

$ make
/usr/local/comp/poky/1.7/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -march=armv7-a -mthumb-interwork -mtune=cortex-a9 --sysroot=/usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi -Iinclude -Wall -O3 -c -o main.o main.c
In file included from /usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/features.h:389:0,
             from /usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/stdio.h:27,
             from main.c:5:
/usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/gnu/stubs.h:7:29: fatal error: gnu/stubs-soft.h: No such file or directory
# include <gnu/stubs-soft.h>
                         ^
compilation terminated.
makefile:45: recipe for target 'main.o' failed
make: *** [main.o] Error 1

次に、stubs.hファイルの内容を調べます。

$ cat /usr/local/comp/poky/1.7/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/gnu/stubs.h 
/* This file is automatically generated.
   This file selects the right generated file of `__stub_FUNCTION' macros
   based on the architecture being compiled for.  */


#if !defined __ARM_PCS_VFP
# include <gnu/stubs-soft.h>
#endif
#if defined __ARM_PCS_VFP
# include <gnu/stubs-hard.h>
#endif

_ARM_PCS_VFPメイクファイル内?

5
hal2000

クロスコンパイラの名前 "cortexa9hf-vfp-neon-poky-linux-gnueabi"から、VFPアーキテクチャとネオンを有効にしたCortex-A9をターゲットにしています。 -mfloat-abi=hardスイッチを追加すると、問題が解決するはずです。

GCCマニュアルから:

-mfloat-abi = name:

使用する浮動小数点ABIを指定します。許容値は、「soft」、「softfp」、および「hard」です。

「soft」を指定すると、GCCは浮動小数点演算のライブラリ呼び出しを含む出力を生成します。 「softfp」では、ハードウェアの浮動小数点命令を使用してコードを生成できますが、soft-floatの呼び出し規約を使用しています。 「ハード」は、浮動小数点命令の生成を可能にし、FPU固有の呼び出し規約を使用します。

デフォルトは、特定のターゲット構成によって異なります。 hard-floatおよびsoft-float ABIはリンク互換ではないことに注意してください。プログラム全体を同じABIでコンパイルし、互換性のあるライブラリのセットとリンクする必要があります。

12
radiohead