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] how to compile ios static library #23835

Open
zxj329 opened this issue Feb 27, 2025 · 4 comments
Open

[Build] how to compile ios static library #23835

zxj329 opened this issue Feb 27, 2025 · 4 comments
Labels
build build issues; typically submitted using template platform:mobile issues related to ONNX Runtime mobile; typically submitted using template

Comments

@zxj329
Copy link

zxj329 commented Feb 27, 2025

Describe the issue

./build.sh --ios
--skip_tests
--skip_submodule_sync
--parallel
--build_dir ./build_ios
--apple_sysroot iphoneos
--osx_arch arm64
--apple_deploy_target 13.0
--cmake_generator Xcode
--config=MinSizeRel
--minimal_build
--build_apple_framework
--include_ops_by_config=required_operators_ORT.config
--enable_reduced_operator_type_support
--cmake_extra_defines CMAKE_CXX_FLAGS="-stdlib=libc++"
--compile_no_warning_as_error
i use this scripts to compile ios static library, but i cant find the libonnxruntime.a for ios

Urgency

No response

Target platform

ios

Build script

./build.sh --ios
--skip_tests
--skip_submodule_sync
--parallel
--build_dir ./build_ios
--apple_sysroot iphoneos
--osx_arch arm64
--apple_deploy_target 13.0
--cmake_generator Xcode
--config=MinSizeRel
--minimal_build
--build_apple_framework
--include_ops_by_config=required_operators_ORT.config
--enable_reduced_operator_type_support
--cmake_extra_defines CMAKE_CXX_FLAGS="-stdlib=libc++"
--compile_no_warning_as_error

Error / output

i use this scripts to compile ios static library, but i cant find the libonnxruntime.a for ios

Visual Studio Version

No response

GCC / Compiler Version

No response

@zxj329 zxj329 added the build build issues; typically submitted using template label Feb 27, 2025
@github-actions github-actions bot added the platform:mobile issues related to ONNX Runtime mobile; typically submitted using template label Feb 27, 2025
@vraspar
Copy link
Contributor

vraspar commented Feb 27, 2025

The static library and framework should be inside MinSizeRel/MinSizeRel-iphoneos/static_framework/.

build_ios/MinSizeRel/MinSizeRel-iphoneos/static_framework/onnxruntime.framework/onnxruntime

Note: The onnxruntime static binary does not have .a extension in this case

@zxj329
Copy link
Author

zxj329 commented Feb 28, 2025

The static library and framework should be inside MinSizeRel/MinSizeRel-iphoneos/static_framework/.

build_ios/MinSizeRel/MinSizeRel-iphoneos/static_framework/onnxruntime.framework/onnxruntime

Note: The onnxruntime static binary does not have .a extension in this case

yes, i have got build_ios/MinSizeRel/MinSizeRel-iphoneos/static_framework/onnxruntime.framework/onnxruntime,but when i link this library in other project,it occurs errors。such as

ld64.lld: error: undefined symbol: std::__1::basic_streambuf<char, std::__1::char_traits>::~basic_streambuf()

referenced by ../../../../../../../sdk/rmp/dep_libs/acme_ai_denoise/libs/libonnxruntime.a(prelinked_objects.o):(symbol onnxruntime::logging::AppleLogSink::SendImpl(std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000l>>> const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator> const&, onnxruntime::logging::Capture const&)+0x43c)
referenced by ../../../../../../../sdk/rmp/dep_libs/acme_ai_denoise/libs/libonnxruntime.a(prelinked_objects.o):(symbol onnxruntime::CodeLocation::ToString(onnxruntime::CodeLocation::Format) const+0x130)
referenced by ../../../../../../../sdk/rmp/dep_libs/acme_ai_denoise/libs/libonnxruntime.a(prelinked_objects.o):(symbol std::__1::basic_ostringstream<char, std::__1::char_traits, std::__1::allocator>::~basic_ostringstream()+0x58)
referenced 306 more times

can u tell me how to solve this problem?forward ur replay

@skottmckay
Copy link
Contributor

You need to link the C++ standard library if it's missing std::basic_streambuf. Do your linker flags have -lc++ after the ORT library?

@zxj329
Copy link
Author

zxj329 commented Mar 4, 2025

You need to link the C++ standard library if it's missing std::basic_streambuf. Do your linker flags have -lc++ after the ORT library?

yes i do,i have soloved this problem

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 platform:mobile issues related to ONNX Runtime mobile; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants