使用dlib和opencv的应用程序的yocto配方

时间:2018-07-06 07:59:34

标签: opencv yocto dlib recipe

我为dlib做了一个yocto食谱,还在local.conf中添加了opencv软件包。 现在,我想为使用dlib和opencv库的应用程序制作配方。我尝试了以下食谱,但是当我尝试使用bitbake application进行构建时,会引发一些错误。 dlib recipe

SUMMARY = "A toolkit for making real world machine learning and data analysis applications"
HOMEPAGE = "https://github.com/davisking/dlib"

LICENSE = "Boost-Software"
LIC_FILES_CHKSUM = "file://dlib/LICENSE.txt;md5=2c7a3fa82e66676005cd4ee2608fd7d2 \
                    file://dlib/external/pybind11/LICENSE;md5=beb87117af69fd10fbf9fb14c22a2e62 \
                    file://dlib/external/libpng/LICENSE;md5=243135ddedf702158f9170807cbcfb66 \
                    file://docs/docs/license.xml;md5=2e6ff4080dcb217d4d300b90e9aabb5b \
                    file://examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt;md5=57eee82829ed297e23d84de5f905afee \
                    file://examples/video_frames/license.txt;md5=127ee508b60a6be9dea8af3b441993dc \
                    file://python_examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt;md5=064f53ab40ea2b6a4bba1324149e4fde"

SRC_URI = "git://github.com/davisking/dlib.git;protocol=https"

PV = "1.0+git${SRCPV}"
SRCREV = "3b794540baeabbcd033b544230401967106d5483"

S = "${WORKDIR}/git"

do_compile() {
        cd ${S}
        cd dlib
        mkdir build
        cd build
        cmake ..
        sudo make install
}

FILES_${PN} += "/${base_prefix}"
inherit cmake

application recipe

DESCRIPTION = "Simple application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://application.cpp;md5=df22013877ba7d830e9993ae1d77d724"

SRC_URI = "file://application.cpp"

S = "${WORKDIR}"

do_compile() {
        ${CXX}  -std=c++11 -O3 -L${libdir}/libdlib.a -I${includedir}/dlib/ -lpthread -lX11  application.cpp ${LDFLAGS} `pkg-config --cflags --libs opencv` -o application
}

do_install() {
        install -d ${D}${bindir}
        install -m 0755 application ${D}${bindir}
}

当我尝试errors时一些bitbake application

| application.cpp:(.text._ZN4dlib30entropy_decoder_model_kernel_5ILm257ENS_24entropy_decoder_kernel_2ELm200000ELm4EE6decodeERm[_ZN4dlib30entropy_decoder_model_kernel_5ILm257ENS_24entropy_decoder_kernel_2ELm200000ELm4EE6decodeERm]+0x1a8): undefined reference to `dlib::entropy_decoder_kernel_2::get_target(unsigned int)'
| application.cpp:(.text._ZN4dlib11pinv_helperINS_9matrix_opINS_8op_transINS_6matrixIdLl3ELl0ENS_33memory_manager_stateless_kernel_1IcEENS_16row_major_layoutEEEEEEEEEKNS3_INT_4typeEXsrSA_2NCEXsrSA_2NRENSA_16mem_manager_typeES6_EERKNS_10matrix_expISA_EEd[_ZN4dlib11pinv_helperINS_9matrix_opINS_8op_transINS_6matrixIdLl3ELl0ENS_33memory_manager_stateless_kernel_1IcEENS_16row_major_layoutEEEEEEEEEKNS3_INT_4typeEXsrSA_2NCEXsrSA_2NRENSA_16mem_manager_typeES6_EERKNS_10matrix_expISA_EEd]+0x4fc): undefined reference to `cblas_dgemm'
| application.cpp:(.text._ZN4dlib28get_serialized_frontal_facesB5cxx11Ev[_ZN4dlib28get_serialized_frontal_facesB5cxx11Ev]+0x8e9c): undefined reference to `dlib::base64::~base64()'

我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:0)

将dlib配方更改为

SUMMARY = "A toolkit for making real world machine learning and data analysis applications"
HOMEPAGE = "https://github.com/davisking/dlib"

LICENSE = "Boost-Software"
LIC_FILES_CHKSUM = "file://dlib/LICENSE.txt;md5=2c7a3fa82e66676005cd4ee2608fd7d2 \
                    file://dlib/external/pybind11/LICENSE;md5=beb87117af69fd10fbf9fb14c22a2e62 \
                    file://dlib/external/libpng/LICENSE;md5=243135ddedf702158f9170807cbcfb66 \
                    file://docs/docs/license.xml;md5=2e6ff4080dcb217d4d300b90e9aabb5b \
                    file://examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt;md5=57eee82829ed297e23d84de5f905afee \
                    file://examples/video_frames/license.txt;md5=127ee508b60a6be9dea8af3b441993dc \
                    file://python_examples/LICENSE_FOR_EXAMPLE_PROGRAMS.txt;md5=064f53ab40ea2b6a4bba1324149e4fde"

SRC_URI = "git://github.com/davisking/dlib.git;protocol=https"

PV = "1.0+git${SRCPV}"
SRCREV = "3b794540baeabbcd033b544230401967106d5483"

S = "${WORKDIR}/git"

inherit cmake

EXTRA_OECMAKE += "-DDLIB_NO_GUI_SUPPORT=ON -DBUILD_SHARED_LIBS=ON"

然后在您的应用配方中

DESCRIPTION = "Simple application"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://application.cpp;md5=df22013877ba7d830e9993ae1d77d724"

inherit pkgconfig 
DEPENDS += "dlib opencv"

SRC_URI = "file://application.cpp"

S = "${WORKDIR}"

do_compile() {
        ${CXX} ${CXXFLAGS} -std=c++11 -O3 -I${STAGING_INCDIR}/dlib -pthread application.cpp -o application ${LDFLAGS} `pkg-config --cflags --libs opencv` -lX11 -ldlib
}

do_install() {
        install -D -m 0755 application ${D}${bindir}/application
}