使用Yocto构建libmariadb

bfrts1fy  于 2023-02-08  发布在  其他
关注(0)|答案(1)|浏览(233)

我正在尝试为一个使用libmariadb的C++应用程序制作一个食谱。在开发时,我使用的是vcpkg,但现在我想使用Yocto。
下面是应用程序_1.0.0.bb文件:

# Metadata
SUMMARY = "Customer API Backend"
DESCRIPTION = "Customer API in C++ using gRPC"

# License is closed, no checksum to avoid warnings
LICENSE = "CLOSED"
LIC_FILE_CHKSUM = ""

DEPENDS = "protobuf protobuf-c protobuf-native grpc grpc-native openssl mariadb poco"

SRCREV = "${AUTOREV}"
SRC_URI = "git://git@gitlab.com/software/projects/embedded/application.git;protocol=ssh;branch=master;"

S = "${WORKDIR}/git"

inherit pkgconfig cmake

下面是CMake部分,它给Yocto带来了问题:

find_package(unofficial-libmariadb CONFIG REQUIRED)
find_package(Poco REQUIRED COMPONENTS Data DataMySQL)
target_link_libraries(database_api
    PRIVATE
        unofficial::libmariadb
        Poco::DataMySQL
)

我在配置步骤(CMake)中收到此错误消息:

CMake Error at src/libraries/external_interfaces/database_api/CMakeLists.txt:20 (find_package):
  Could not find a package configuration file probided by
  "unofficial-libmariadb" with any of the following names:

    unofficial-libmariadbConfig.cmake
    unofficial-libmariadb-config.cmake

  Add the installation prefix of "unofficial-libmariadb" to CMAKE_PREFIX_PATH
  or set "unofficial-libmariadb_DIR" to a directory containing one of the
  above files. If "unofficial-libmariadb" provides a separate development
  package or SDK, be sure it has been installed.

我尝试将mariadb-native添加到bitbake配方上的DEPENDS中,但随后收到以下错误消息when configuring mariadb-native ':

CMake Error at /home/oe-core/build/tmp/work/x86_64-linux/mariadb-native/10.7.5-r0/recipe-sysroot-native/usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find GnuTLS (missing: GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
    (Required is at least version "3.3.24")
Call Stack (most recent call first):
(...)
-- Configuring incomplete, errors occurred!
ercv8c1e

ercv8c1e1#

好的,我通过使用最近版本的mariadb食谱+ vcpkg mariadb端口补丁找到了它:
1.对于mariadb本地版本:在您所在层的recipes-dbs/mysql/文件夹中添加mariadb-native_%.bbappend:

DEPENDS:append = " gnutls-native fmt-native"

另一种选择是使用最新的mariadb-native_%.bb方法,因为它已经包含在内了。如果像我一样,你有10.7.4或其他版本,bbappend是必需的。
1.对于非官方mariadb目标:使用Yocto的devtool on mariadb方法,我刚刚复制了libmariadb的vcpkg端口所具有的补丁(可以在以下位置找到:https://github.com/microsoft/vcpkg/tree/master/ports/libmariadb)。最重要的是修改libmariadb/CMakeLists.txt(但从mariadb配方来看,这是libmariadb/libmariadb/CMakeLists.txt,因为这是一个更高的存储库层)。此修补程序导出非官方的libmariadb,并且还使用非官方的::命名空间。这使我的项目兼容。

相关问题