libssl.so需要被目标使用,但缺失且没有已知的规则来生成它。

huangapple go评论58阅读模式
英文:

libssl.so needed by target, missing and no known rule to make it

问题

我正在尝试为一个应用程序(application_1.0.0.bb)创建一个Yocto配方(Yocto recipe)。以下是该应用程序的一个简化的CMake文件:

cmake_minimum_required(VERSION 3.14)

project(
    server
    VERSION 0.1.0
    DESCRIPTION "Main application"
    HOMEPAGE_URL "https://gitlab.123.com/software/projects/server"
    LANGUAGES CXX
)

message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# ---- Poco::Util ----
find_package(Poco REQUIRED COMPONENTS Util)
find_package(unofficial-libmariadb CONFIG REQUIRED)
find_package(Poco REQUIRED COMPONENTS Data DataMySQL)

# ---- Declare executable ----
add_executable(server_exe 
  src/main.cpp
)
add_executable(server::exe ALIAS server_exe)
set_property(TARGET server_exe PROPERTY OUTPUT_NAME server)
target_compile_features(server_exe PRIVATE cxx_std_17)
target_link_libraries(server_exe
    PRIVATE
        Poco::Util
        Poco::DataMySQL
)

Poco和mariadb都在application.bb配方的DEPENDS中。它们的CMake过程的重要部分(从原始项目稍作修改)如下:

  • Poco::DataMySQL 使用 target_link_libraries(DataMySQL PUBLIC Poco::Data ${MYSQL_LIBRARIES}),其中 MYSQL_LIBRARIES 设置为 unofficial::libmariadb,而在其之前调用了 find_package(unofficial-libmariadb CONFIG REQUIRED)。Poco库使用了 -DBUILD_SHARED_LIBS=OFF 选项进行构建,因此它构建静态库。

  • libmariadb 使用 TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE ${SYSTEM_LIBS}),其中 SYSTEM_LIBS 包括 SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}),而 OPENSSL_SSL_LIBRARYOPENSSL_CRYPTO_LIBRARY 是由 FIND_PACKAGE(OPENSSL) 定义的变量。libmariadb以 unofficial::libmariadb 形式导出。

配置步骤成功,但在编译步骤开始时,bitbake 给出以下错误:

ERROR: application-1.0+gitAUTOINC+ebcaa0785-r0 do_compile: ExecutionError('/home/buildbot/oe-core/build/cortexa53-tdx-linux/application/1.0+gitAUTOINC+ebcaa0785-r0/temp/run.do_compile.368082', 1, None, None)
ERROR: Logfile of failure stored in: ...
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: VERBOSE=1 cmake --build /home/buildbot/oe-core/build/tmp/work/cortexa53-tdx-linux/application/1.0+gitAUTOINC+ebcaa0785-r0/build --target all --
| ninja: error: '/home/buildbot/oe-core/build/tmp/work/cortexa53-tdx-linux/mariadb/10.7.4-r0/recipe-sysroot/usr/lib/libssl.so' needed by 'application', missing and no known rule to make it
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/.../application_1.0.0.bb:do_compile) failed with exit code '1'

这个错误表明编译过程中缺少'/home/buildbot/oe-core/build/tmp/work/cortexa53-tdx-linux/mariadb/10.7.4-r0/recipe-sysroot/usr/lib/libssl.so' 文件,且没有已知的规则生成它。

英文:

I am trying to make a Yocto recipe for an application (application_1.0.0.bb). Here is a (simplified) CMake for that application:

cmake_minimum_required(VERSION 3.14)

project(
    server
    VERSION 0.1.0
    DESCRIPTION "Main application"
    HOMEPAGE_URL "https://gitlab.123.com/software/projects/server"
    LANGUAGES CXX
)

message(STATUS "CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# ---- Poco::Util ----
find_package(Poco REQUIRED COMPONENTS Util)
find_package(unofficial-libmariadb CONFIG REQUIRED)
find_package(Poco REQUIRED COMPONENTS Data DataMySQL)

# ---- Declare executable ----
add_executable(server_exe 
  src/main.cpp
)
add_executable(server::exe ALIAS server_exe)
set_property(TARGET server_exe PROPERTY OUTPUT_NAME server)
target_compile_features(server_exe PRIVATE cxx_std_17)
target_link_libraries(server_exe
    PRIVATE
        Poco::Util
        Poco::DataMySQL
)

Both poco and mariadb are in the DEPENDS of application.bb recipe. The important parts of their CMake process (a bit patched from the original projects) are:

  • Poco::DataMySQL has target_link_libraries(DataMySQL PUBLIC Poco::Data ${MYSQL_LIBRARIES}) with set(MYSQL_LIBRARIES unofficial::libmariadb) and a find_package(unofficial-libmariadb CONFIG REQUIRED) called right before. Oh, and the Poco library is built the -DBUILD_SHARED_LIBS=OFF (so it builds static libraries)
  • libmariadb has a TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE ${SYSTEM_LIBS}) with SYSTEM_LIBS withSET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) (Both OPENSSL_SSL_LIBRARY and OPENSSL_CRYPTO_LIBRARY being variables coming out FIND_PACKAGE(OPENSSL)). It is exported as unofficial::libmariadb.

Configuration step is successful but at the start of the compile step, bitbake gives me this error:

ERROR: application-1.0+gitAUTOINC+ebcaa0785-r0 do_compile: ExecutionError('/home/buildbot/oe-core/build/cortexa53-tdx-linux/application/1.0+gitAUTOINC+ebcaa0785-r0/temp/run.do_compile.368082', 1, None, None)
ERROR: Logfile of failure stored in: ...
Log data follows:
| DEBUG: Executing shell function do_compile
| NOTE: VERBOSE=1 cmake --build /home/buildbot/oe-core/build/tmp/work/cortexa53-tdx-linux/application/1.0+gitAUTOINC+ebcaa0785-r0/build --target all --
| ninja: error: '/home/buildbot/oe-core/build/tmp/work/cortexa53-tdx-linux/mariadb/10.7.4-r0/recipe-sysroot/usr/lib/libssl.so' needed by 'application', missing and no known rule to make it
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/.../application_1.0.0.bb:do_compile) failed with exit code '1'

答案1

得分: 0

错误信息表示需要 libssl.so,但它丢失了。您需要在您的 .bbappend 文件中添加构建依赖项(以及可能的运行时依赖项?)

DEPENDS += "openssl"
RDEPENDS += "openssl"
英文:

The error say libssl.so is needed but missing. You need to add in your .bbappend file a build dependency (and maybe runtime dependency?)

DEPENDS += "openssl"
RDEPENDS += "openssl"

huangapple
  • 本文由 发表于 2023年2月8日 22:45:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75387443.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定