Skip to content

[Build] libonnxruntime_providers_shared.so statically linked? #23355

Open
@zeng-xiao

Description

Describe the issue

I used the following compilation parameters to generate libonnxruntime_providers_shared.so:
python3 tools/ci_build/build.py
--build_dir $buildDir
--cmake_generator Ninja
--config Debug
--skip_submodule_sync
--skip_tests
--allow_running_as_root \
--build_shared_lib
--update
--compile_no_warning_as_error
--cmake_extra_defines CMAKE_INSTALL_PREFIX=$installDir
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
--cmake_extra_defines onnxruntime_BUILD_BENCHMARKS=OFF
--cmake_extra_defines CMAKE_VERBOSE_MAKEFILE=ON \
--cmake_extra_defines ONNX_BUILD_SHARED_LIBS=ON \
--build 2>&1 | tee make.log

Then I got the following information:
:/onnxruntime.git.upstream.github.noasan/build/Debug$ file libonnxruntime_providers_shared.so
libonnxruntime_providers_shared.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c05678b91a1c454abbd3779d337570a0e48561f6, with debug_info, not stripped
:
/onnxruntime.git.upstream.github.noasan/build/Debug$ ldd libonnxruntime_providers_shared.so
statically linked

However, in the community-released package, I saw the following information:
/onnxruntime-linux-x64/onnxruntime-linux-x64-1.20.1/lib$ ldd libonnxruntime_providers_shared.so
linux-vdso.so.1 (0x00007fff44faf000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa567800000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa567b18000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa567aea000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa567400000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa567c1c000)
:
/onnxruntime-linux-x64/onnxruntime-linux-x64-1.20.1/lib$ file libonnxruntime_providers_shared.so
libonnxruntime_providers_shared.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5fd3c27badfc98ce8ba513ea37a6e8938b2917ac, stripped

The following is my working platform:
~/onnxruntime-linux-x64/onnxruntime-linux-x64-1.20.1/lib$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble

Urgency

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble

Target platform

No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04 LTS Release: 24.04 Codename: noble

Build script

python3 tools/ci_build/build.py
--build_dir $buildDir
--cmake_generator Ninja
--config Debug
--skip_submodule_sync
--skip_tests
--allow_running_as_root \
--build_shared_lib
--update
--compile_no_warning_as_error
--cmake_extra_defines CMAKE_INSTALL_PREFIX=$installDir
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF
--cmake_extra_defines onnxruntime_BUILD_BENCHMARKS=OFF
--cmake_extra_defines CMAKE_VERBOSE_MAKEFILE=ON \
--cmake_extra_defines ONNX_BUILD_SHARED_LIBS=ON \
--build 2>&1 | tee make.log

Error / output

:/onnxruntime.git.upstream.github.noasan/build/Debug$ file libonnxruntime_providers_shared.so
libonnxruntime_providers_shared.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=c05678b91a1c454abbd3779d337570a0e48561f6, with debug_info, not stripped
:
/onnxruntime.git.upstream.github.noasan/build/Debug$ ldd libonnxruntime_providers_shared.so
statically linked

Visual Studio Version

No response

GCC / Compiler Version

gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04)

Metadata

Assignees

No one assigned

    Labels

    buildbuild issues; typically submitted using template

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions