Upgrade nightmare with FreeCAD

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
federico.carminati
Posts: 66
Joined: Thu May 18, 2017 1:01 pm
Location: Geneva, Switzerland

Upgrade nightmare with FreeCAD

Post by federico.carminati »

Hello,
I am working on Mac OS X High Sierra and I regularly pull the master version from git. Then last week I have naively done a brew update/upgrade and hell has broken loose. Brew has updated boost to 1.66 and opencascade to 7.2 and the build of FreeCAD has broken, so I had to go back to boost 1.64 and opencascade 7.1.0_1. Has anybody else experienced this?

Best regards,
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Upgrade nightmare with FreeCAD

Post by Kunda1 »

What are the errors you're seeing ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
federico.carminati
Posts: 66
Joined: Thu May 18, 2017 1:01 pm
Location: Geneva, Switzerland

Re: Upgrade nightmare with FreeCAD

Post by federico.carminati »

As far as opencascade is concerned, the situation is the following. nglib/netgen has the following three undefined references

/usr/local/lib/libocc.dylib: U StlAPI_Writer::Write(TopoDS_Shape const&, char const*)
/usr/local/lib/libocc.dylib: U StlAPI_Writer::ASCIIMode()
/usr/local/lib/libocc.dylib: U StlAPI_Writer::StlAPI_Writer()

In OPC 7.1.0 we have

/usr/local/Cellar/opencascade/7.1.0_1/lib/libTKSTL.7.1.0.dylib: 00000000000088f0 T StlAPI_Writer::Write(TopoDS_Shape const&, char const*)
/usr/local/Cellar/opencascade/7.1.0_1/lib/libTKSTL.7.1.0.dylib: 00000000000088e6 T StlAPI_Writer::ASCIIMode()
/usr/local/Cellar/opencascade/7.1.0_1/lib/libTKSTL.7.1.0.dylib: 00000000000088dc T StlAPI_Writer::StlAPI_Writer()
/usr/local/Cellar/opencascade/7.1.0_1/lib/libTKSTL.7.1.0.dylib: 0000000000008870 T StlAPI_Writer::StlAPI_Writer()

While in OPC 7.2.0 we have

/usr/local/Cellar/opencascade/7.2.0/lib/libTKSTL.7.2.0.dylib: 0000000000006734 T StlAPI_Writer::Write(TopoDS_Shape const&, char const*)
/usr/local/Cellar/opencascade/7.2.0/lib/libTKSTL.7.2.0.dylib: 000000000000672a T StlAPI_Writer::StlAPI_Writer()
/usr/local/Cellar/opencascade/7.2.0/lib/libTKSTL.7.2.0.dylib: 0000000000006720 T StlAPI_Writer::StlAPI_Writer()

So the StlAPI_Writer::ASCIIMode() is undefined when I switch to 7.2. The code is still there, but if I understand correctly, the method went from an exported reference to an internal one in the dylib

/usr/local/Cellar/opencascade/7.1.0_1/include/opencascade/StlAPI_Writer.hxx
//! default parameters: ASCIIMode.
Standard_EXPORT Standard_Boolean& ASCIIMode();
Standard_Boolean theASCIIMode;
/usr/local/Cellar/opencascade/7.2.0/include/opencascade/StlAPI_Writer.hxx
//! Creates a writer object with default parameters: ASCIIMode.
Standard_Boolean& ASCIIMode() { return myASCIIMode; }
Standard_Boolean myASCIIMode;
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Upgrade nightmare with FreeCAD

Post by wmayer »

As far as opencascade is concerned, the situation is the following. nglib/netgen has the following three undefined references
Did you also rebuild nglib(netgen to link against OCCT 7.2? It's correct that the mentioned methods still exist in the new version but all other methods have been removed and also except theASCIIMode all other member variables disappeared. This means that version 7.1 and 7.2 are not binary compatible and any library using OCCT must be re-rebuilt.

So, this means nglib/netgen must re-built and FreeCAD.
User avatar
federico.carminati
Posts: 66
Joined: Thu May 18, 2017 1:01 pm
Location: Geneva, Switzerland

Re: Upgrade nightmare with FreeCAD

Post by federico.carminati »

The nightmare continues...

nglib/netlib is not in brew any longer, so brew refuses to recompile. I tried to uninstall, but the formula is gone from brew, and I cannot reinstall it. So I dowloaded the code from github, and this produced an Application. Inside the application there is a cmake file

[...r/local/FreeCAD/build] ls /Applications/Netgen.app/Contents/Resources/CMake/
NetgenConfig.cmake netgen-targets-relwithdebinfo.cmake netgen-targets.cmake


my cmake command to FreeCAD now looks like

cd .. ; rm -rf build ; mkdir build; cd build ; cmake -DBUILD_QT5=1 -DFREECAD_USE_EXTERNAL_KDL=1 -DBUILD_FEM_NETGEN=1 -DFREECAD_CREATE_MAC_APP=1 -DCMAKE_BUILD_TYPE="Release" -DCMAKE_PREFIX_PATH='/usr/local/Cellar/qt@5.6/5.6.2;/Applications/Netgen.app//Contents/Resources/CMake' -DCMAKE_INSTALL_PREFIX=/Applications -DBUILD_JTREADER=ON -DBUILD_SANDBOX=ON -DBUILD_TEMPLATE=ON -DFREECAD_USE_FREETYPE=OFF -DMpidotH=/usr/local/include/mpi.h ../FreeCAD-git/

Unfortunately the NetgenConfig.cmake seems to be incompatible with the FreeCAD one

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
NGLIB_INCLUDE_DIR
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh
used as include directory in directory /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh

So now I have lost the ability to build FreeCAD at all. Best,
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Upgrade nightmare with FreeCAD

Post by wmayer »

Where did you get the netgen sources from?
User avatar
federico.carminati
Posts: 66
Joined: Thu May 18, 2017 1:01 pm
Location: Geneva, Switzerland

Re: Upgrade nightmare with FreeCAD

Post by federico.carminati »

From github

[/usr/local/netgen] git remote show origin
* remote origin
Fetch URL: https://github.com/live-clones/netgen.git
Push URL: https://github.com/live-clones/netgen.git
HEAD branch: master
Remote branches:
master tracked
netgen-4.9 tracked
netgen-5.1 tracked
netgen-5.2 tracked
netgen-5.3 tracked
netgen-6.0 tracked
netgen-6.1 tracked
update_pybind11 tracked
Local branch configured for 'git pull':
master rebases onto remote master
Local ref configured for 'git push':
master pushes to master (up to date)
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
User avatar
federico.carminati
Posts: 66
Joined: Thu May 18, 2017 1:01 pm
Location: Geneva, Switzerland

Re: Upgrade nightmare with FreeCAD

Post by federico.carminati »

A bit more information. With this mod the cmake goes to the end

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3ecfe23..fa41700 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -739,7 +739,7 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# -------------------------------- Netgen --------------------------------

if (BUILD_FEM_NETGEN)
- find_package(NETGEN)
+ find_package(NETGEN CONFIG)
endif(BUILD_FEM_NETGEN)

# -------------------------------- OpenCV --------------------------------

However compilation fails (at least) for

/usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp

since it requires C++14 standard. Even specifying

-DBUILD_ENABLE_CXX_STD=C++14

does not help since "someone" injects -std=gnu++11 in the compilation options. Doing the compilation by hand removing this option still dies with the error

/usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp:2908:29: error: too few arguments to function call, single argument 'grading' was not specified
_ngMesh->CalcLocalH();
~~~~~~~~~~~~~~~~~~~ ^
/usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp:3682:24: error: too few arguments to function call, single argument 'grading' was not specified
toMesh->CalcLocalH();
~~~~~~~~~~~~~~~~~~ ^
130 warnings and 2 errors generated.
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
User avatar
federico.carminati
Posts: 66
Joined: Thu May 18, 2017 1:01 pm
Location: Geneva, Switzerland

Re: Upgrade nightmare with FreeCAD

Post by federico.carminati »

Possibly a backward incompatible change

/usr/local/netgen/libsrc/meshing/meshclass.hpp: DLL_HEADER void CalcLocalH (double grading);
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
User avatar
kkremitzki
Veteran
Posts: 2509
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Upgrade nightmare with FreeCAD

Post by kkremitzki »

BTW https://github.com/NGSolve/netgen/tree/v6.2.1802 is the most recent release of netgen.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
Post Reply