I am trying to cross-compile an application (tvheadend) for ARM (raspberry pi 2), using a x64 machine and this toolchain.
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
.
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
.
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. 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.
尝试在configure
调用中按如下所示修改cflags
:
--cflags="-DOPENSSL_USE_DEPRECATED -nostdinc -nostdinc++"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.