CMake 找不到 Perl

CMake could not find Perl

我正在尝试使用我自己的使用 Yocto 的臂板配方构建 mbedcrypto Linux。我可以下载并解压源代码,但是在编译库的过程中,出现错误

| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE)
| -- Could NOT find Perl (missing:  PERL_EXECUTABLE)

相关CMakeLists.txt部分如下


set(CTR_DRBG_128_BIT_KEY_WARNING "${WARNING_BORDER}"
                         "${CTR_DRBG_128_BIT_KEY_WARN_L1}"
                         "${CTR_DRBG_128_BIT_KEY_WARN_L2}"
                         "${CTR_DRBG_128_BIT_KEY_WARN_L3}"
                         "${WARNING_BORDER}")


find_package(PythonInterp)
find_package(Perl)
if(PERL_FOUND)

    # If 128-bit keys are configured for CTR_DRBG, display an appropriate warning
    execute_process(COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/config.pl -f ${CMAKE_CURRENT_SOURCE_DIR}/include/mbedtls/config.h get MBEDTLS_CTR_DRBG_USE_128_BIT_KEY

错误信息

 Found Threads: TRUE
| -- Could NOT find Perl (missing:  PERL_EXECUTABLE)
| CMake Error at tests/CMakeLists.txt:15 (message):
|   Cannot build test suites without Perl

来自文件 tests/CMakeLists.txt,其中包含

if(ENABLE_ZLIB_SUPPORT)
    set(libs ${libs} ${ZLIB_LIBRARIES})
endif(ENABLE_ZLIB_SUPPORT)

find_package(Perl)
if(NOT PERL_FOUND)
    message(FATAL_ERROR "Cannot build test suites without Perl")
endif()

我在主机的 /usr/bin/perl 上安装了 perl 和 运行。我不知道这是一些 cmake 配置还是 yocto 问题。

mbedcrypto 配方

DESCRIPTION = "Simple helloworld application"
SECTION = "examples"
DEPENDS = ""
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=302d50a6369f5f22efdb674db908167a"
SRC_URI[md5sum] = "06dd48905c236f7939d03b09bcf7f1a2"


SRC_URI = "https://github.com/ARMmbed/mbed-crypto/archive/mbedcrypto-${PV}.tar.gz"

S = "${WORKDIR}/mbed-crypto-mbedcrypto-${PV}"

inherit cmake pkgconfig

您的配方缺少 Perl 和 Python 的 build-time 依赖项。这些依赖项由 DEPENDS variable.

指定

如果您需要 Perl 的本机变体来构建测试,请指定(编辑:根据评论,它没有帮助):

DEPENDS = "perl-native"

你也可以使用perlnative class (see doc for the difference):

inherit perlnative

顺便说一句,还有 运行时 依赖项(参见 RDEPENDS variable).