我想将我的应用程序添加到yocto图像中,并使用了此配方:
DESCRIPTION = "my application"
SECTION = "examples"
LICENSE = "CLOSED"
PR = "r0"
DEPENDS += "opencv"
SRC_URI = "git://address/to/myApplication.git;protocol=https;tag=v0.1"
inherit pkgconfig cmake
在运行bitbake我的应用程序后,我遇到此错误:
fatal error: string: No such file or directory #include <string>
我在互联网上进行搜索,发现需要在我的食谱中将此变量传递给CMake:
EXTRA_OECMAKE += "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON"
但没有任何改变。我再次面对错误。然后我决定将变量添加到我的CMake中:
set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
下一次尝试后,一切正常,我没有遇到任何错误。
我打开了cmake.bbclass文件,并在cmake_do_configure()函数中看到了以下几行:
cmake \
${OECMAKE_GENERATOR_ARGS} \
$oecmake_sitefile \
${OECMAKE_SOURCEPATH} \
-DCMAKE_INSTALL_PREFIX:PATH=${prefix} \
-DCMAKE_INSTALL_BINDIR:PATH=${@os.path.relpath(d.getVar('bindir'), d.getVar('prefix') + '/')} \
-DCMAKE_INSTALL_SBINDIR:PATH=${@os.path.relpath(d.getVar('sbindir'), d.getVar('prefix') + '/')} \
-DCMAKE_INSTALL_LIBEXECDIR:PATH=${@os.path.relpath(d.getVar('libexecdir'), d.getVar('prefix') + '/')} \
-DCMAKE_INSTALL_SYSCONFDIR:PATH=${sysconfdir} \
-DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=${@os.path.relpath(d.getVar('sharedstatedir'), d. getVar('prefix') + '/')} \
-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=${localstatedir} \
-DCMAKE_INSTALL_LIBDIR:PATH=${@os.path.relpath(d.getVar('libdir'), d.getVar('prefix') + '/')} \
-DCMAKE_INSTALL_INCLUDEDIR:PATH=${@os.path.relpath(d.getVar('includedir'), d.getVar('prefix') + '/')} \
-DCMAKE_INSTALL_DATAROOTDIR:PATH=${@os.path.relpath(d.getVar('datadir'), d.getVar('prefix') + '/')} \
-DCMAKE_INSTALL_SO_NO_EXE=0 \
-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
-DCMAKE_NO_SYSTEM_FROM_IMPORTED=1 \
${EXTRA_OECMAKE} \
-Wno-dev
默认情况下,CMAKE_NO_SYSTEM_FROM_IMPORTED设置为1。因此,从逻辑上讲,我不需要在食谱或cmake中设置此变量。
为什么EXTRA_OECMAKE和CMake cmake_do_configure()无法正常工作?
我检查了cmake,并且确定没有更改其中的任何CXX标志。