[英]Wrong header subdir when cross-compiling for ARM
I am trying to cross-compile an application (tvheadend) for ARM (raspberry pi 2), using a x64 machine and this toolchain. 我正在尝试使用x64机器和此工具链交叉编译ARM(raspberry pi 2)的应用程序(tvheadend)。
I am using the following command line to configure the compilation: ./configure --arch=arm-linux-gnueabihf --cc=arm-linux-gnueabihf-gcc --disable-avahi --release --cflags=-DOPENSSL_USE_DEPRECATED
and then I just make
. 我正在使用以下命令行来配置编译:
./configure --arch=arm-linux-gnueabihf --cc=arm-linux-gnueabihf-gcc --disable-avahi --release --cflags=-DOPENSSL_USE_DEPRECATED
和那我就make
。
The problem happens during the compilation of the source file src/utils.c
: such file includes string.h
, which is correctly selected from the toolchain include directory (let's say ARMTOOLCHAIN/usr/include
), but then string2.h
, which is inside ARMTOOLCHAIN/usr/include/arm-linux-gnueabihf/bits
, is selected from the system directory, instead of ARMTOOLCHAIN/usr/include/arm-linux-gnueabihf/bits
. 问题在源文件
src/utils.c
的编译期间发生:此类文件包含string.h
,可以从工具链的include目录中正确选择(例如ARMTOOLCHAIN/usr/include
),然后是string2.h
,即内部ARMTOOLCHAIN/usr/include/arm-linux-gnueabihf/bits
,从系统目录中选择,代替ARMTOOLCHAIN/usr/include/arm-linux-gnueabihf/bits
。
In file included from /usr/include/x86_64-linux-gnu/bits/byteswap.h:35:0,
from ARMTOOLCHAIN/usr/include/endian.h:61,
from /usr/include/x86_64-linux-gnu/bits/string2.h:51,
from ARMTOOLCHAIN/usr/include/string.h:637,
from src/utils.c:21:
src/utils.c: In function ‘sbuf_put_be16’:
src/utils.c:397:9: error: invalid 'asm': invalid operand for code 'w'
u16 = htons(u16);
^
The problem is that the compiler does not search inside ARMTOOLCHAIN/usr/include/arm-linux-gnueabihf
for the bits
subdir. 问题在于,编译器无法在
ARMTOOLCHAIN/usr/include/arm-linux-gnueabihf
搜索bits
ARMTOOLCHAIN/usr/include/arm-linux-gnueabihf
。 I tried to specify -IARMTOOLCHAIN/usr/include/arm-linux-gnueabihf
as an option, and to create a symlink to bits
inside ARMTOOLCHAIN/usr/include
(so to avoid arm-linux-gnueabihf
), but none of these works. 我试图将
-IARMTOOLCHAIN/usr/include/arm-linux-gnueabihf
为选项,并创建到ARMTOOLCHAIN/usr/include
bits
的符号链接(以避免arm-linux-gnueabihf
),但是这些都arm-linux-gnueabihf
。
尝试在configure
调用中按如下所示修改cflags
:
--cflags="-DOPENSSL_USE_DEPRECATED -nostdinc -nostdinc++"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.