alternative CMake build environment

richti83's picture
Submitted by richti83 on Thu, 09/13/2018 - 13:41

As some people having difficulties to build LIGGGHTS(R) with windows I'm releasing an alternative CMake file to configure and build LIGGGHTS(R) on any platform.
Preliminary steps
I suggest at least MS VisualStudio 14 (2015) as it comes with erf.h and some other necessary headers.
I'm using MPICH2 for multiprozessing (http://www.mpich.org/static/downloads/1.4.1p1/mpich2-1.4.1p1-win-x86-64.msi) , MS MPI is not tested but should work too.
optional download and install vtk 8.0.1 (http://www.vtk.org/files/release/8.0/VTK-8.0.1.zip), configure with following flags:

cmake -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=../install -DModule_vtkIOMPIParallel:BOOL=ON -DVTK_Group_MPI:BOOL=ON -DVTK_Group_Rendering:BOOL=OFF -DVTK_RENDERING_BACKEND:STRING=None -DVTK_USE_X:BOOL=OFF -DModule_vtkIOMPIImage:BOOL=ON -DModule_vtkParallelMPI:BOOL=ON -G "Visual Studio 14 2015 Win64" ..\

open project, change to release build and than build the solution.

main steps
Download LIGGGHTS-PUBLIC-master: https://codeload.github.com/CFDEMproject/LIGGGHTS-PUBLIC/zip/master
Download attached cmake files, extract the archive in LIGGGHTS-PUBLIC/src/, overwrite existing CMakeLists.txt
I recommend using CMAKE>=3.7.1, using cmake-gui, point "Where is the source code" to LIGGGHTS-PUBLIC/src/, "Where to build binaries" to "/LIGGGHTS-PUBLIC/src/build", say yes to create the build folder.
Hit configure, select Generator of your choice (VS 14 2015 Win64).
Enable contact models by your choice.
Optinal enable vtk and point to vtk/build/ folder of preliminary step.
Hit configure again.
Check if mpi_library and mpi_extra_library is set correctly.
Hit Generate
Open Project, change to Release, build project
When all is ok you'll get an liggghts.exe in LIGGGHTS-PUBLIC\src\build\Release\

good luck,
Christian.

note: to enable SQ you need boost and you have to patch math_extra_liggghts_superquadric.cpp see https://www.cfdem.com/forums/some-notes-v-380

AttachmentSize
Plain text icon cmake_patch.zip_.txt8.76 KB

amir.mbi | Sun, 02/10/2019 - 09:53

Thank you very much for preparing this manuscript. I could correctly install LIGGGHTS on windows 10 with MS MPI and VTK .

Can this method use with future version of LIGGGHTS ?

richti83's picture

richti83 | Tue, 02/12/2019 - 10:14

Can this method use with future version of LIGGGHTS ?
I don't know as I have no insight in future development of the code.

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact

Mohamed123 | Fri, 02/12/2021 - 08:21

Hi Christina

Can you please help me? I followed the steps but failed to get the .exe file.

amir.mbi | Mon, 09/16/2019 - 17:14

If you use windows 10, you can install Windows Subsystem for Linux from this link:
https://docs.microsoft.com/en-us/windows/wsl/install-win10

after that you can install ubuntu terminal in your windows from windows 10 store.

then by running ubunutu terminal, the LIGGGHTS can be installed with the code as follows:

sudo apt-get install liggghts

WassDh | Wed, 10/30/2019 - 04:54

I am trying to Install LIGGGHTS on windows 10 following this method but without much success.

I followed the instructions step-by-step (no SuperQuadratic option), I used VS 2019 , MPICH2 and VTK 7.1.1with the configurations mentioned by richti83, I also added the provided Cmake files. The error I get is when I build the ALL_BUILD with VS - I receive :

-Error C1128 number of sections exceeded object file format limit: compile with /bigobj liggghts C:\LIGGGHTS380-CMAKE\CMAKE-BUILD_SYSTEM\LIGGGHTS-PUBLIC\src\contact_models.h 158
(And when I build it again it says Error C1128 number of sections exceeded object file format limit: compile with /bigobj liggghts C:\LIGGGHTS380-CMAKE\CMAKE-BUILD_SYSTEM\LIGGGHTS-PUBLIC\src\fix_wall_gran_base.h 369)

-Error D8040 error creating or communicating with child process liggghts C:\LIGGGHTS380-CMAKE\CMAKE-BUILD_SYSTEM\LIGGGHTS-PUBLIC\src\build2\cl 1

I am new to all this and have no idea how I can solve this issue. Any help would much be appreciated.

Thank You,
Wass

richti83's picture

richti83 | Thu, 10/31/2019 - 20:09

did you enable a lot of contact-model combinations ? I guess adding /bigobj to the compiler or linker flags as stated in the error message should work.
I can not test VS>2015 bc. I've no access to Dreamspark / M$ Imagine.

I'm not an associate of DCS GmbH and not a core developer of LIGGGHTS®
ResearchGate | Contact

Khizra | Thu, 08/12/2021 - 04:34

I am getting errors with this method.
Everything worked fine but .exe file is not build or .exe file is not working. As soon as I write any script in liggghts.exe file, the file(command prompt) shuts down.

Secondly, I am using Visual Studio 2019 and getting the following error when release the build solution.

Severity: Error
Code: MSB8066
Description: Custom build for 'C:\Users\khizr\Downloads\August 2021\LIGGGHTS-PUBLIC-master\src\Build\CMakeFiles\f37b7b46c930c2314673d086069f1dfb\VERSION_H.rule;C:\Users\khizr\Downloads\August 2021\LIGGGHTS-PUBLIC-master\src\CMakeLists.txt' exited with code 1.
Project: VERSION_H
File: Microsoft.CppCommon.targets
Line :241

Please help me to solve this issue.
Thanks

mschramm | Thu, 08/12/2021 - 17:41

In the presented cmake command:
cmake -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=../install -DModule_vtkIOMPIParallel:BOOL=ON -DVTK_Group_MPI:BOOL=ON -DVTK_Group_Rendering:BOOL=OFF -DVTK_RENDERING_BACKEND:STRING=None -DVTK_USE_X:BOOL=OFF -DModule_vtkIOMPIImage:BOOL=ON -DModule_vtkParallelMPI:BOOL=ON -G "Visual Studio 14 2015 Win64" ..\

Did you change the entry "Visual Studio 14 2015 Win64" to hold the value of VS2019?

Khizra | Thu, 08/12/2021 - 20:08

THANK YOU SO MUCH FOR YOUR RESPONSE.

How to configure using this flag?
cmake -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=../install -DModule_vtkIOMPIParallel:BOOL=ON -DVTK_Group_MPI:BOOL=ON -DVTK_Group_Rendering:BOOL=OFF -DVTK_RENDERING_BACKEND:STRING=None -DVTK_USE_X:BOOL=OFF -DModule_vtkIOMPIImage:BOOL=ON -DModule_vtkParallelMPI:BOOL=ON -G "Visual Studio 14 2015 Win64" ..\

I am using cmake-gui to configure and generate. and selecting the generator as VS 16 2019.

Where can I edit this cmake command? (cmake -DBUILD_TESTING:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX=../install -DModule_vtkIOMPIParallel:BOOL=ON -DVTK_Group_MPI:BOOL=ON -DVTK_Group_Rendering:BOOL=OFF -DVTK_RENDERING_BACKEND:STRING=None -DVTK_USE_X:BOOL=OFF -DModule_vtkIOMPIImage:BOOL=ON -DModule_vtkParallelMPI:BOOL=ON -G "Visual Studio 14 2015 Win64" ..\)

Since VTK is optional, can I skip downloading and installing VTK?

Please guide.

Sharkeyani275 | Fri, 08/13/2021 - 16:09

Hello,
I am following these installation steps (from Christian's post) as above. Until the project was generated in cmake, there were no issues.
Now, after generating the project, when I [Open Project] > [Release] > [Build Solution] in VS 2019, I am getting following 2 errors.
1-
Severity: Error
Code: MSB8066
Description: Custom build for 'C:\LIGGGHTS-PUBLIC\src\build\CMakeFiles\2e580a0b6dc5af2a5aaf83b3a2dadbaa\VERSION_H.rule;C:\LIGGGHTS-PUBLIC\src\CMakeLists.txt' exited with code 1.
Project: VERSION_H
File: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets
Line: 241

2-
Severity: Error
Code: C1083
Description: Cannot open include file: 'version_liggghts.h': No such file or directory
Project: liggghts
File: C:\LIGGGHTS-PUBLIC\src\universe.cpp
Line: 58

Please can anyone support me in troubleshooting this issue?
Thanks in advance for your time and help.

Tom_Coutinho | Thu, 09/02/2021 - 21:27

I have the same problems compiling Liggghts for windows following the alternate steps given in the forum. I'm using VS 2019.

the following errors appear
Description Output:

1> Compatibility with CMake < 2.8.12 will be removed from a future version of
1> CMake.
1>
1> Update the VERSION argument value or use a ... suffix to tell
1> CMake that the project does not need compatibility with older versions.
1>
1>
1>CMake Error at version.cmake:8 (Include):
1> Include could not find requested file:
1>
1> Macros
1>
1>
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'D:\Programas FAM\Liggghts\LIGGGHTS-PUBLIC-master\src\build\CMakeFiles\663e680f7fddd3d3c5cf9c343aa40acd\VERSION_H.rule' exited with code 1.
1>Done building project "VERSION_H.vcxproj" -- FAILED.

Error List:
Severity Code Description Project File Line Suppression State
Error MSB8066 Custom build for 'D:\Programas FAM\Liggghts\LIGGGHTS-PUBLIC-master\src\build\CMakeFiles\663e680f7fddd3d3c5cf9c343aa40acd\VERSION_H.rule' exited with code 1. VERSION_H C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets 241

I appreciate the help