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] error cross compiling #21500

Closed
saad-koukous opened this issue Jul 25, 2024 · 4 comments
Closed

[Build] error cross compiling #21500

saad-koukous opened this issue Jul 25, 2024 · 4 comments
Labels
build build issues; typically submitted using template

Comments

@saad-koukous
Copy link

Describe the issue

I'm trying to cross-compile the library v1.19.1, but I got an error in the last step when reaching 100%.
I successfully built all previous versions, but none of these versions support my model and they give me a segmentation fault error.

Urgency

No response

Target platform

beagleBone Black rev3 armv7 gcc 8.3

Build script

ARMCC_FLAGS="-march=armv7-a -mfpu=neon-vfpv3 -funsafe-math-optimizations -mfp16-format=ieee"
ARMCC_PREFIX=/home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
cmake -DCMAKE_C_COMPILER=${ARMCC_PREFIX}gcc
-DCMAKE_CXX_COMPILER=${ARMCC_PREFIX}g++
-DCMAKE_C_FLAGS="${ARMCC_FLAGS}"
-DCMAKE_CXX_FLAGS="${ARMCC_FLAGS}"
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=armv7
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
-Donnxruntime_BUILD_SHARED_LIB=ON
-Donnxruntime_BUILD_UNIT_TESTS=OFF
-Donnxruntime_MINIMAL_BUILD=ON
-DCMAKE_BUILD_TYPE=MinSizeRel
-Donnxruntime_ENABLE_CPUINFO=OFF
../cmake
make -j6

Error / output

[100%] Linking CXX shared library libonnxruntime.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/onnxruntime.dir/link.txt --verbose=1
/home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -fPIC -march=armv7-a -mfpu=neon-vfpv3 -funsafe-math-optimizations -mfp16-format=ieee -ffunction-sections -fdata-sections -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -Wno-error=attributes -Wno-restrict -mfpu=neon -Os -DNDEBUG -Xlinker --version-script=/home/saad/onnxruntime/arm32/onnxruntime.lds -Xlinker --no-undefined -Xlinker --gc-sections -z noexecstack -s -Wl,--gc-sections -Wl,-rpath='$ORIGIN' -shared -Wl,-soname,libonnxruntime.so.1.19.0 -o libonnxruntime.so.1.19.0 CMakeFiles/onnxruntime.dir/generated_source.c.o libonnxruntime_session.a libonnxruntime_optimizer.a libonnxruntime_providers.a libonnxruntime_framework.a libonnxruntime_graph.a libonnxruntime_util.a libonnxruntime_mlas.a libonnxruntime_common.a libonnxruntime_flatbuffers.a libonnx.a libonnx_proto.a _deps/protobuf-build/libprotobuf-lite.a _deps/re2-build/libre2.a _deps/flatbuffers-build/libflatbuffers.a _deps/abseil_cpp-build/absl/hash/libabsl_city.a _deps/abseil_cpp-build/absl/hash/libabsl_hash.a _deps/abseil_cpp-build/absl/hash/libabsl_low_level_hash.a _deps/abseil_cpp-build/absl/container/libabsl_raw_hash_set.a _deps/abseil_cpp-build/absl/base/libabsl_raw_logging_internal.a _deps/abseil_cpp-build/absl/strings/libabsl_str_format_internal.a _deps/abseil_cpp-build/absl/strings/libabsl_string_view.a _deps/abseil_cpp-build/absl/synchronization/libabsl_synchronization.a _deps/abseil_cpp-build/absl/base/libabsl_base.a _deps/abseil_cpp-build/absl/time/libabsl_civil_time.a _deps/abseil_cpp-build/absl/debugging/libabsl_debugging_internal.a _deps/abseil_cpp-build/absl/debugging/libabsl_demangle_internal.a _deps/abseil_cpp-build/absl/synchronization/libabsl_graphcycles_internal.a _deps/abseil_cpp-build/absl/numeric/libabsl_int128.a _deps/abseil_cpp-build/absl/synchronization/libabsl_kernel_timeout_internal.a _deps/abseil_cpp-build/absl/base/libabsl_log_severity.a _deps/abseil_cpp-build/absl/base/libabsl_malloc_internal.a _deps/abseil_cpp-build/absl/base/libabsl_spinlock_wait.a _deps/abseil_cpp-build/absl/debugging/libabsl_stacktrace.a _deps/abseil_cpp-build/absl/strings/libabsl_string_view.a _deps/abseil_cpp-build/absl/strings/libabsl_strings.a _deps/abseil_cpp-build/absl/strings/libabsl_strings_internal.a _deps/abseil_cpp-build/absl/debugging/libabsl_symbolize.a _deps/abseil_cpp-build/absl/base/libabsl_throw_delegate.a _deps/abseil_cpp-build/absl/time/libabsl_time.a _deps/abseil_cpp-build/absl/time/libabsl_time_zone.a _deps/google_nsync-build/libnsync_cpp.a -ldl -lrt _deps/abseil_cpp-build/absl/flags/libabsl_flags_internal.a _deps/abseil_cpp-build/absl/flags/libabsl_flags_marshalling.a _deps/abseil_cpp-build/absl/flags/libabsl_flags_reflection.a _deps/abseil_cpp-build/absl/flags/libabsl_flags_config.a _deps/abseil_cpp-build/absl/flags/libabsl_flags_program_name.a _deps/abseil_cpp-build/absl/flags/libabsl_flags_private_handle_accessor.a _deps/abseil_cpp-build/absl/flags/libabsl_flags_commandlineflag.a _deps/abseil_cpp-build/absl/flags/libabsl_flags_commandlineflag_internal.a _deps/abseil_cpp-build/absl/container/libabsl_raw_hash_set.a _deps/abseil_cpp-build/absl/container/libabsl_hashtablez_sampler.a _deps/abseil_cpp-build/absl/hash/libabsl_hash.a _deps/abseil_cpp-build/absl/hash/libabsl_city.a _deps/abseil_cpp-build/absl/hash/libabsl_low_level_hash.a _deps/abseil_cpp-build/absl/types/libabsl_bad_variant_access.a _deps/abseil_cpp-build/absl/strings/libabsl_cord.a _deps/abseil_cpp-build/absl/strings/libabsl_cordz_info.a _deps/abseil_cpp-build/absl/strings/libabsl_cord_internal.a _deps/abseil_cpp-build/absl/strings/libabsl_cordz_functions.a _deps/abseil_cpp-build/absl/profiling/libabsl_exponential_biased.a _deps/abseil_cpp-build/absl/strings/libabsl_cordz_handle.a _deps/abseil_cpp-build/absl/crc/libabsl_crc_cord_state.a _deps/abseil_cpp-build/absl/crc/libabsl_crc32c.a _deps/abseil_cpp-build/absl/crc/libabsl_crc_internal.a _deps/abseil_cpp-build/absl/crc/libabsl_crc_cpu_detect.a _deps/abseil_cpp-build/absl/types/libabsl_bad_optional_access.a _deps/abseil_cpp-build/absl/strings/libabsl_str_format_internal.a _deps/abseil_cpp-build/absl/synchronization/libabsl_synchronization.a _deps/abseil_cpp-build/absl/synchronization/libabsl_graphcycles_internal.a _deps/abseil_cpp-build/absl/synchronization/libabsl_kernel_timeout_internal.a _deps/abseil_cpp-build/absl/debugging/libabsl_stacktrace.a _deps/abseil_cpp-build/absl/debugging/libabsl_symbolize.a _deps/abseil_cpp-build/absl/debugging/libabsl_debugging_internal.a _deps/abseil_cpp-build/absl/debugging/libabsl_demangle_internal.a _deps/abseil_cpp-build/absl/base/libabsl_malloc_internal.a _deps/abseil_cpp-build/absl/time/libabsl_time.a _deps/abseil_cpp-build/absl/time/libabsl_civil_time.a _deps/abseil_cpp-build/absl/time/libabsl_time_zone.a _deps/abseil_cpp-build/absl/strings/libabsl_strings.a _deps/abseil_cpp-build/absl/numeric/libabsl_int128.a _deps/abseil_cpp-build/absl/strings/libabsl_strings_internal.a _deps/abseil_cpp-build/absl/strings/libabsl_string_view.a _deps/abseil_cpp-build/absl/base/libabsl_base.a _deps/abseil_cpp-build/absl/base/libabsl_spinlock_wait.a -lrt _deps/abseil_cpp-build/absl/base/libabsl_throw_delegate.a _deps/abseil_cpp-build/absl/base/libabsl_raw_logging_internal.a _deps/abseil_cpp-build/absl/base/libabsl_log_severity.a -lpthread
/home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: libonnxruntime_session.a(abi_session_options.cc.o): in function std::enable_if<std::__and_<std::__not_<std::is_same<std::remove_cv<char const*>::type, std::filesystem::__cxx11::path> >, std::__not_<std::is_void<char const*> >, std::filesystem::__cxx11::path::__constructible_from<char const*, void> >::value, std::filesystem::__cxx11::path>::type& std::filesystem::__cxx11::path::operator=<char const*>(char const* const&)': abi_session_options.cc:(.text._ZNSt10filesystem7__cxx114pathaSIPKcEERNSt9enable_ifIXsrSt6__and_IJSt6__not_ISt7is_sameINSt9remove_cvIT_E4typeES1_EES7_ISt7is_voidISA_EENS1_20__constructible_fromISA_vEEEE5valueES1_E4typeERKSA_[_ZNSt10filesystem7__cxx114pathaSIPKcEERNSt9enable_ifIXsrSt6__and_IJSt6__not_ISt7is_sameINSt9remove_cvIT_E4typeES1_EES7_ISt7is_voidISA_EENS1_20__constructible_fromISA_vEEEE5valueES1_E4typeERKSA_]+0x40): undefined reference to std::filesystem::__cxx11::path::_M_split_cmpts()'
/home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: abi_session_options.cc:(.text.ZNSt10filesystem7__cxx114pathaSIPKcEERNSt9enable_ifIXsrSt6__and_IJSt6__not_ISt7is_sameINSt9remove_cvIT_E4typeES1_EES7_ISt7is_voidISA_EENS1_20__constructible_fromISA_vEEEE5valueES1_E4typeERKSA[ZNSt10filesystem7__cxx114pathaSIPKcEERNSt9enable_ifIXsrSt6__and_IJSt6__not_ISt7is_sameINSt9remove_cvIT_E4typeES1_EES7_ISt7is_voidISA_EENS1_20__constructible_fromISA_vEEEE5valueES1_E4typeERKSA]+0xac): undefined reference to std::filesystem::__cxx11::path::_M_split_cmpts()' /home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: libonnxruntime_framework.a(session_state_utils.cc.o): in function std::filesystem::__cxx11::path::path<char const*, std::filesystem::__cxx11::path>(char const* const&, std::filesystem::__cxx11::path::format)':
session_state_utils.cc:(.text._ZNSt10filesystem7__cxx114pathC2IPKcS1_EERKT_NS1_6formatE[_ZNSt10filesystem7__cxx114pathC5IPKcS1_EERKT_NS1_6formatE]+0x30): undefined reference to std::filesystem::__cxx11::path::_M_split_cmpts()' /home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: libonnxruntime_framework.a(tensorprotoutils.cc.o): in function std::filesystem::__cxx11::path::operator/=(std::filesystem::__cxx11::path const&)':
tensorprotoutils.cc:(.text.ZNSt10filesystem7__cxx114pathdVERKS1[ZNSt10filesystem7__cxx114pathdVERKS1]+0x10): undefined reference to std::filesystem::__cxx11::path::has_root_directory() const' /home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: tensorprotoutils.cc:(.text._ZNSt10filesystem7__cxx114pathdVERKS1_[_ZNSt10filesystem7__cxx114pathdVERKS1_]+0x3c): undefined reference to std::filesystem::__cxx11::path::has_filename() const'
/home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: tensorprotoutils.cc:(.text.ZNSt10filesystem7__cxx114pathdVERKS1[ZNSt10filesystem7__cxx114pathdVERKS1]+0xfc): undefined reference to std::filesystem::__cxx11::path::_M_split_cmpts()' /home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: libonnxruntime_framework.a(tensorprotoutils.cc.o): in function std::filesystem::__cxx11::path::path<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, std::filesystem::__cxx11::path>(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::filesystem::__cxx11::path::format)':
tensorprotoutils.cc:(.text._ZNSt10filesystem7__cxx114pathC2INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES1_EERKT_NS1_6formatE[_ZNSt10filesystem7__cxx114pathC5INSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES1_EERKT_NS1_6formatE]+0x3c): undefined reference to std::filesystem::__cxx11::path::_M_split_cmpts()' /home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: libonnxruntime_framework.a(tensorprotoutils.cc.o): in function onnxruntime::utils::UnpackInitializerData(onnx::TensorProto const&, std::filesystem::__cxx11::path const&, std::vector<unsigned char, std::allocator >&)':
tensorprotoutils.cc:(.text._ZN11onnxruntime5utils21UnpackInitializerDataERKN4onnx11TensorProtoERKNSt10filesystem7__cxx114pathERSt6vectorIhSaIhEE+0x38): undefined reference to std::filesystem::__cxx11::path::parent_path() const' /home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: libonnxruntime_framework.a(tensorprotoutils.cc.o): in function onnxruntime::utils::GetExtDataFromTensorProto(onnxruntime::Env const&, std::filesystem::__cxx11::path const&, onnx::TensorProto const&, void*&, SafeInt<unsigned int, SafeIntExceptionHandleronnxruntime::OnnxRuntimeException >&, onnxruntime::OrtCallback&)':
tensorprotoutils.cc:(.text._ZN11onnxruntime5utils25GetExtDataFromTensorProtoERKNS_3EnvERKNSt10filesystem7__cxx114pathERKN4onnx11TensorProtoERPvR7SafeIntIj23SafeIntExceptionHandlerINS_20OnnxRuntimeExceptionEEERNS_11OrtCallbackE+0x240): undefined reference to std::filesystem::file_size(std::filesystem::__cxx11::path const&)' /home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: tensorprotoutils.cc:(.text._ZN11onnxruntime5utils25GetExtDataFromTensorProtoERKNS_3EnvERKNSt10filesystem7__cxx114pathERKN4onnx11TensorProtoERPvR7SafeIntIj23SafeIntExceptionHandlerINS_20OnnxRuntimeExceptionEEERNS_11OrtCallbackE+0x400): undefined reference to std::filesystem::__cxx11::path::_M_split_cmpts()'
/home/saad/toolchains/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/../lib/gcc/arm-linux-gnueabihf/8.3.0/../../../../arm-linux-gnueabihf/bin/ld: tensorprotoutils.cc:(.text._ZN11onnxruntime5utils25GetExtDataFromTensorProtoERKNS_3EnvERKNSt10filesystem7__cxx114pathERKN4onnx11TensorProtoERPvR7SafeIntIj23SafeIntExceptionHandlerINS_20OnnxRuntimeExceptionEEERNS_11OrtCallbackE+0x418): undefined reference to `std::filesystem::file_size(std::filesystem::__cxx11::path const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/onnxruntime.dir/build.make:188: libonnxruntime.so.1.19.0] Error 1
make[2]: Leaving directory '/home/saad/onnxruntime/arm32'
make[1]: *** [CMakeFiles/Makefile2:2086: CMakeFiles/onnxruntime.dir/all] Error 2
make[1]: Leaving directory '/home/saad/onnxruntime/arm32'
make: *** [Makefile:149: all] Error 2

Visual Studio Version

No response

GCC / Compiler Version

No response

@saad-koukous saad-koukous added the build build issues; typically submitted using template label Jul 25, 2024
@skottmckay
Copy link
Contributor

std::filesystem is from C++17. May require gcc 9.x or later.

@saad-koukous
Copy link
Author

saad-koukous commented Jul 25, 2024

Is there a method to use GCC 8? Because my target only has this toolchain.

@snnn
Copy link
Member

snnn commented Jul 25, 2024

No, it is not possible. Or you use an older version of ONNX Runtime.

@snnn
Copy link
Member

snnn commented Jul 25, 2024

BeagleBone Black supports Debian 11 which is very new.

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

3 participants