Compile w/Py3 & Qt5 for Dummies

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Post by looo »

NormandC wrote: Sun Feb 10, 2019 11:39 pm Sorry, I didn't look into the package details. salome-smesh is the same of the source package, the binary packages are actually libsalome-smesh and libsalome-smesh-dev. Is the dev package necessary? I guess so.
sudo apt install libsalome-smesh-dev

will automatically install both packages.
Ah, thanks this works.
Any idea? That file is on my system, in /usr/include/smesh/SMESH_Gen.hxx
I have this variable in the conda-recipe:

-D SMESH_INCLUDE_DIR

NormandC wrote: Mon Feb 11, 2019 4:13 am I also tried to build with flatmesh and netgen and failed, and after a search found that both require pybind11 2.2, while Ubuntu 18.04 provides 2.0. Goody, I didn't remember that.
looo wrote: Sat Feb 09, 2019 9:29 am add ppa for pybind11:
https://launchpad.net/~nschloe/+archive ... -backports
User avatar
kkremitzki
Veteran
Posts: 2509
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Compile w/Py3 & Qt5 for Dummies

Post by kkremitzki »

I'm not sure, I recall running into problems using this package back when I packaged it but nobody else was using it so I didn't continue troubleshooting. Glad to see it's getting some attention now.
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.
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Post by looo »

With:

Code: Select all

cmake -D BUILD_QT5=ON \
      -D PYTHON_EXECUTABLE=/usr/bin/python3.6 \
      -D FREECAD_USE_PYBIND11:BOOL=ON \
      -D USE_BOOST_PYTHON:BOOL=OFF \
      -D BUILD_ENABLE_CXX11:BOOL=ON \
      -D BUILD_PLOT:BOOL=OFF \
      -D BUILD_SHIP:BOOL=OFF \
      -D FREECAD_USE_OCC_VARIANT="Official Version" \
      -D BUILD_FLAT_MESH:BOOL=ON \
      -D BUILD_FEM_NETGEN:BOOL=ON \
      -D ENABLE_MED:BOOL=OFF \
      -D FREECAD_USE_EXTERNAL_SMESH=ON \
      -D SMESH_INCLUDE_DIR=/usr/include/smesh \
      ..
I get some undefined reference errors:

Code: Select all

CMakeFiles/MeshPart.dir/Mesher.cpp.o: In Funktion »MeshPart::Mesher::createMesh() const«:
Mesher.cpp:(.text+0x1230): Warnung: undefinierter Verweis auf »SMESH_Gen::SMESH_Gen()«
Mesher.cpp:(.text+0x1264): Warnung: undefinierter Verweis auf »SMESH_Gen::CreateMesh(int, bool)«
Mesher.cpp:(.text+0x12cb): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis_2D::NETGENPlugin_Hypothesis_2D(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x130a): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis::SetFineness(NETGENPlugin_Hypothesis::Fineness)«
Mesher.cpp:(.text+0x134e): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis::SetGrowthRate(double)«
Mesher.cpp:(.text+0x138d): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis::SetNbSegPerEdge(double)«
Mesher.cpp:(.text+0x13cc): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis::SetNbSegPerRadius(double)«
Mesher.cpp:(.text+0x13eb): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis::SetQuadAllowed(bool)«
Mesher.cpp:(.text+0x140a): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis::SetOptimize(bool)«
Mesher.cpp:(.text+0x1429): Warnung: undefinierter Verweis auf »NETGENPlugin_Hypothesis::SetSecondOrder(bool)«
Mesher.cpp:(.text+0x1489): Warnung: undefinierter Verweis auf »NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x150f): Warnung: undefinierter Verweis auf »StdMeshers_MaxLength::StdMeshers_MaxLength(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x153f): Warnung: undefinierter Verweis auf »StdMeshers_MaxLength::SetLength(double)«
Mesher.cpp:(.text+0x15be): Warnung: undefinierter Verweis auf »StdMeshers_LocalLength::StdMeshers_LocalLength(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x15ee): Warnung: undefinierter Verweis auf »StdMeshers_LocalLength::SetLength(double)«
Mesher.cpp:(.text+0x166d): Warnung: undefinierter Verweis auf »StdMeshers_MaxElementArea::StdMeshers_MaxElementArea(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x169d): Warnung: undefinierter Verweis auf »StdMeshers_MaxElementArea::SetMaxArea(double)«
Mesher.cpp:(.text+0x171c): Warnung: undefinierter Verweis auf »StdMeshers_Deflection1D::StdMeshers_Deflection1D(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x174c): Warnung: undefinierter Verweis auf »StdMeshers_Deflection1D::SetDeflection(double)«
Mesher.cpp:(.text+0x17e5): Warnung: undefinierter Verweis auf »StdMeshers_Arithmetic1D::StdMeshers_Arithmetic1D(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x181a): Warnung: undefinierter Verweis auf »StdMeshers_Arithmetic1D::SetLength(double, bool)«
Mesher.cpp:(.text+0x1848): Warnung: undefinierter Verweis auf »StdMeshers_Arithmetic1D::SetLength(double, bool)«
Mesher.cpp:(.text+0x18aa): Warnung: undefinierter Verweis auf »StdMeshers_AutomaticLength::StdMeshers_AutomaticLength(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x1911): Warnung: undefinierter Verweis auf »StdMeshers_NumberOfSegments::StdMeshers_NumberOfSegments(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x192c): Warnung: undefinierter Verweis auf »StdMeshers_NumberOfSegments::SetNumberOfSegments(int)«
Mesher.cpp:(.text+0x199b): Warnung: undefinierter Verweis auf »StdMeshers_Regular_1D::StdMeshers_Regular_1D(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x1a02): Warnung: undefinierter Verweis auf »StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int, int, SMESH_Gen*)«
Mesher.cpp:(.text+0x1a7d): Warnung: undefinierter Verweis auf »SMESH_Mesh::ShapeToMesh(TopoDS_Shape const&)«
Mesher.cpp:(.text+0x1ab9): Warnung: undefinierter Verweis auf »SMESH_Mesh::AddHypothesis(TopoDS_Shape const&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)«
Mesher.cpp:(.text+0x1adb): Warnung: undefinierter Verweis auf »SMESH_Mesh::GetShapeToMesh() const«
Mesher.cpp:(.text+0x1b09): Warnung: undefinierter Verweis auf »SMESH_Gen::Compute(SMESH_Mesh&, TopoDS_Shape const&, int, MeshDimension, std::set<int, std::less<int>, std::allocator<int> >*)«
Mesher.cpp:(.text+0x1bb3): Warnung: undefinierter Verweis auf »SMESH_Mesh::NbNodes() const«
Mesher.cpp:(.text+0x1bdc): Warnung: undefinierter Verweis auf »SMESH_Mesh::NbFaces(SMDSAbs_ElementOrder) const«
Mesher.cpp:(.text+0x1c6f): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Z() const«
Mesher.cpp:(.text+0x1c8a): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Y() const«
Mesher.cpp:(.text+0x1ca5): Warnung: undefinierter Verweis auf »SMDS_MeshNode::X() const«
Mesher.cpp:(.text+0x27c5): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Z() const«
Mesher.cpp:(.text+0x27dc): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Y() const«
Mesher.cpp:(.text+0x27f3): Warnung: undefinierter Verweis auf »SMDS_MeshNode::X() const«
Mesher.cpp:(.text+0x2821): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Z() const«
Mesher.cpp:(.text+0x2838): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Y() const«
Mesher.cpp:(.text+0x284f): Warnung: undefinierter Verweis auf »SMDS_MeshNode::X() const«
Mesher.cpp:(.text+0x287d): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Z() const«
Mesher.cpp:(.text+0x2894): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Y() const«
Mesher.cpp:(.text+0x28ab): Warnung: undefinierter Verweis auf »SMDS_MeshNode::X() const«
Mesher.cpp:(.text+0x28d9): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Z() const«
Mesher.cpp:(.text+0x28f0): Warnung: undefinierter Verweis auf »SMDS_MeshNode::Y() const«
Mesher.cpp:(.text+0x2907): Warnung: undefinierter Verweis auf »SMDS_MeshNode::X() const«
Mesher.cpp:(.text+0x2ca0): Warnung: undefinierter Verweis auf »SMESH_Mesh::ShapeToMesh(TopoDS_Shape const&)«
Mesher.cpp:(.text+0x2caf): Warnung: undefinierter Verweis auf »SMESH_Mesh::Clear()«

Looking in the cmake-output it seems find_package(SMESH CONFIG) was not successful:
-- Could NOT find SMESH (missing: SMESH_DIR)
ERROR================
SMESH not found.
================
So I guess either the cmake-configuration file is not found (maybe placed in a wrong dir) or the configuration file doesn't work for ubuntu without patching. This is the file:
https://github.com/LaughlinResearch/SME ... g.cmake.in
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Post by NormandC »

looo wrote: Mon Feb 11, 2019 7:15 am I have this variable in the conda-recipe:

-D SMESH_INCLUDE_DIR
That one was not listed in cmake-gui... Is it possible to create it manually?
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Post by NormandC »

looo wrote: Mon Feb 11, 2019 8:19 am So I guess either the cmake-configuration file is not found
BTW I think you need to add this as well:
NormandC wrote: Mon Feb 11, 2019 4:13 am There is only one single variable in CMake for smesh, SMESH_DIR and I set it to /usr/lib/cmake/salome-smesh.
I use cmake-gui, but based on what you wrote, you need to add this:

Code: Select all

      -D SMESH_DIR=/usr/lib/cmake/salome-smesh
User avatar
wandererfan
Veteran
Posts: 6238
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: Compile w/Py3 & Qt5 for Dummies

Post by wandererfan »

NormandC wrote: Tue Feb 12, 2019 12:42 pm That one was not listed in cmake-gui... Is it possible to create it manually?
Should be a "+ Add Entry" button upper right.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Post by NormandC »

Thanks, it's pretty visible too. :oops: In my defence, I asked that on my phone this morning.
User avatar
NormandC
Veteran
Posts: 18587
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Compile w/Py3 & Qt5 for Dummies

Post by NormandC »

looo wrote: Mon Feb 11, 2019 7:15 am SMESH_INCLUDE_DIR
Okay, I added it, no change, the build fails with the same error.

looo wrote: Sat Feb 09, 2019 9:29 am add ppa for pybind11:
https://launchpad.net/~nschloe/+archive ... -backports
Thanks, somehow I overlooked it :oops:
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Post by looo »

regarding external smesh:

The problem is that the libsalome-smesh stores the SMESHConfig.cmake in /usr/lib/cmake/salome-smesh/ . But in the FindPackage(smesh CONFIG) looks for a directory smesh/*Config.cmake (At least I guess this is how things work). So we need to rename /usr/lib/cmake/salome-smesh/ to
/usr/lib/cmake/smesh/

Doing this worked for me (at least the cmake-detection of external smesh)

Code: Select all

sudo cp -r /usr/lib/cmake/salome-smesh /usr/lib/cmake/smesh
and then using this variables for cmake:

Code: Select all

cmake -D BUILD_QT5=ON \
      -D PYTHON_EXECUTABLE=/usr/bin/python3.6 \
      -D FREECAD_USE_PYBIND11:BOOL=ON \
      -D USE_BOOST_PYTHON:BOOL=OFF \
      -D BUILD_ENABLE_CXX11:BOOL=ON \
      -D BUILD_PLOT:BOOL=OFF \
      -D BUILD_SHIP:BOOL=OFF \
      -D FREECAD_USE_OCC_VARIANT="Official Version" \
      -D BUILD_FLAT_MESH:BOOL=ON \
      -D BUILD_FEM_NETGEN:BOOL=ON \
      -D ENABLE_MED:BOOL=OFF \
      -D FREECAD_USE_EXTERNAL_SMESH=ON \
      ..
kkremitzki wrote: Mon Feb 11, 2019 7:45 am
In the long run it would be nice to rename the smesh-cmake-directory directly in the package. Or are there any conventions about the naming for this which prevent us from this?

edit.: we also have to patch the SMESHConfig.cmake:

replace line 9 and 10:

Code: Select all

set(SMESH_INCLUDE_PATH "${SELF_DIR}/../include/smesh")
set(SMESH_LIB_PATH "${SELF_DIR}/../lib")
to

Code: Select all

set(SMESH_INCLUDE_PATH "/usr/include/smesh")
set(SMESH_LIB_PATH "/usr/lib/x86_64-linux-gnu/")
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Compile w/Py3 & Qt5 for Dummies

Post by looo »

after another problem with netgen:

Code: Select all

During initialization the error libinterface.so: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden occurred in /home/k/.FreeCAD/Mod/CfdOF/InitGui.py
Please look into the log file for further information
solved with

Code: Select all

sudo ln -s /usr/lib/x86_64-linux-gnu/netgen/lib* /usr/lib/x86_64-linux-gnu/
now crash when opening netgen mesh dialog in fem-wb:

Code: Select all

#0  /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7fbd4dcb7f20]
#1  0x7fbd2498752b in SMDS_Mesh::elementEntityIterator(SMDSAbs_EntityType) const from /usr/lib/x86_64-linux-gnu/libSMDS.so.8.3+0x19b
#2  0x7fbd1f4dd019 in vtkUnstructuredGrid::Cleanup() from /usr/lib/x86_64-linux-gnu/libvtkCommonDataModel-7.1.so.7.1+0xb9
#3  0x7fbd1f4e12a6 in vtkUnstructuredGrid::Initialize() from /usr/lib/x86_64-linux-gnu/libvtkCommonDataModel-7.1.so.7.1+0x16
#4  0x7fbd24995595 in SMDS_Mesh::SMDS_Mesh() from /usr/lib/x86_64-linux-gnu/libSMDS.so.8.3+0x495
#5  0x7fbd243fe8fb in SMESHDS_Mesh::SMESHDS_Mesh(int, bool) from /usr/lib/x86_64-linux-gnu/libSMESHDS.so.8.3+0x2b
#6  0x7fbd243f621d in SMESHDS_Document::NewMesh(bool, int) from /usr/lib/x86_64-linux-gnu/libSMESHDS.so.8.3+0x5d
#7  0x7fbd2467c523 in SMESH_Mesh::SMESH_Mesh(int, int, SMESH_Gen*, bool, SMESHDS_Document*) from /usr/lib/x86_64-linux-gnu/libSMESH.so.8.3+0x173
#8  0x7fbd2466d3d4 in SMESH_Gen::CreateMesh(int, bool) from /usr/lib/x86_64-linux-gnu/libSMESH.so.8.3+0x64
#9  0x7fbd25638765 in Fem::FemMesh::FemMesh() from /home/k/projects/FreeCAD/build/Mod/Fem/Fem.so+0x89
#10  0x7fbd2566f0a6 in Fem::PropertyFemMesh::PropertyFemMesh() from /home/k/projects/FreeCAD/build/Mod/Fem/Fem.so+0x4a
#11  0x7fbd2562f638 in Fem::FemMeshObject::FemMeshObject() from /home/k/projects/FreeCAD/build/Mod/Fem/Fem.so+0x4c
#12  0x7fbd2563271e in Fem::FemMeshShapeObject::FemMeshShapeObject() from /home/k/projects/FreeCAD/build/Mod/Fem/Fem.so+0x28
#13  0x7fbd25635942 in Fem::FemMeshShapeNetgenObject::FemMeshShapeNetgenObject() from /home/k/projects/FreeCAD/build/Mod/Fem/Fem.so+0x28
#14  0x7fbd25635898 in Fem::FemMeshShapeNetgenObject::create() from /home/k/projects/FreeCAD/build/Mod/Fem/Fem.so+0x1c
#15  0x7fbd4fe2f316 in Base::Type::createInstance() from /home/k/projects/FreeCAD/build/lib/libFreeCADBase.so+0x30
#16  0x7fbd4fe2f3a2 in Base::Type::createInstanceByName(char const*, bool) from /home/k/projects/FreeCAD/build/lib/libFreeCADBase.so+0x8a
#17  0x7fbd50715564 in App::Document::addObject(char const*, char const*, bool) from /home/k/projects/FreeCAD/build/lib/libFreeCADApp.so+0x4e
#18  0x7fbd5081a0f5 in App::DocumentPy::addObject(_object*) from /home/k/projects/FreeCAD/build/lib/libFreeCADApp.so+0xc9
#19  0x7fbd50812e3b in App::DocumentPy::staticCallback_addObject(_object*, _object*) from /home/k/projects/FreeCAD/build/lib/libFreeCADApp.so+0x119

seems to be more difficult than I thought. Are there any special things involved in creating the smesh package?
Post Reply