Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 ディスカッション

Unable to statically link with oneAPI 2025.2.0

Lewallen__Roy
初心者
398件の閲覧回数

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 件の賞賛
1 解決策
MarcGrodent
新規コントリビューター I
330件の閲覧回数

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.

元の投稿で解決策を見る

5 返答(返信)
MarcGrodent
新規コントリビューター I
331件の閲覧回数

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
モデレーター
190件の閲覧回数

Intel only provides dynamic libraries for OpenMP on Windows.  

andrew_4619
名誉コントリビューター III
276件の閲覧回数

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

 

avinashs
新規コントリビューター I
262件の閲覧回数

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). 

Lewallen__Roy
初心者
136件の閲覧回数

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

返信