KratosMultiphysics / GiDInterface

The graphical user interface of Kratos for GiD. Featuring CFD, CSM, DEM, PFEM, etc
Other
32 stars 16 forks source link

GiD-Kratos Compilation issue #883

Closed jauharr closed 1 year ago

jauharr commented 2 years ago

When following the guidelines for windows, I am facing the issues of

Why it opts for the Windows10.0.25174 SDK? Visual Studio 17 doesn't support that... --Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.25174.

MSBUILD : error MSB1009: Project file does not exist. Switch: install.vcxproj

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - no

roigcarlo commented 2 years ago

Hi @jauharr

Could you provide more details on the system you are trying to compile Kratos? Do you have more than one version of VS installed?

If so, you need to tell CMake which confogurator to use with the -G option, and execute the configuration script from a cmd with the proper defines set (normally VS installs a shortcut that sets all the variables correctly)

Otherwise versions may be in conflict.

jauharr commented 2 years ago

Thankyou for your reply. I have the single version of VS 17. I had some traces of VS 2015. I think those were not the issue. I have been trying to build multiple applications at the same time including linear solver application and structural mechanics application. However, the selecting only linear solver and structural mechanics did work. The error might have originated from one of the applications that I was trying to build. I am using developer version of Windows 11.

roigcarlo commented 2 years ago

Hi @jauharr

If you send me the list of the apps you were trying to compile I can check if is there something wrong on our side.

jauharr commented 2 years ago

The list of applications is as follows: Linear Solvers Structural Mechanics Fluid Dynamics Delaunay Meshing DEM Fem To DEM Pfem Fluid Dynamics

roigcarlo commented 2 years ago

Oh, I see.

I am not 100& sure, but most likely the problem is because of the DelaunayMeshingApplication. This application will attempt to download a dependency directly in the configuration stage and if it fails to store it for any reason (download went wrong, no write permissions, etc...) it prevents the project file from being generated.

In any case, an error should appear on screen, if you can take a screen that would be very helpfull.

My guess is that the problem will be with the folder permissions. We don't recommend this, but if after allowing write permissions still does not work, you can manually download it from https://github.com/PFEM/tetgen-1.5.0/archive/kratos.zip, and put it inside this folder: applications/DelaunayMeshingApplication/external_libraries/tetgen-1.5.0-kratos.zip.

jauharr commented 2 years ago

I am fairly new to this development. However, the error has been reproduced. I shared the output of PowerShell in the txt file in the attachment. powershellout.txt

roigcarlo commented 2 years ago

Ok, the error part is this:

  INCLUDE_TRIANGLE not defined, neither USE_TRIANGLE_NONFREE_TPL=ON is
  defined.  The application DelaunayMeshingApplication will not compile

You need to include that flag in the configure.bat file. It should look something like this:

@echo on
cmake -G"Visual Studio 16 2019" -H"%KRATOS_SOURCE%" -B"%KRATOS_BUILD%\%KRATOS_BUILD_TYPE%"          ^
-DUSE_EIGEN_MKL=OFF        ^
-DUSE_TRIANGLE_NONFREE_TPL=ON   ^
-DCMAKE_CXX_FLAGS=" %KRATOS_PARALLEL_BUILD_FLAG% "
jauharr commented 2 years ago

I tried this solution however, the error is like this:

 INCLUDE_TRIANGLE not defined, neither USE_TRIANGLE_NONFREE_TPL=ON is
  defined.  The application DelaunayMeshingApplication will not compile
roigcarlo commented 2 years ago

mm can you share me the configuration file?

jauharr commented 2 years ago

Please check the attached file configure.txt

roigcarlo commented 2 years ago

There is a missing ^ at the end of line 52.

In the CMake flags section you have to make sure the line ends with a ^, which is the simbol for "continue line" in win bash.

Or you can put it all in the same line:

cmake -G"Visual Studio 17 2022" -H"%KRATOS_SOURCE%" -B"%KRATOS_BUILD%\%KRATOS_BUILD_TYPE%" -DUSE_EIGEN_MKL=OFF -DUSE_TRIANGLE_NON_FREE_TPL=ON -DCMAKE_CXX_FLAGS=" %KRATOS_PARALLEL_BUILD_FLAG% "
jauharr commented 2 years ago

I have added the symbol "^", and tried with single line as well. The error persists. According to CMakeError.log the system cannot find the "pthread.lib".
image

roigcarlo commented 2 years ago

Ok, let me check some things, pthreads should not be used in win.

roigcarlo commented 2 years ago

Dear @jauharr after some investigation I can confirm you that the pthread problem is not an issue for Kratos. Is just cmake checking if the system have the library or not. I am obtaning the same CMake logs in our build machine.

could you resend me the powershell output?

jauharr commented 2 years ago

Thankyou for your time. The error still originates from the following.

  INCLUDE_TRIANGLE not defined, neither USE_TRIANGLE_NONFREE_TPL=ON is
  defined.  The application DelaunayMeshingApplication will not compile

I have included the script and PowerShell out put. configure.txt powershellout.txt

roigcarlo commented 2 years ago

Hi, Please try this one: configure.txt

jauharr commented 2 years ago

All the applications compiled this time.

jauharr commented 2 years ago

The compilation was rather fast this time. It didn't create bin/release directory. If that is the right compilation because in the video tutorial there is bin/release.

roigcarlo commented 2 years ago

Ups my bad, I send you a file with the compile command commented.

Just remove the @REM from lines 50, 51 and 52.

My apologies.

jauharr commented 2 years ago

Thankyou for all the help. I remove the @Rem and I was able to compile but there were not bin/release folder for .exe application created. If there is any change in configuration file still required?

jauharr commented 2 years ago

I am following this tutorial https://www.youtube.com/watch?v=zZq7ypDdudo

roigcarlo commented 2 years ago

Hi @jauharr, Process in the video is indeed the correct. If it did not create the bin folder it means something crashed during the compilation. I can help you if you tell me the exact error (should appear in the powershell while running the script, which should jump directle to the error if you have already runned it once)

jauharr commented 2 years ago

These are the errors I think

LINK : warning LNK4217: symbol '_snprintf' defined in 'gidpost.lib(gidpost.obj)' is imported by 'zlib.lib(gzlib.obj)' in function 'gz_error' [E:\KratOS\Kratos\build\Release\kratos\KratosCore.vcxproj]
zlib.lib(gzwrite.obj) : error LNK2019: unresolved external symbol __imp_vsnprintf referenced in function gzvprintf [E:\KratOS\Kratos\build\Release\kratos\KratosCore.vcxproj]
MSVCRT.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp_vsnprintf [E:\KratOS\Kratos\build\Release\kratos\KratosCore.vcxproj]
MSVCRT.lib(vsnprintf.obj) : error LNK2001: unresolved external symbol __imp__vsnprintf [E:\KratOS\Kratos\build\Release\kratos\KratosCore.vcxproj]
E:\KratOS\Kratos\build\Release\kratos\Release\KratosCore.dll : fatal error LNK1120: 2 unresolved externals [E:\KratOS\Kratos\build\Release\kratos\KratosCore.vcxproj]

I have uploaded the whole output here. powershellout2.txt

roigcarlo commented 2 years ago

Hi,

Try adding -DFORCE_LOCAL_ZLIB_COMPILATION = ON ^

It seems to be conflicting with the one installed by postgresql

jauharr commented 2 years ago

I added the command like this```

@echo on cmake -G"Visual Studio 17 2022" -H"%KRATOS_SOURCE%" -B"%KRATOS_BUILD%\%KRATOS_BUILD_TYPE%" ^ -DINCLUDE_FEAST=OFF ^ -DFORCE_LOCAL_ZLIB_COMPILATION = ON ^ -DUSE_TRIANGLE_NONFREE_TPL=ON

I am facing the error:

CMake Error: Parse error in command line argument: FORCE_LOCAL_ZLIB_COMPILATION Should be: VAR:type=value

roigcarlo commented 2 years ago

Hi, try without the spaces before and after the =

jauharr commented 2 years ago

I compiled the applications again and still no .exe application created. The following could be the error

E:\KratOS\Kratos\applications\FemToDemApplication\custom_strategies/residualbased_DEM_coupled_newton_raphson_strategy.h
(359,19): error C2039: 'mSolutionStepIsInitialized': is not a member of 'Kratos::ResidualBasedDEMCoupledNewtonRaphsonSt
rategy<SparseSpaceType,LocalSpaceType,LinearSolverType>' (compiling source file E:\KratOS\Kratos\applications\FemToDemA
pplication\custom_python\add_custom_strategies_to_python.cpp) [E:\KratOS\Kratos\build\Release\applications\FemToDemAppl
ication\KratosFemToDemApplication.vcxproj]
roigcarlo commented 2 years ago

@AlejandroCornejo Any idea, I am not familiar with that app :S