Using the docker environment arm to cross-compile OpenCV error

After successfully compiling helloworld, I will program OpenCV
But something strange happened

When my cpp file is still the original helloworld
I can compile arm programs separately
Or compiling the opencv program separately can also be compiled normally
When I enable both arm cross-compilation and opencv in cmakelists.txt, the error is as follows

/usr/local/lib/libopencv_highgui.so.4.8.0: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
CMakeFiles/Test2.dir/build.make:109: recipe for target 'Test2' failed
make[2]: *** [Test2] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/Test2.dir/all' failed
make[1]: *** [CMakeFiles/Test2.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

When I compile a normal opencv program cmake enables opencv and does not enable cross-compilation, he can also compile

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
#include<iostream>
#include <string>
#include <sstream>
using namespace cv;
using namespace std;
int main()
{
// Capture the Image from the webcam
VideoCapture cap(0);

// Get the frame
Mat save_img; cap >> save_img;

if(save_img.empty())
{
  std::cerr << "Something is wrong with the webcam, could not get frame." << std::endl;
}
// Save the frame into a file
imwrite("test.jpg", save_img); // A JPG FILE IS BEING SAVED
}

My test code is as follows

using namespace std;
int main()
{
    cout << "Hello, world!" << endl;
    return 0;
}

My cmakelist is as follows

cmake_minimum_required(VERSION 3.0) 
find_package(OpenCV REQUIRED)
project(hello)
include_directories(${OpenCV_INCLUDE_DIRS}) 
add_executable(hello hello.cpp) 
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
include_directories(${OpenCV_INCLUDE_DIRS}) 
target_link_libraries(hello ${OpenCV_LIBS})

but it prompts me that there is an error

/usr/local/lib/libopencv_core.so.4.7.0: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
CMakeFiles/hello.dir/build.make:117: recipe for target 'hello' failed
make[2]: *** [hello] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/hello.dir/all' failed
make[1]: *** [CMakeFiles/hello.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

I found the problem. I didn’t cross-compile opencv for installation on x86 platform.