Upgrade nightmare with FreeCAD

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
federico.carminati
Posts: 49
Joined: Thu May 18, 2017 1:01 pm

Upgrade nightmare with FreeCAD

Postby federico.carminati » Fri Mar 23, 2018 8:46 pm

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
Posts: 7992
Joined: Thu Jan 05, 2017 9:03 pm

Re: Upgrade nightmare with FreeCAD

Postby Kunda1 » Fri Mar 23, 2018 9:13 pm

What are the errors you're seeing ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
federico.carminati
Posts: 49
Joined: Thu May 18, 2017 1:01 pm

Re: Upgrade nightmare with FreeCAD

Postby federico.carminati » Sat Mar 24, 2018 9:17 am

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
Switzerland/Suisse
wmayer
Site Admin
Posts: 16300
Joined: Thu Feb 19, 2009 10:32 am

Re: Upgrade nightmare with FreeCAD

Postby wmayer » Sat Mar 24, 2018 10:31 am

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: 49
Joined: Thu May 18, 2017 1:01 pm

Re: Upgrade nightmare with FreeCAD

Postby federico.carminati » Sat Mar 24, 2018 1:50 pm

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
Switzerland/Suisse
wmayer
Site Admin
Posts: 16300
Joined: Thu Feb 19, 2009 10:32 am

Re: Upgrade nightmare with FreeCAD

Postby wmayer » Sat Mar 24, 2018 2:18 pm

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

Re: Upgrade nightmare with FreeCAD

Postby federico.carminati » Sat Mar 24, 2018 2:22 pm

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
Switzerland/Suisse
User avatar
federico.carminati
Posts: 49
Joined: Thu May 18, 2017 1:01 pm

Re: Upgrade nightmare with FreeCAD

Postby federico.carminati » Sat Mar 24, 2018 2:35 pm

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
Switzerland/Suisse
User avatar
federico.carminati
Posts: 49
Joined: Thu May 18, 2017 1:01 pm

Re: Upgrade nightmare with FreeCAD

Postby federico.carminati » Sat Mar 24, 2018 2:48 pm

Possibly a backward incompatible change

/usr/local/netgen/libsrc/meshing/meshclass.hpp: DLL_HEADER void CalcLocalH (double grading);
Federico Carminati
Switzerland/Suisse
User avatar
kkremitzki
Posts: 2108
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Upgrade nightmare with FreeCAD

Postby kkremitzki » Sat Mar 24, 2018 2:54 pm

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.