Cross compilation and using Aravis

Hello,
I have already used and compiled Aravis for my Linux host and I developed my project.
The project will run on a target machine running on an ARM processor. I use the cross-compilation to generate the executable I run on the target.
My question is: Should I compile the library using the same cross-compiler? what could happen if I linked the already libraries?
by the way, this is the compiler I am using to develop on my target x86_64-aarch64-linux-gnu x86_64 hosted cross compiler for AArch64 GNU/Linux target.

Could help me please compile using the meson file, I am not a meson user.

Thank you in advance for your help

Hello
I tried to change the compiler configuration for gcc and g++ to my cross-compiler using the following lines:

sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc 10
sudo update-alternatives --install /usr/bin/gcc gcc /opt/aarch64_linux_gnu/gcc_arm_8_aarch64_linux_gnu/bin/aarch64-linux-gnu-gcc  20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++ 10
sudo update-alternatives --install /usr/bin/g++ g++ /opt/aarch64_linux_gnu/gcc_arm_8_aarch64_linux_gnu/bin/aarch64-linux-gnu-g++  20


sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc

sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++


sudo update-alternatives --config gcc
sudo update-alternatives --config g++

I check that the compiler used Is the higher priority,

gcc --version
gcc (GNU Toolchain for the A-profile Architecture 8.2-2018.11 (arm-rel-8.26)) 8.2.1 20180802
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

after the meson build I have this error:

www@www-virtual-machine:~/Downloads/aravis-main$ meson build
The Meson build system
Version: 0.63.3
Source dir: /home/www/Downloads/aravis-main
Build dir: /home/www/Downloads/aravis-main/build
Build type: native build
Project name: aravis
Project version: 0.8.23

meson.build:1:0: ERROR: Could not invoke sanity test executable: [Errno 8] Exec format error: '/home/www/Downloads/aravis-main/build/meson-private/sanitycheckc.exe'.

A full log can be found at /home/www/Downloads/aravis-main/build/meson-logs/meson-log.txt
tar

Do you have any idea please how to fix this issue?
Thank you in advance

Hi,

Please have a look at meson documentation, there is a chapter about the cross compilation: https://mesonbuild.com/Cross-compilation.html

Hello Emmanuel,
I am not very familiar with meson, but I’d like it if we could compile the library using a makefile.
Is there any example to compile the lib using a makefile, please?
Thank you

Hi,

Build tools like meson exist for a reason, it is not possible to maintain a Makefile for aravis for all the supported platform and compilation configurations.

Emmanuel.

Hello Emmanuel,
I have some news about the cross-compilation for arm arch64,
Could you take look at this: Cross compiling Aravis for an ARM aarch64 through a Ubuntu virtual machine · Discussion #11331 · mesonbuild/meson · GitHub
When we call the ninja to compile after meson …
We have this error related to the xml unicode include file that could not be found by ninja,

ruben@ruben:~/aravis-0.8.22/cross_build$ sudo ninja
[46/183] Compiling C object src/libaravis-0.8.so.0.8.22.p/arvdomparser.c.o
FAILED: src/libaravis-0.8.so.0.8.22.p/arvdomparser.c.o 
/home/ruben/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc -Isrc/libaravis-0.8.so.0.8.22.p -Isrc -I../src -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/libxml2 -I/usr/include/libusb-1.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -g -Wduplicated-branches -Wimplicit-fallthrough -Wmisleading-indentation -Wstrict-prototypes -Wunused -Wunused-variable -Wdeclaration-after-statement -Wformat=2 -Wimplicit-function-declaration -Winit-self -Wmissing-include-dirs -Wmissing-prototypes -Wpointer-arith -Wformat-nonliteral -Wmaybe-uninitialized -fvisibility=hidden -fPIC -pthread -DARAVIS_COMPILATION -MD -MQ src/libaravis-0.8.so.0.8.22.p/arvdomparser.c.o -MF src/libaravis-0.8.so.0.8.22.p/arvdomparser.c.o.d -o src/libaravis-0.8.so.0.8.22.p/arvdomparser.c.o -c ../src/arvdomparser.c
In file included from /usr/include/libxml2/libxml/parser.h:812,
                 from ../src/arvdomparser.c:30:
/usr/include/libxml2/libxml/encoding.h:31:10: fatal error: unicode/ucnv.h: No such file or directory
 #include <unicode/ucnv.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
[55/183] Compiling C object src/libaravis-0.8.so.0.8.22.p/arvcamera.c.o
ninja: build stopped: subcommand failed.

Do you have any idea how to tell meson how to find this header file,
I tried to delete the libxml2 from the dependencies but still has issue with another libxml/parser.h

libxml2 error : fatal error: libxml/xmlversion.h: No such file or