-
Notifications
You must be signed in to change notification settings - Fork 3k
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
iOS static library build from source code , symbol visibility issue #17722
Labels
platform:mobile
issues related to ONNX Runtime mobile; typically submitted using template
Comments
github-actions
bot
added
the
platform:mobile
issues related to ONNX Runtime mobile; typically submitted using template
label
Sep 27, 2023
I believe static libraries have no visibility control. This is called: diamond dependency problem. There is no Silver Bullet for this problem. On the other hand, if the operating system can support dynamic libraries(e.g. DLL, shared libraries), they can help. |
skottmckay
added a commit
that referenced
this issue
Nov 3, 2023
### Description <!-- Describe your changes. --> Pre-link with `ld -r` to apply symbol visibility when the static library is created to replicate XCode's Single Object Pre-link. Current builds set the visibility flags but that doesn't get applied until the static library is linked into something else, which can be too late. Pre-linking fixes this. The pre-link uses the .o files from the ORT static libraries and the .a files from external libraries. This combination limits the symbols included from the .a files to things required by the ORT .o files. In order to minimize changes elsewhere in the build we extract the .o files from the ORT static libraries using `ar -x`. Re-ordered the pieces use to build the Apple framework to make it a little more readable. Fixed a couple of misc issues with missing symbols from the minimal build that show up when pre-linking is applied. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Will hopefully address #17722
kleiti
pushed a commit
to kleiti/onnxruntime
that referenced
this issue
Mar 22, 2024
…18241) ### Description <!-- Describe your changes. --> Pre-link with `ld -r` to apply symbol visibility when the static library is created to replicate XCode's Single Object Pre-link. Current builds set the visibility flags but that doesn't get applied until the static library is linked into something else, which can be too late. Pre-linking fixes this. The pre-link uses the .o files from the ORT static libraries and the .a files from external libraries. This combination limits the symbols included from the .a files to things required by the ORT .o files. In order to minimize changes elsewhere in the build we extract the .o files from the ORT static libraries using `ar -x`. Re-ordered the pieces use to build the Apple framework to make it a little more readable. Fixed a couple of misc issues with missing symbols from the minimal build that show up when pre-linking is applied. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. --> Will hopefully address microsoft#17722
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the issue
Libraries which we combined from onnxruntime are
libclog.a libcpuinfo.a libonnxruntime_optimizer.a libonnxruntime_util.a libonnxruntime_common.a libonnxruntime_flatbuffers.a libonnxruntime_framework.a libonnxruntime_graph.a libonnxruntime_mlas.a libonnxruntime_providers.a libflatbuffers.a libonnx.a libonnxruntime_session.a libonnx_proto.a libprotobuf-lite.a libre2.a libnsync_cpp.a libabsl.a
To reproduce
Use static build
Urgency
Yes. Customer issue
Platform
iOS
OS Version
iosx64 build compiled on MAC
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
1.15.1
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
default
The text was updated successfully, but these errors were encountered: