Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] Cross compilation of the onnxruntime 1.5.1 for ARMv7 32bit target for gcc 4.9.2 #21439

Closed
TinyDustCCC opened this issue Jul 22, 2024 · 6 comments
Labels
build build issues; typically submitted using template

Comments

@TinyDustCCC
Copy link

TinyDustCCC commented Jul 22, 2024

Describe the issue

build error

Urgency

No response

Target platform

Linux lf 4.1.15 #1 SMP PREEMPT Mon Aug 21 12:27:42 CST 2023 armv7l GNU/Linux

Build script

Cross-compile the main process
build host:Linux ubuntu 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Step 1
download protoc

Step2
sudo ./build.sh --config Release --use_openmp --parallel --build_shared_lib --x86 --skip_tests --skip_onnx_tests --skip-keras-test --skip_submodule_sync

Step3
sudo cmake /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/
-DCMAKE_INSTALL_PREFIX=/home/vmuser/work/test/opencv-3.4.4/git/onnxinstall
-DCMAKE_BUILD_TYPE=Release
-DONNX_CUSTOM_PROTOC_EXECUTABLE=/home/vmuser/work/test/protoc/bin/protoc
-DONNX_BUILD_TESTS=OFF
-DONNX_RUN_EXTERNAL_ML_TESTS=OFF
-DONNX_GENERATE_BENCHMARK=OFF
-DONNX_ENABLE_PYTHON=OFF
-DONNX_ENABLE_MODEL_ZOO=OFF
-DONNX_USE_OPENMP=OFF
-DONNX_USE_PROTOBUF_SHARED_LIB=ON
-Donnxruntime_BUILD_SHARED_LIB=ON
-DCMAKE_C_COMPILER=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-gcc
-DCMAKE_CXX_COMPILER=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-g++
-DCMAKE_ASM_COMPILER=/opt/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-as

Step4
sudo make CXXFLAGS="-std=c++11 -Wall -Wextra"

The error occurs in the step 4

Error / output

[sudo] password for vmuser:
[ 0%] Built target flatbuffers
[ 0%] Built target gen_onnx_proto
[ 4%] Built target libprotobuf-lite
[ 6%] Built target onnx_proto
[ 6%] Building CXX object CMakeFiles/onnxruntime_common.dir/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/onnxruntime/core/common/threadpool.cc.o
In file included from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/Core:160:0,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/Tensor:14,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/include/onnxruntime/core/common/eigen_common_wrapper.h:35,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/onnxruntime/core/common/threadpool.cc:20:
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/util/IntegralConstant.h:189:36: error: template declaration of ‘const Eigen::internal::FixedInt Eigen::fix’
static const internal::FixedInt fix{};
^
In file included from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/Core:254:0,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/Tensor:14,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/include/onnxruntime/core/common/eigen_common_wrapper.h:35,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/onnxruntime/core/common/threadpool.cc:20:
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/util/IndexedViewHelper.h:57:147: error: ‘fix’ was not declared in this scope
static const symbolic::AddExpr<symbolic::SymbolExprinternal::symbolic_last_tag,symbolic::ValueExpr<Eigen::internal::FixedInt<1> > > lastp1(last+fix<1>());
^
。。。。。。

In file included from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/Core:348:0,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/Tensor:14,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/include/onnxruntime/core/common/eigen_common_wrapper.h:35,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/onnxruntime/core/common/threadpool.cc:20:
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/Reverse.h: In static member function ‘static void Eigen::internal::vectorwise_reverse_inplace_impl<0>::run(ExpressionType&)’:
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/Reverse.h:176:17: error: ‘fix’ was not declared in this scope
xpr.topRows(fix(half))
^
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/Reverse.h: In static member function ‘static void Eigen::internal::vectorwise_reverse_inplace_impl<1>::run(ExpressionType&)’:
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/../../../Eigen/src/Core/Reverse.h:189:18: error: ‘fix’ was not declared in this scope
xpr.leftCols(fix(half))
^
In file included from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/ThreadPool:64:0,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/Tensor:63,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/include/onnxruntime/core/common/eigen_common_wrapper.h:35,
from /home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/onnxruntime/core/common/threadpool.cc:20:
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h: At global scope:
/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/cmake/external/eigen/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h:171:56: warning: requested alignment 128 is larger than 64 [-Wattributes]
EIGEN_ALIGN_TO_BOUNDARY(128) std::atomic<uint64_t> next;
^
CMakeFiles/onnxruntime_common.dir/build.make:187: recipe for target 'CMakeFiles/onnxruntime_common.dir/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/onnxruntime/core/common/threadpool.cc.o' failed
make[2]: *** [CMakeFiles/onnxruntime_common.dir/home/vmuser/work/test/opencv-3.4.4/git/onnxruntime/onnxruntime/core/common/threadpool.cc.o] Error 1
CMakeFiles/Makefile2:322: recipe for target 'CMakeFiles/onnxruntime_common.dir/all' failed
make[1]: *** [CMakeFiles/onnxruntime_common.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2

Visual Studio Version

No response

GCC / Compiler Version

4.9.2

Tasks

Preview Give feedback
No tasks being tracked yet.
@TinyDustCCC TinyDustCCC added the build build issues; typically submitted using template label Jul 22, 2024
@snnn
Copy link
Member

snnn commented Jul 22, 2024

The version is no longer supported. Please try to use the latest ONNX Runtime release with the latest GCC.

@snnn snnn closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
@TinyDustCCC
Copy link
Author

The version is no longer supported. Please try to use the latest ONNX Runtime release with the latest GCC.

from the readme documentation, I see that onnxruntime 1.5.1 supports gcc 4.9.2. For some reason, I can only use gcc 4.9.2 for cross-compilation. Is there any solution?

@TinyDustCCC
Copy link
Author

The version is no longer supported. Please try to use the latest ONNX Runtime release with the latest GCC.

There is also a question about whether Eigen is necessary, whether it can be removed, and how to remove it, I found that I did not call the Eigen library on windos, only the onnxruntime.dll

@snnn
Copy link
Member

snnn commented Jul 23, 2024

Eigen is necessary for building onnxruntime.dll. It is not necessary outside of the DLL(i.e. in your code)

@TinyDustCCC
Copy link
Author

Eigen is necessary for building onnxruntime.dll. It is not necessary outside of the DLL(i.e. in your code)

If I don't change the GCC version, is there any way?

@snnn
Copy link
Member

snnn commented Jul 23, 2024

Sorry I don't know any. The latest ONNX Runtime code works fine with GCC 13 when cross-compiling for ARM32 on x86_64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template
Projects
None yet
Development

No branches or pull requests

2 participants