microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
13.46k stars 2.75k forks source link

[Build] Linux x86_64 STATIC Build #19035

Open moondayyy opened 5 months ago

moondayyy commented 5 months ago

Describe the issue

I want to build the library statically and I want to link it to my own library and use the SHARED library I created in another project.

My build code: ./build.sh --config=MinSizeRel --update --build --parallel --minimal_build --disable_ml_ops --disable_exceptions --disable_rtti --enable_reduced_operator_type_support --skip_tests --allow_running_as_root --cmake_extra_defines CMAKE_INSTALL_PREFIX=prefix --cmake_extra_defines CMAKE_POSITION_INDEPENDENT_CODE=ON make install Output lib folder: image

How can I make a static build for Linux x86_64? NOTE: https://github.com/csukuangfj/onnxruntime-libs/releases The built library in the link above works, but I could not find the build code.

Urgency

No response

Target platform

Linux - x86_64

Build script

./build.sh --config=MinSizeRel --update --build --parallel --minimal_build --disable_ml_ops --disable_exceptions --disable_rtti --enable_reduced_operator_type_support --skip_tests --allow_running_as_root --cmake_extra_defines CMAKE_INSTALL_PREFIX=prefix --cmake_extra_defines CMAKE_POSITION_INDEPENDENT_CODE=ON make install

Error / output

image

I call the SHARED library I created with dlopen, but my pointer address always comes back as NULL.

Visual Studio Version

No response

GCC / Compiler Version

No response

snnn commented 5 months ago

Set the LD_DEBUG env var to something, then it will tell you why dlopen failed.

MikePooh commented 4 months ago

The build code is posted in this repo.