Page MenuHome

Add support for building with OpenMP support for clang on windows.
ClosedPublic

Authored by LazyDodo (LazyDodo) on Wed, Oct 2, 10:28 PM.

Details

Diff Detail

Repository
rB Blender

Event Timeline

While this restores OpenMP support for the main blender executable, the test executables that end up in bin\tests\release and they won't run until you manually copy libomp.dll there not entirely sure where would be the best place to copy that automatically?

LazyDodo (LazyDodo) edited the summary of this revision. (Show Details)Wed, Oct 2, 10:33 PM

While this restores OpenMP support for the main blender executable, the test executables that end up in bin\tests\release and they won't run until you manually copy libomp.dll there not entirely sure where would be the best place to copy that automatically?

Are other dlls copied to the tests directory?

If I remember correctly, ctest runs tests with bin as the current working directory, and then it finds the dlls there.

Are other dlls copied to the tests directory?

no , but we kinda count on the msvc run-time being installed since we just ran the compiler... so that took care of that issue for regular msvc builds

If I remember correctly, ctest runs tests with bin as the current working directory, and then it finds the dlls there.

this does not seem to be the case for atleast the libmv tests (which are the only ones that are failing to load, didn't check any of the other executables)

from the CreateProcess Event:

Parent PID:	10964
Command line:	K:/BlenderGit/ninja_full/bin/tests/Release/libmv_modal_solver_test.exe
Current directory:	K:\BlenderGit\ninja_full\intern\libmv\
Nathan Letwory (jesterking) requested changes to this revision.Thu, Oct 3, 8:15 AM

The path containing libomp.dll needs to be enclosed in double quotes, otherwise there will be linking errors:

[745/3935] Linking C executable bin\datatoc.exe
FAILED: bin/datatoc.exe
cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=source\blender\datatoc\CMakeFiles\datatoc.dir --manifests  -- C:\PROGRA~2\MICROS~1\2017\PROFES~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo source\blender\datatoc\CMakeFiles\datatoc.dir\datatoc.c.obj  /out:bin\datatoc.exe /implib:bin\datatoc.lib /pdb:bin\datatoc.pdb /version:0.0  /machine:x64 C:/Program Files/LLVM/lib/libomp.lib /SAFESEH:NO /MACHINE:X64  /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO  /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib  /ignore:4049 /ignore:4217 /ignore:4221 /INCREMENTAL:NO /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\PROGRA~2\MICROS~1\2017\PROFES~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo source\blender\datatoc\CMakeFiles\datatoc.dir\datatoc.c.obj /out:bin\datatoc.exe /implib:bin\datatoc.lib /pdb:bin\datatoc.pdb /version:0.0 /machine:x64 C:/Program Files/LLVM/lib/libomp.lib /SAFESEH:NO /MACHINE:X64 /SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib /ignore:4049 /ignore:4217 /ignore:4221 /INCREMENTAL:NO /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\datatoc.exe.manifest" failed (exit code 1181) with the following output:
LINK : fatal error LNK1181: cannot open input file 'C:\Program.obj'

The location for libomp.lib here is at default location as given by the Clang/LLVM installer.

This revision now requires changes to proceed.Thu, Oct 3, 8:15 AM

To be clear, you are running the libmv tests with something like ctest -R libmv and not running the executables directly?

Anyway, it's more convenient if these executables can run correctly without that. So I think you can put code to install the dll to TESTS_OUTPUT_DIR in tests/gtests/CMakeLists.txt.

Took a closer look, the working folder should actually be the bin folder, but due to a bug in our buildscripts it is not, will address in a separate diff since it really has nothing to do with openmp.

  • Merge remote-tracking branch 'origin/master' into tmp_clang_openmp_fix
  • Add quotes for libopmp to resolve linker errors when there are spaces in its path.
This revision was not accepted when it landed; it landed in state Needs Review.Mon, Oct 7, 6:24 PM
This revision was automatically updated to reflect the committed changes.