Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29261 Discussions

Unable to statically link with oneAPI 2025.2.0

Lewallen__Roy
Novice
307 Views

I have an existing command line application which uses MKL functions, compiled with the Parallel Studio XE 2020 update 4 compiler, running under Visual Studio 2019 on a Windows 10 system. No additional libraries were specified in Properties or as source or resource files, although Properties does specify to include Sequential MKL libraries. The compiled program doesn't require libiomp5md.dll to run (tested on computers not having that file anywhere), and Depends.exe doesn't show any .dll dependencies. So it's clearly statically linked without any apparent explicit command to do so. I've never investigated this since it's what I want for this application.

I recently got oneAPI v. 2025.2.0 and compiled the program with the same Properties, running under Visual Studio on a Windows 11 system. But the compiled program won't run without libiomp5md.dll, which Depends shows as being a dependency.

I'd like to make a statically linked executable but haven't been successful in trying. I've included libiomp5md.lib in the Properties under Linker/Input/Additional Dependencies, both with a complete path (in quotes) to the original file in C:\Program Files\Intel\oneAPI\compiler\2025.2\lib, or just the name but with the path entered in Linker\General\Additional Library Dependencies. In both cases there are no errors when compiling but the output executable file is identical and still requires libiomp5md.dll in order to run (and is shown to need it by Depends).

How can I statically link this library (or whatever library is required)?

Thanks!

0 Kudos
1 Solution
MarcGrodent
New Contributor I
239 Views

I think it is not possible to statically link OpenMP. This feature was withdrawn years ago (see this discussion: https://community.intel.com/t5/Intel-Fortran-Compiler/Openmp-Static-Linking/m-p/1101006 ). So if you want to share your code, you need to include libiomp5md.dll in the distributable package.

View solution in original post

5 Replies
MarcGrodent
New Contributor I
240 Views

I think it is not possible to statically link OpenMP. This feature was withdrawn years ago (see this discussion: https://community.intel.com/t5/Intel-Fortran-Compiler/Openmp-Static-Linking/m-p/1101006 ). So if you want to share your code, you need to include libiomp5md.dll in the distributable package.

Ron_Green
Moderator
99 Views

Intel only provides dynamic libraries for OpenMP on Windows.  

0 Kudos
andrew_4619
Honored Contributor III
185 Views

....Or provide users with a download link to the Intel redistributable Installer..... or indeed bundle the installer with your own installer......

 

0 Kudos
avinashs
New Contributor I
171 Views

Try installing the Windows 10 SDK (10.0.19041.0) and point the OneAPI compiler to this version. I have had issues with statically linked executables and dlls when using the new Windows 11 SDK (10.0.26100.4654). 

0 Kudos
Lewallen__Roy
Novice
45 Views

Thanks very much, everyone. I was misled by the help information accompanying the compiler, and information on the Intel Support web pages which both said it was possible and to do it like I was trying. Fortunately it's no big deal for me but I wanted to help out someone who maintains some legacy software and will probably sooner or later have to recompile it with a modern compiler.

 

Thanks again.

 

Roy

0 Kudos
Reply