[Openmp-dev] [cfe-dev] libomp.lib is not automatically added on Windows

Reid Kleckner via Openmp-dev openmp-dev at lists.llvm.org
Mon Aug 10 08:58:00 PDT 2015


Try adding logic to visualstudio::Linker::ConstructJob() to handle -fopenmp.

On Mon, Aug 10, 2015 at 8:51 AM, Peyton, Jonathan L <
jonathan.l.peyton at intel.com> wrote:

> Clang front end developers,
>
> We are having trouble getting the -fopenmp flag to work on Windows.  It
> appears that the linking phase does not include libomp.lib?  Below is an
> OpenMP hello world compilation output.
>
> -- Johnny
>
> -----Original Message-----
> From: İsmail Dönmez [mailto:ismail at i10z.com]
> Sent: Monday, August 10, 2015 10:04 AM
> To: Peyton, Jonathan L
> Subject: Re: [Openmp-dev] libomp.lib is not automatically added on Windows
>
> Hi,
>
> On Mon, Aug 10, 2015 at 6:02 PM, Peyton, Jonathan L <
> jonathan.l.peyton at intel.com> wrote:
> > Can you include -v in the compile command and post the output?
>
> Sure:
>
> C:\Users\ismail\Desktop>clang -O2 -fms-compatibility-version=19 -fopenmp
> -v omp_hello.c clang version 3.8.0 (http://llvm.org/git/clang
> 45770fa6e4eb618277ed85044d5a2d4c962c57cf) (http://llvm.org/git/llvm
> 97bdbf60d9923a9e06effbb96801129070499fd5)
> Target: x86_64-pc-windows-msvc
> Thread model: posix
> InstalledDir: C:\Program Files\LLVM\bin
>  "C:\\Program Files\\LLVM\\bin\\clang.exe" -cc1 -triple
> x86_64-pc-windows-msvc19.0.0 -emit-obj -disable-free -main-file-name
> omp_hello.c -mrelocation-model pic -pic-level 2 -mthread-model posix
> -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
> -target-cpu x86-64 -momit-leaf-frame-pointer -v -dwarf-column-info
> -resource-dir "C:\\Program Files\\LLVM\\bin\\..\\lib\\clang\\3.8.0"
> -internal-isystem "C:\\Program
> Files\\LLVM\\bin\\..\\lib\\clang\\3.8.0\\include" -internal-isystem
> "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\INCLUDE"
> -internal-isystem "C:\\Program Files (x86)\\Microsoft Visual Studio
> 14.0\\VC\\ATLMFC\\INCLUDE" -internal-isystem "C:\\Program Files
> (x86)\\Windows Kits\\10\\include\\10.0.10150.0\\ucrt"
> -internal-isystem "C:\\Program Files (x86)\\Windows
> Kits\\NETFXSDK\\4.6\\include\\um" -internal-isystem "C:\\Program Files
> (x86)\\Windows Kits\\8.1\\include\\shared" -internal-isystem "C:\\Program
> Files (x86)\\Windows Kits\\8.1\\include\\um"
> -internal-isystem "C:\\Program Files (x86)\\Windows
> Kits\\8.1\\include\\winrt" -O2 -fdebug-compilation-dir
> "C:\\Users\\ismail\\Desktop" -ferror-limit 19 -fmessage-length 100 -fopenmp
> -fnoopenmp-use-tls -mstackrealign -fms-extensions -fms-compatibility
> -fms-compatibility-version=19 -fdelayed-template-parsing -fobjc-runtime=gcc
> -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops
> -vectorize-slp -o
> "C:\\Users\\ismail\\AppData\\Local\\Temp\\omp_hello-45bdc2.o" -x c
> omp_hello.c clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default
> target x86_64-pc-windows-msvc #include "..." search starts here:
> #include <...> search starts here:
>  C:\Program Files\LLVM\bin\..\lib\clang\3.8.0\include
>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE
> C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE
> C:\Program Files (x86)\Windows Kits\10\include\10.0.10150.0\ucrt
> C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6\include\um  C:\Program
> Files (x86)\Windows Kits\8.1\include\shared  C:\Program Files (x86)\Windows
> Kits\8.1\include\um  C:\Program Files (x86)\Windows Kits\8.1\include\winrt
> End of search list.
>  "C:\\Program Files (x86)\\Microsoft Visual Studio
> 14.0\\VC\\bin\\amd64\\link.exe" -out:a.exe -defaultlib:libcmt -nologo
> "C:\\Users\\ismail\\AppData\\Local\\Temp\\omp_hello-45bdc2.o"
> omp_hello-45bdc2.o : error LNK2019: unresolved external symbol
> __kmpc_fork_call referenced in function main omp_hello-45bdc2.o : error
> LNK2019: unresolved external symbol omp_get_thread_num referenced in
> function .omp_outlined.
> omp_hello-45bdc2.o : error LNK2019: unresolved external symbol
> omp_get_num_threads referenced in function .omp_outlined.
> omp_hello-45bdc2.o : error LNK2019: unresolved external symbol
> __kmpc_cancel_barrier referenced in function .omp_outlined.
> a.exe : fatal error LNK1120: 4 unresolved externals
> clang.exe: error: linker command failed with exit code 1120 (use -v to see
> invocation)
>
> C:\Users\ismail\Desktop>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20150810/0185e030/attachment.html>


More information about the Openmp-dev mailing list