[英]meson cant find a cross-compile library
I'm building my project using meson
.我正在使用
meson
构建我的项目。
When building native - all is OK.构建原生时 - 一切正常。
meson
is able to find all dependencies, and create the executable. meson
能够找到所有依赖项,并创建可执行文件。
When using a aarch
cross file - the dependency just doesn't work...使用
aarch
交叉文件时 - 依赖项不起作用......
This is my meson.build
:这是我的
meson.build
:
# builds the project and copies all relevant data files
project(
'demo',
'cpp',
default_options : [
'cpp_std=c++20',
],
version: run_command('cat', '.version', check: true).stdout().strip(),
)
################
# dependencies #
################
dependencies = [
dependency('CLI11'),
dependency('nlohmann_json'),
dependency('spdlog'),
meson.get_compiler('cpp').find_library('MY_LIB')
]
##############
# executable #
##############
executable(
'demo',
files('src'),
dependencies : dependencies,
install : true,
)
and this is my cross file (aarch64.ini):这是我的交叉文件(aarch64.ini):
; arm 64 bit little endian
[binaries]
cpp = 'aarch64-none-linux-gnu-g++'
strip = 'aarch64-none-linux-gnu-strip'
pkg-config = 'aarch64-none-linux-gnu-pkg-config'
and I compile using meson setup --cross-file aarch64.ini aarch64
我使用
meson setup --cross-file aarch64.ini aarch64
I've installed the relevant cross compiler (g++-11), and all its relevant binaries + edited my PATH so it would include them.我已经安装了相关的交叉编译器(g++-11),并且所有相关的二进制文件+编辑了我的 PATH 以便它包含它们。
This is my error:这是我的错误:
meson.build:14:0: ERROR: C++ shared or static library 'MY_LIB' not found
A full log can be found at ... meson-logs/meson-log.txt
I've tried putting the relevant lib file in我试过把相关的lib文件放进去
I also tried copying it / linking it without the version (ie tried both MY_LIB.so.4.8.1 and MY_LIB.so)我还尝试在没有版本的情况下复制/链接它(即尝试了 MY_LIB.so.4.8.1 和 MY_LIB.so)
Nothing works...没有任何作用...
The lib I try to link against is in the correct format:我尝试链接的库格式正确:
$ file MY_LIB.so.4.8.1
MY_LIB.so.4.8.1: ELF 64-bit LSB shared object, ARM aarch64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=457ef064499398e8ffe4657e60fe44f30cb7db51, not stripped
What am I supposed to look for so I can solve this?我应该寻找什么才能解决这个问题?
My thoughts:我的想法:
file
but maybe I'm wrong?file
验证它,但也许我错了?none
in the compiler name is an issue (shouldn't it be just aarch-linux-gnu?)none
是一个问题(不应该只是 aarch-linux-gnu 吗?)is there the symlink MY_LIB.so to MY_LIB.so.4.8.1? MY_LIB.so 到 MY_LIB.so.4.8.1 有符号链接吗? you can try also in this way to include the dependency:
您也可以尝试以这种方式包含依赖项:
myLibDep = declare_dependency(
link_args : ['<my lib path>/MY_LIB.so'])
.... ……
dependencies = [
dependency('CLI11'),
dependency('nlohmann_json'),
dependency('spdlog'),
myLibDep,
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.