Skip to content

Linker flag /SAFESEH also on Linux 32bit build #9744

Closed
@pvavercak

Description

Describe the bug
Possible bug in CMake function onnxruntime_add_shared_library_module. My Linux x86 CI job fails because of /SAFESEH linker option. This option is appended to linker flags here. Linux 32bit build may not be your target platform but I think this can cause problems for many users targeting 32bit Linux.
Same story with onnxruntime_add_executable

Urgency
None

System information

  • OS Platform and Distribution: CentOS 7
  • ONNX Runtime installed from (source or binary): source
  • ONNX Runtime version: 1.9.1
  • Python version: 3.6
  • Visual Studio version (if applicable):
  • GCC/Compiler version (if compiling from source): gcc 7.3
  • CUDA/cuDNN version: -
  • GPU model and memory: -

To Reproduce
Try building onnxruntime from tag v1.9.1 for Linux 32bit

Expected behavior
Working Linux 32bit build

Additional context
I can patch the sources so the condition will be:

if (onnxruntime_target_platform STREQUAL "x86" AND NOT onnxruntime_BUILD_WEBASSEMBLY AND MSVC)
    target_link_options(${target_name} PRIVATE /SAFESEH)
endif()

or something like this but as the CMakeLists.txt is changing with any further onnxruntime release, I end up updating this small patch every time I want to bump onnxruntime version.

Metadata

Assignees

No one assigned

    Labels

    buildbuild issues; typically submitted using templatecontributions welcomeexternal contributions welcome

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions