Cross Compiling OpenCV application for aarch64 linux. Skipping incompatible libraries

Hello everybody I am new to openCv and rather new to Ubuntu. Im trying to cross compile my OpenCV Application. My host is Ubuntu 20 and the target has arch64 architecture and is running linux.
Im trying to cross compile with the provided compile from the hardware manufacturer.
gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-g++ test.cpp -o test_EVAL -I /usr/local/include/opencv4 -L/home/opencv_build/opencv/build/lib -lopencv_core -lopencv_highgui thats my compile command.
I get the “skipping incompatible libraries -lopencv_core” → “cannot find -lopencv_core”.
What i have read this happens when the architecture the compiler expects and the libraries are is not the same (64bit architecture and 32 bit library). But it seems both should be 64bit in my case.

your opencv_core lib is probably built for the hosts (x86_64 ?) architecture,
not for the target arch64 (even if both are 64bit).

you need to cross-compile the opencv libs for arch64, (and setup cmake to use those) before you can link your own program !

this might be difficult for modules relying heavy on 3rd party code (which ALSO must be cross-compiled !) like highgui, please reconsider, if you really need this

thank you for the fast answer! I will try to cross-compile those libs thank you

have you’ve solved the issue? I have something similar I think. Everything builds ok expcept when it tries to build the highgui module, for some reason it tries to use stubs_32.h

but both my machines build and target are 64bit so I don’t need 32bit files.