Help compiling nglib onWin

Having trouble installing or compiling FreeCAD? Get help here.
peterl94
Posts: 662
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Help compiling nglib onWin

Postby peterl94 » Sun Aug 28, 2016 12:42 pm

'netgen::OCCGenerateMesh' : redefinition; different linkage

Must mean it is declared differently in nglib and FreeCAD (occgeom.hpp and NETGENPlugin_Mesher.cpp)

In this case, I would apply my changes to occgeom.hpp in addition to wmayer's. (At least export the OCCGenerateMesh function, I don't remember if exporting the OCCGeometry class is necessary.)

Code: Select all

--- netgen-5.1/libsrc/occ/occgeom.hpp   Tue Jun 25 04:28:59 2013
+++ netgen-5.1_new/libsrc/occ/occgeom.hpp   Fri Jul 11 00:38:32 2014
@@ -189,7 +189,7 @@
 
 
 
-   class OCCGeometry : public NetgenGeometry
+   class DLL_HEADER OCCGeometry : public NetgenGeometry
    {
       Point<3> center;
 
@@ -435,7 +435,7 @@
    // Philippose - 31.09.2009
    // External access to the mesh generation functions within the OCC
    // subsystem (Not sure if this is the best way to implement this....!!)
-   extern int OCCGenerateMesh (OCCGeometry & occgeometry, Mesh*& mesh,
+   DLL_HEADER extern int OCCGenerateMesh (OCCGeometry & occgeometry, Mesh*& mesh,
                 MeshingParameters & mparam,
                 int perfstepsstart, int perfstepsend);
 


Keep in mind I was patching for an older version of smesh. Is smesh7 the version that is included in the FreeCAD source now? I haven't kept track of what has been going on with that.
User avatar
sgrogan
Posts: 3061
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Postby sgrogan » Mon Aug 29, 2016 9:56 pm

peterl94 wrote:Keep in mind I was patching for an older version of smesh. Is smesh7 the version that is included in the FreeCAD source now? I haven't kept track of what has been going on with that.

Yes, SMESH 7.7.1 and OCCT 7.0
I chased the errors that look like they relate to your patch, and have individually applied the entire dllexport.diff in addition to wmayers changes and still have unresolved externals. I unfortunately was just hacking the downloaded snapshot. I'll reproduce on a git repo with commits and push the branch so at least we are looking at the same source.
User avatar
sgrogan
Posts: 3061
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Postby sgrogan » Wed Sep 28, 2016 11:55 pm

I'm stuck :(
@wmayer, can you post your patched netgen sources somewhere?
I've tried applying wmayer's patches to the bare netgen 5.1 code, with and without PeterL94's previous patches. I've tried vejmarie's netgen 5.3 fork, looo's 6.x fork. I can't succeed. I know NormandC is trying to bring OCCT7 support to Ubuntu. We'll need to recompile netgen against that, it would be good to use the same version for the 3 OS's.
Any help is greatly appreciated.
looo
Posts: 788
Joined: Mon Nov 11, 2013 5:29 pm

Re: Help compiling nglib onWin

Postby looo » Thu Sep 29, 2016 3:41 am

what was the problem with 6.? have you used cmake? which occ you use?
wmayer
Site Admin
Posts: 11357
Joined: Thu Feb 19, 2009 10:32 am

Re: Help compiling nglib onWin

Postby wmayer » Thu Sep 29, 2016 8:42 am

sgrogan wrote:@wmayer, can you post your patched netgen sources somewhere?

OK. I will prepare a patch.

looo wrote:what was the problem with 6.? have you used cmake? which occ you use?

Building netgen 6 on Windows is even more complicated. I quickly tried it and got tons of errors so I gave up immediately.
looo
Posts: 788
Joined: Mon Nov 11, 2013 5:29 pm

Re: Help compiling nglib onWin

Postby looo » Thu Sep 29, 2016 2:38 pm

There are many "windows conditionals" in the netgen cmake, so I thought compiling on windows is supported...
User avatar
sgrogan
Posts: 3061
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Postby sgrogan » Fri Sep 30, 2016 12:35 pm

wmayer wrote:OK. I will prepare a patch.

Thanks :)
looo wrote:what was the problem with 6.? have you used cmake? which occ you use?

I used your netgen branch cmake and OCCT 7.0.0
I'll reproduce this weekend and post the errors. There were not too many if IIRC.
User avatar
sgrogan
Posts: 3061
Joined: Wed Oct 22, 2014 5:02 pm

Re: Help compiling nglib onWin

Postby sgrogan » Sun Oct 02, 2016 1:05 pm

When compiling looo's netgen branch https://github.com/looooo/netgen, linking against current 11.5.2 libpack, errors for just building the nglib project

Code: Select all

Error   6   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\chris\github\netgen\libsrc\general\mysimd.hpp   52   1   nglib
Error   7   error C2144: syntax error : 'int' should be preceded by ';'   c:\users\chris\github\netgen\libsrc\general\mysimd.hpp   167   1   nglib
Error   8   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\chris\github\netgen\libsrc\general\mysimd.hpp   167   1   nglib
Error   12   error C2487: 'Print' : member of dll interface class may not be declared with dll interface   c:\users\chris\github\netgen\libsrc\meshing\meshtype.hpp   1134   1   nglib
wmayer
Site Admin
Posts: 11357
Joined: Thu Feb 19, 2009 10:32 am

Re: Help compiling nglib onWin

Postby wmayer » Sun Oct 02, 2016 2:13 pm

Here is the patch.
Attachments
netgen.zip
(1.48 KiB) Downloaded 18 times
wmayer
Site Admin
Posts: 11357
Joined: Thu Feb 19, 2009 10:32 am

Re: Help compiling nglib onWin

Postby wmayer » Sun Oct 02, 2016 2:41 pm

This explains the failures with it: http://stackoverflow.com/questions/2026 ... -in-vc2013
msvc 2013 does not support constexpr which came with C++11.