Compile ElmerGUI under Windows 10 with VS
Compile ElmerGUI under Windows 10 with VS
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
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
Last edited by ceanwang on 22 Mar 2021, 03:24, edited 1 time in total.
-
- Site Admin
- Posts: 4838
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Compile ElmerGUI under Windows 10
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):
For some scripts see:
https://www.nic.funet.fi/pub/sci/physic ... s/scripts/
-Peter
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
https://www.nic.funet.fi/pub/sci/physic ... s/scripts/
-Peter
Re: Compile ElmerGUI under Windows 10
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;
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
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.
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
Code: Select all
cdstat = chdir(directoryname);
Code: Select all
cdstat = _chdir(directoryname);
Last edited by ceanwang on 29 Mar 2021, 05:18, edited 4 times in total.
Re: Compile ElmerGUI under Windows 10 with VS
https://github.com/ElmerCSC/elmerfem/bl ... ve.cpp#L31
The first #include <unistd.h> should be deleted, because there is the second inside the #if HAVE_UNISTD_H ...#endif
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
Re: Compile ElmerGUI under Windows 10 with VS
https://github.com/ElmerCSC/elmerfem/bl ... cpp#L10114
These two functions need a return int value.
Code: Select all
int DestroyInverseTopology(struct FemType *data,int info)
{
DestroyCRSMatrix( &data->invtopo );
}
int DestroyDualGraph(struct FemType *data,int info)
{
DestroyCRSMatrix( &data->dualgraph );
}
-
- Site Admin
- Posts: 4838
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Compile ElmerGUI under Windows 10 with VS
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
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
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.
-
- Posts: 2355
- Joined: 25 Jan 2019, 01:28
- Antispam: Yes
Re: Compile ElmerGUI under Windows 10 with VS
According to the documentation you have to have at least QT5.4 version.
-
- Site Admin
- Posts: 4838
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Compile ElmerGUI under Windows 10 with VS
HI, Maybe you could drop "VTK" if that is problematic. Most people use Paraview anyways. -Peter