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

Re: Upgrade nightmare with FreeCAD

Postby federico.carminati » Sat Mar 24, 2018 3:01 pm

Thanks, retrying with this one...
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 3:21 pm

With this cmake command

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' -DCMAKE_INSTALL_PREFIX=/Applications -DBUILD_JTREADER=ON -DBUILD_SANDBOX=ON -DBUILD_TEMPLATE=ON -DFREECAD_USE_FREETYPE=OFF -DMpidotH=/usr/local/include/mpi.h -DBUILD_ENABLE_CXX_STD=C++14 -DCMAKE_CXX_FLAGS="-DNETGEN_V5 -std=gnu++14" ../FreeCAD-git/

I got rid of the problems of compatibility in netgen. However I cannot get rid of -std=gnu++11 and apparently I do not manage to override it. I do not know how it is brought in

[...l/FreeCAD/FreeCAD-git] grep -R gnu++11 .
./vagrant/FreeCAD.sh:./configure --prefix=/opt/local/FreeCAD-0.17 --with-tcl=/usr/lib/tcl8.5 --with-tk=/usr/lib/tk8.5 --enable-occ --with-occ=/opt/local/FreeCAD-0.17 --enable-shared --enable-nglib CXXFLAGS="-DNGLIB_EXPORTS -std=gnu++11"
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 » Sun Mar 25, 2018 8:51 am

OK,
I did some more digging. FreeCAD has its own FindNETGEN.cmake. Netgen has disappeared from brew, and installing the latest version of netgen creates a NetGen.app and not a set of libraries in /usr/local. So FindNETGEN.cmake does not work. If I use the NetgenConfig.cmake that comes with Netgen, some of the macros on which FreeCAD code relies are not set and then compilation fails. Any idea on how to tackle this? Thanks
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 » Mon Mar 26, 2018 8:10 am

OK,
I finally managed to compile FreeCAD with the latest NetGen and the latest opencascade. Here is the tricks I had to play

ln -sf /Applications/Netgen.app/Contents/Resources/include/* /usr/local/include/
ln -sf /Applications/Netgen.app/Contents/Resources/include/include /usr/local/include/netgen/csg
ln -sf /Applications/Netgen.app/Contents/MacOS/*.so /usr/local/lib
ln -sf /Applications/Netgen.app/Contents/MacOS/*.dylib /usr/local/lib

and after the cmake step

for i in `grep -Rl gnu++11 .` ; do sed -e 's/++11/++14/g' < $i > /tmp/junk ; mv /tmp/junk $i ; done

A smarter way would be to update the /usr/local/FreeCAD/FreeCAD-git/cMake/FindNETGEN.cmake to cope with the /Applications installation of netgen and find out who is injecting -std=gnu++11 in the compilation of the mesher. Any comment is welcome. Best regards,
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 31, 2018 9:31 am

Hello
apparently the latest pull of FreeCAD master has broken the installation I have the following error

CMake Error at src/MacAppBundle/cmake_install.cmake:69 (file):
file INSTALL cannot find
"/usr/local/FreeCAD/FreeCAD-git/src/MacAppBundle/import site".
Call Stack (most recent call first):
src/cmake_install.cmake:47 (include)
cmake_install.cmake:62 (include)

Any help?? Thanks
Federico Carminati
Switzerland/Suisse
User avatar
Kunda1
Posts: 7990
Joined: Thu Jan 05, 2017 9:03 pm

Re: Upgrade nightmare with FreeCAD

Postby Kunda1 » Sat Mar 31, 2018 6:07 pm

federico.carminati wrote:
Sat Mar 31, 2018 9:31 am
Hello
apparently the latest pull of FreeCAD master has broken the installation I have the following error

CMake Error at src/MacAppBundle/cmake_install.cmake:69 (file):
file INSTALL cannot find
"/usr/local/FreeCAD/FreeCAD-git/src/MacAppBundle/import site".
Call Stack (most recent call first):
src/cmake_install.cmake:47 (include)
cmake_install.cmake:62 (include)

Any help?? Thanks
peterl94 wrote:ping
Care to weigh in ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
peterl94
Posts: 1001
Joined: Thu May 23, 2013 7:31 pm
Location: United States

Re: Upgrade nightmare with FreeCAD

Postby peterl94 » Sun Apr 01, 2018 5:58 pm

Well, I've recently created bottles for the formulas in the freecad tap so you shouldn't need to compile nglib. Everything should work out of the box, so at this point I would recommend starting over. It would be best to just uninstall everything, but if you don't want to do that I would uninstall the following.

Code: Select all

boost, opencascade, nglib, pyside2, shiboken2, coin, qt@5.6
Then run brew install --only-dependencies freecad

qtwebkit is now provided as a separate package, so you have to add it to the cmake prefix path.

Code: Select all

-DCMAKE_PREFIX_PATH='/usr/local/opt/qt/lib/cmake;/usr/local/opt/qtwebkit/lib/cmake'
Also, be sure to delete the contents of your existing build folder or create a new folder after installing the new dependencies.
User avatar
federico.carminati
Posts: 49
Joined: Thu May 18, 2017 1:01 pm

Re: Upgrade nightmare with FreeCAD

Postby federico.carminati » Sun Apr 01, 2018 8:14 pm

Thanks For your answer. i have followed your instructions but compilation fails with

In file included from /usr/local/FreeCAD/FreeCAD-git/src/3rdParty/salomesmesh/src/NETGENPlugin/NETGENPlugin_Mesher.cpp:80:
In file included from /usr/local/include/netgen/occ/occgeom.hpp:12:
In file included from /usr/local/include/netgen/meshing/meshing.hpp:7:
In file included from /usr/local/include/netgen/meshing/../include/gprim.hpp:1:
/usr/local/include/netgen/meshing/../include/../gprim/gprim.hpp:11:10: fatal error: 'myadt.hpp' file not found
#include <myadt.hpp>
^~~~~~~~~~~
1 error generated.

[/usr/local] brew install --only-dependencies freecad
==> Installing freecad from freecad/freecad
All dependencies for freecad/freecad/freecad are satisfied.

[/usr/local] find /usr/local/ -name myadt.hpp
/usr/local//Cellar/nglib/5.3.1_1/include/netgen/general/myadt.hpp
/usr/local//Cellar/nglib/5.3.1_1/include/netgen/include/myadt.hpp
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 » Sun Apr 01, 2018 8:41 pm

Sorry, I had some old crap around. However I still have to run the following line

for i in `grep -Rl gnu++11 .` ; do sed -e 's/++11/++14/g' < $i > /tmp/junk ; mv /tmp/junk $i ; done

otherwise compilation fails. Also installation fails with the following error

CMake Error at src/MacAppBundle/cmake_install.cmake:69 (file):
file INSTALL cannot find
"/usr/local/FreeCAD/FreeCAD-git/src/MacAppBundle/import site".
Call Stack (most recent call first):
src/cmake_install.cmake:47 (include)
cmake_install.cmake:62 (include)

The line incriminated is

file(INSTALL DESTINATION "/Applications/FreeCAD.app/Contents/libexec/import site site.addsitedir('/usr/local/Cellar/protobuf/3.5.1_1/libexec/lib/python2.7/site-packages')/lib/python2.7')" TYPE DIRECTORY FILES
"/usr/local/FreeCAD/FreeCAD-git/src/MacAppBundle/import site"
"/usr/local/FreeCAD/FreeCAD-git/src/MacAppBundle/ site.addsitedir('/usr/local/Cellar/protobuf/3.5.1_1/libexec/lib/python2.7/site-packages')"
)

If I just comment it, installation succeeds
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 » Mon Apr 02, 2018 6:34 am

But it still fails with

[...r/local/FreeCAD/build] lldb -c /cores/core.4030
(lldb) target create --core "/cores/core.4030"
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in <module>
import weakref
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in <module>
from _weakref import (
ImportError: cannot import name _remove_dead_weakref
Core file '/cores/core.4030' (x86_64) was loaded.
Federico Carminati
Switzerland/Suisse