# Cross Compiling OpenCV application for aarch64 linux. Skipping incompatible libraries

**URL:** <https://forum.opencv.org/t/cross-compiling-opencv-application-for-aarch64-linux-skipping-incompatible-libraries/14203>\
**Category:** C++\
**Tags:** arm, build\
**Created:** [August 10, 2023, 6:54am UTC](https://forum.opencv.org/t/cross-compiling-opencv-application-for-aarch64-linux-skipping-incompatible-libraries/14203 "2023-08-10T06:54:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Apfl](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Apfl](https://forum.opencv.org/u/Apfl)\
**Post date:** [August 10, 2023, 6:54am UTC](https://forum.opencv.org/t/cross-compiling-opencv-application-for-aarch64-linux-skipping-incompatible-libraries/14203/1 "2023-08-10T06:54:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)\
**Post date:** [August 10, 2023, 7:04am UTC](https://forum.opencv.org/t/cross-compiling-opencv-application-for-aarch64-linux-skipping-incompatible-libraries/14203/2 "2023-08-10T07:04:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Apfl](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Apfl](https://forum.opencv.org/u/Apfl)\
**Post date:** [August 10, 2023, 7:21am UTC](https://forum.opencv.org/t/cross-compiling-opencv-application-for-aarch64-linux-skipping-incompatible-libraries/14203/3 "2023-08-10T07:21:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Iosif\_Hamlatzis](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/iosif_hamlatzis/32/10587_2.png) [@Iosif\_Hamlatzis](https://forum.opencv.org/u/Iosif_Hamlatzis)\
**Post date:** [June 4, 2024, 11:07am UTC](https://forum.opencv.org/t/cross-compiling-opencv-application-for-aarch64-linux-skipping-incompatible-libraries/14203/5 "2024-06-04T11:07:56Z")

</div>

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.
