Page 1 of 2
Compile ElmerGUI under Windows 10 with VS
Posted: 20 Mar 2021, 02:31
by ceanwang
Hi,
From the README I know it is compiled with Qt4 + Vtk5. I was trying to compile it with Qt5.
3rd party libs are a challenge under Windows, but FreeCAD has a pre-compiled lib include Qt5, VTK 8.2 and even Open Cascade. So link to it maybe a little easy.
One thing I run into using Qt5 is that QtScript is dropped and ElmerGUI needs it.
Regards,
Cean
Re: Compile ElmerGUI under Windows 10
Posted: 20 Mar 2021, 02:48
by raback
Hi
Qt5 with Windows is possible. The installer is compiled under msys2 with the following shopping list (I'm not absolutely sure it is complete or fully necessary):
Code: Select all
pacman -Sy
pacman --needed -S bash pacman pacman-mirrors msys2-runtime
pacman -S git
pacman -S make mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-gcc-fortran
pacman -S mingw-w64-x86_64-openblas
pacman -S mingw-w64-x86_64-nsis
pacman -S mingw-w64-x86_64-qt5
pacman -S mingw-w64-x86_64-qwt-qt5
pacman -S mingw-w64-x86_64-msmpi
pacman -S mingw-w64-x86_64-oce
pacman -S mingw-w64-x86_64-vtk
pacman -S mingw-w64-x86_64-lapack
For some scripts see:
https://www.nic.funet.fi/pub/sci/physic ... s/scripts/
-Peter
Re: Compile ElmerGUI under Windows 10
Posted: 21 Mar 2021, 08:37
by ceanwang
FreeCADLibs is compiled with ms-vs.
I haven't found QtScript in its 12.1.4 version, So downloaded its newest 12.5.1 version which I found QtScript.
After successfully built one Qt program, I tried to build ElmerGUI. I got ng.lib for netgen, but haven't got ElmerGui.exe.
Some errors:
3>D:\bj\bjQT5\ElmerGUI\Application\plugins\egmesh.cpp(2571): error C2065: 'M_PI': undeclared identifier
3>D:\bj\bjQT5\ElmerGUI\Application\plugins\egmesh.cpp(2577): error C2668: 'abs': ambiguous call to overloaded function
3>D:\bj\bjQT5\ElmerGUI\Application\plugins\egmesh.cpp(6561): error C2065: 'M_PI': undeclared identifier
3>D:\bj\bjQT5\ElmerGUI\Application\plugins\egmesh.cpp(6704): error C2065: 'M_PI': undeclared identifier
3>D:\bj\bjQT5\ElmerGUI\Application\plugins\egnative.cpp(31): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
3>d:\bj\bjqt5\elmergui\application\src\glwidget.h(222): error C2143: syntax error: missing ';' before '*'
3>d:\bj\bjqt5\elmergui\application\src\glwidget.h(222): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
3>d:\bj\bjqt5\elmergui\application\src\glwidget.h(222): error C2238: unexpected token(s) preceding ';'
Is the 'M_PI' a typo? FM_PI is used in other places without error.
like: degs = FM_PI/180.0;
Re: Compile ElmerGUI under Windows 10
Posted: 21 Mar 2021, 08:53
by ceanwang
Here is a talk about a-replacement-for-unistd-h-for-windows-visual-c
https://stackoverflow.com/questions/341 ... s-visual-c
It says for Windows, could just use:
#include <io.h>
to replace #include <unistd.h>
Since chdir is declared in unistd.h, this line in egnative.cpp
also need to be changed as:
and it is defined in <direct.h> for Windows.
Re: Compile ElmerGUI under Windows 10 with VS
Posted: 29 Mar 2021, 04:51
by ceanwang
https://github.com/ElmerCSC/elmerfem/bl ... ve.cpp#L31
Code: Select all
#include <stdio.h>
#include <unistd.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
The first #include <unistd.h> should be deleted, because there is the second inside the #if HAVE_UNISTD_H ...#endif
Re: Compile ElmerGUI under Windows 10 with VS
Posted: 29 Mar 2021, 06:04
by ceanwang
https://github.com/ElmerCSC/elmerfem/bl ... cpp#L10114
Code: Select all
int DestroyInverseTopology(struct FemType *data,int info)
{
DestroyCRSMatrix( &data->invtopo );
}
int DestroyDualGraph(struct FemType *data,int info)
{
DestroyCRSMatrix( &data->dualgraph );
}
These two functions need a return int value.
Re: Compile ElmerGUI under Windows 10 with VS
Posted: 29 Mar 2021, 19:01
by raback
Hi
Thanx for the fixes. Visual Studio has not the easiest platform. I implemented these changes to "VCchanges" branch. Maybe you can continue testing there...
-Peter
Re: Compile ElmerGUI under Windows 10 with VS
Posted: 30 Mar 2021, 02:22
by ceanwang
QVTKOpenGLNativeWidget.h from VTK package is needed, it is in VTK-8.2.0\GUISupport\Qt, but seems FreeCADLib doesn't include it. I have to build VTK by myself.
Re: Compile ElmerGUI under Windows 10 with VS
Posted: 30 Mar 2021, 12:17
by kevinarden
According to the documentation you have to have at least QT5.4 version.
Re: Compile ElmerGUI under Windows 10 with VS
Posted: 30 Mar 2021, 16:39
by raback
HI, Maybe you could drop "VTK" if that is problematic. Most people use Paraview anyways. -Peter