我正在为raspi编写一个程序(参见git magic-number
)使用arm-bcm2708
编译器。但是,当我试图让它在raspi2上运行时,我遇到了问题。我现在已经转向使用arm-linux-gnueabihf-g ++(参见git pukster/omxplayer-sync-2
)。我花了大部分时间试图让这个交叉编译器工作,最终编译ffmpeg,但现在它抱怨它找不到string
。
我将包含一个说明问题的最小工作示例(使用helloworld程序),同时使用相同的g ++调用。如果您有兴趣查看完整代码,可以在我的github帐户中找到它pukster/omxplayer-sync3
我需要有更多编译器洞察力的人来帮助我诊断这个问题。
helloworld.c
#include<stdio.h>
#include<string>
main()
{
printf("Hello World");
}
make.sh
#!/bin/bash
arm-linux-gnueabihf-g++ \
--sysroot=/mnt/CYBRAN/raspi1 \
-Wall \
-isystem/include \
-pipe \
-mfloat-abi=hard \
-mcpu=cortex-a7 \
-fomit-frame-pointer \
-mabi=aapcs-linux \
-mtune=arm1176jzf-s \
-mfpu=vfp \
-Wno-psabi \
-mno-apcs-stack-check \
-O3 \
-mstructure-size-boundary=32 \
-mno-sched-prolog \
-std=c++0x \
-D__STDC_CONSTANT_MACROS \
-D__STDC_LIMIT_MACROS \
-DTARGET_POSIX \
-DTARGET_LINUX \
-fPIC \
-DPIC \
-D_REENTRANT \
-D_LARGEFILE64_SOURCE \
-D_FILE_OFFSET_BITS=64 \
-DHAVE_CMAKE_CONFIG \
-D__VIDEOCORE4__ \
-U_FORTIFY_SOURCE \
-Wall \
-DHAVE_OMXLIB \
-DUSE_EXTERNAL_FFMPEG \
-DHAVE_LIBAVCODEC_AVCODEC_H \
-DHAVE_LIBAVUTIL_OPT_H \
-DHAVE_LIBAVUTIL_MEM_H \
-DHAVE_LIBAVUTIL_AVUTIL_H \
-DHAVE_LIBAVFORMAT_AVFORMAT_H \
-DHAVE_LIBAVFILTER_AVFILTER_H \
-DHAVE_LIBSWRESAMPLE_SWRESAMPLE_H \
-DOMX \
-DOMX_SKIP64BIT \
-ftree-vectorize \
-DUSE_EXTERNAL_OMX \
-DTARGET_RASPBERRY_PI \
-DUSE_EXTERNAL_LIBBCM_HOST \
-marm \
-isystem/mnt/CYBRAN/raspi1/usr/include \
-isystem/mnt/CYBRAN/raspi1/usr/include/arm-linux-gnueabihf \
-isystem/mnt/CYBRAN/raspi1/opt/vc/include \
-isystem/mnt/CYBRAN/raspi1/usr/include \
-isystem/mnt/CYBRAN/raspi1/opt/vc/include/interface/vcos/pthreads \
-isystem/mnt/CYBRAN/raspi1/usr/include/freetype2 \
-isystem/mnt/CYBRAN/raspi1/usr/include/libavcodec \
-isystem/mnt/CYBRAN/raspi1/opt/vc/include/interface/vmcs_host/linux
-isystem/mnt/CYBRAN/raspi1/usr/include/dbus-1.0 \
-isystem/mnt/CYBRAN/raspi1/usr/lib/arm-linux-gnueabihf/dbus-1.0/include/ \
-I./ \
-Ilinux \
-Iffmpeg_compiled/usr/local/include/ \
-Iffmpeg/libavutil/ \
-c helloworld.c \
-o helloworld \
-Wno-deprecated-declarations
输出
username@sv-01:~/Documents/test$ ./make.sh
helloworld.c:4:17: fatal error: string: No such file or directory
#include<string>
^
compilation terminated.
username:~/Documents/test$ ls /mnt/CYBRAN/raspi1/usr/include/string*
/mnt/CYBRAN/raspi1/usr/include/string.h /mnt/CYBRAN/raspi1/usr/include/strings.h
编辑:排查输出
find /mnt/CYBRAN/raspi1/usr/include/ -type l
/mnt/CYBRAN/raspi1/usr/include/python2.6/numpy
/mnt/CYBRAN/raspi1/usr/include/c++/4.6.3
/mnt/CYBRAN/raspi1/usr/include/python2.6_d/numpy
/mnt/CYBRAN/raspi1/usr/include/python3.2mu/numpy
/mnt/CYBRAN/raspi1/usr/include/png.h
/mnt/CYBRAN/raspi1/usr/include/pngconf.h
/mnt/CYBRAN/raspi1/usr/include/python3.2dmu/numpy
/mnt/CYBRAN/raspi1/usr/include/python2.7_d/numpy
/mnt/CYBRAN/raspi1/usr/include/numpy
/mnt/CYBRAN/raspi1/usr/include/libpng
/mnt/CYBRAN/raspi1/usr/include/python2.7/numpy
修改
当我在其中一个ls
目录上执行-isystem
时,我可以看到文件string
存在,但我仍然得到同样的抱怨。这是pukster/omxplayer-sync3