I'm building my project using meson.
When building native - all is OK. meson is able to find all dependencies, and create the executable.
When using a aarch cross file - the dependency just doesn't work...
This is my 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):
; 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
I've installed the relevant cross compiler (g++-11), and all its relevant binaries + edited my PATH so it would include them.
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
- cwd
- /usr/lib/
- /usr/lib/arm/64/ (and edited the find_library function to include that dir)
I also tried copying it / linking it without the version (i.e. tried both MY_LIB.so.4.8.1 and 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:
- maybe my definition (my cross file) doesn't match the lib I'm linking against? I've tried to verify it using
filebut maybe I'm wrong? - maybe the
nonein the compiler name is an issue (shouldn't it be just aarch-linux-gnu?) - maybe my pkg-config is bad somehow? (I don't have a aarch64...pkg-config. Is there one?)