Cmake fails - picking up OCCT inside PrusaSlicer?

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
BDL42
Posts: 253
Joined: Mon Jun 06, 2022 5:55 pm

Cmake fails - picking up OCCT inside PrusaSlicer?

Post by BDL42 »

Thought I would update my version of FreeCAD from git and have run into a snag. git pull was fine. I have built FreeCAD about 5 times now, without issues.

For some reason, cmake is pulling OCCT stuff out of PrusaSlicer, rather than out of my installed libraries. This is alpha sw and in it's own directory, with it's own occt libs. How do I get cmake to stop pulling stuff out of a "private alpha test sandbox" area?

Code: Select all

/Apps/freecad-build$ cmake .
-- Compiler: GNU, version: 11.3.0
-- prefix: /usr/local
-- bindir: bin
-- datadir: share
-- docdir: share/doc/FreeCAD
-- includedir: include
-- libdir: lib
-- cmake: 3.22.1
-- Compiling with Qt 5
-- Checking for connection to GitHub...
-- GitHub connection established for FetchContent
-- Module support is disabled.
-- Version: 9.1.0
-- Build type: Release
-- CXX_STANDARD: 17
-- Required features: cxx_variadic_templates
-- fmt was downloaded using FetchContent into /home/bruce/Apps/freecad-build/_deps/fmt-src
-- PyCXX found:
--   Headers:  /home/bruce/Apps/freecad-source/src
--   Sources:  /home/bruce/Apps/freecad-source/src/CXX
--   Version:  7.1.7
CMake Error at /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEConfig.cmake:95 (include):
  include could not find requested file:

    /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEFoundationClassesTargets.cmake
Call Stack (most recent call first):
  cMake/FindOCC.cmake:39 (find_package)
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEConfig.cmake:95 (include):
  include could not find requested file:

    /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEModelingDataTargets.cmake
Call Stack (most recent call first):
  cMake/FindOCC.cmake:39 (find_package)
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEConfig.cmake:95 (include):
  include could not find requested file:

    /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEModelingAlgorithmsTargets.cmake
Call Stack (most recent call first):
  cMake/FindOCC.cmake:39 (find_package)
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEConfig.cmake:95 (include):
  include could not find requested file:

    /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEVisualizationTargets.cmake
Call Stack (most recent call first):
  cMake/FindOCC.cmake:39 (find_package)
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEConfig.cmake:95 (include):
  include could not find requested file:

    /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEApplicationFrameworkTargets.cmake
Call Stack (most recent call first):
  cMake/FindOCC.cmake:39 (find_package)
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEConfig.cmake:95 (include):
  include could not find requested file:

    /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/dep_OCCT-build/OpenCASCADEDataExchangeTargets.cmake
Call Stack (most recent call first):
  cMake/FindOCC.cmake:39 (find_package)
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at cMake/FindOCC.cmake:101 (file):
  file STRINGS file
  "/home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/include/opencascade/Standard_Version.hxx"
  cannot be read.
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at cMake/FindOCC.cmake:104 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at cMake/FindOCC.cmake:105 (file):
  file STRINGS file
  "/home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/include/opencascade/Standard_Version.hxx"
  cannot be read.
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at cMake/FindOCC.cmake:108 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at cMake/FindOCC.cmake:109 (file):
  file STRINGS file
  "/home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/include/opencascade/Standard_Version.hxx"
  cannot be read.
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


CMake Error at cMake/FindOCC.cmake:112 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  cMake/FreeCAD_Helpers/SetupOpenCasCade.cmake:4 (find_package)
  CMakeLists.txt:53 (SetupOpenCasCade)


-- -- Found OCE/OpenCASCADE version: ..
-- -- OCE/OpenCASCADE include directory: /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/include/opencascade
-- -- OCE/OpenCASCADE shared libraries directory: /home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/lib
-- The imported target "vtkParseOGLExt" references the file
   "/usr/bin/vtkParseOGLExt-7.1"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- The imported target "pvtk" references the file
   "/usr/bin/pvtk"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   "/usr/lib/cmake/vtk-7.1/VTKTargets.cmake"
but not all the files it references.

-- VTK components: vtkCommonCore;vtkCommonDataModel;vtkFiltersVerdict;vtkIOXML;vtkFiltersCore;vtkFiltersGeneral;vtkIOLegacy;vtkFiltersExtraction;vtkFiltersSources;vtkFiltersGeometry;vtkIOMPIParallel;vtkParallelMPI;vtkhdf5;vtkFiltersParallelDIY2;vtkRenderingCore;vtkInteractionStyle;vtkRenderingFreeType;vtkRenderingOpenGL2
-- Check for medfile (libmed and libmedc) ...
-- We guess that libmed was built using hdf5-openmpi version
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.65") found components: filesystem program_options regex system thread date_time 
-- Set up to compile with Qt 5.15.3
-- Shiboken2Config: Using default python: .cpython-310-x86_64-linux-gnu
-- SHIBOKEN_PYTHON_INCLUDE_DIRS computed to value: '/usr/include/python3.10'
-- SHIBOKEN_PYTHON_LIBRARIES computed to value: ''
-- libshiboken built for RelWithDebInfo
-- PYTHON_CONFIG_SUFFIX: .cpython-310-x86_64-linux-gnu
-- libshiboken built for RelWithDebInfo
-- PySide 5.15.2 Python module found at /usr/lib/python3/dist-packages/PySide2.

-- Found Matplotlib: /usr/lib/python3/dist-packages/matplotlib (found version "3.5.1")
-- Platform is 64-bit, set -D_OCC64
-- Performing Test _flag_found
-- Performing Test _flag_found - Success
-- Performing Test _flag_found
-- Performing Test _flag_found - Success
-- Performing Test _flag_found
-- Performing Test _flag_found - Success
-- Performing Test _flag_found
-- Performing Test _flag_found - Success
-- [E57] Revison ID: E57Format-2.2.1-x86_64-linux-gcc11
-- [E57] Building static library
-- setting gcc options: -Wall -Werror -Wno-deprecated -pedantic-errors
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: python310 
-- found Boost: 1_74
-- boost-incude dirs are: /usr/include
-- boost-python lib is: 
-- boost_LIBRARY_DIRS is: /usr/lib/x86_64-linux-gnu
-- Boost_LIBRARIES is: Boost::python
-- area module (for Path Workbench) will be installed to: lib
-- Performing Test _flag_found
-- Performing Test _flag_found - Success
-- Performing Test _flag_found
-- Performing Test _flag_found - Success
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
-- Coin3D doc is not installed

   ==============
     System
   ==============

-- bindir:                      bin
-- BLAS:                        -undefined-
-- CMAKE_VERSION:               3.22.1
-- Compiler:                    /usr/bin/c++ (11.3.0)
-- datadir:                     share
-- docdir:                      share/doc/FreeCAD
-- includedir:                  include
-- libdir:                      lib
-- prefix:                      /usr/local
-- Python:                      3.10.6 [/usr/bin/python3.10] Suffix: [.cpython-310-x86_64-linux-gnu]

   ==============
     Config
   ==============

-- BUILD_FEM:                   ON
-- BUILD_GUI:                   ON
-- BUILD_SMESH:                 ON
-- BUILD_START:                 ON
-- BUILD_TECHDRAW:              ON
-- BUILD_TEST:                  ON
-- BUILD_VR:                    OFF 
-- BUILD_WEB:                   ON
-- CMAKE_BUILD_TYPE:            Release
-- CMAKE_CXX_FLAGS:             -Wall -Wextra -Wno-write-strings 
-- CMAKE_CXX_STANDARD:          17
-- CMAKE_INSTALL_PREFIX:        /usr/local
-- CMAKE_PREFIX_PATH:           -undefined-
-- FREECAD_CREATE_MAC_APP:      -undefined-
-- FREECAD_LIBPACK_USE:         OFF 
-- FREECAD_QT_VERSION:          Auto
-- FREECAD_USE_EXTERNAL_KDL:    OFF 
-- FREECAD_USE_EXTERNAL_SMESH:  OFF 
-- FREECAD_USE_FREETYPE:        ON
-- FREECAD_USE_PYBIND11:        OFF 
-- PYTHON_EXECUTABLE:           /usr/bin/python3.10
-- PYTHON_LIBRARY:              /usr/lib/x86_64-linux-gnu/libpython3.10.so
-- USE_CUDA:                    -undefined-
-- USE_OPENCV:                  -undefined-

   ==============
     Libraries
   ==============

-- Boost:                       1.74.0
-- Coin3D:                      4.0.0 [/usr/lib/x86_64-linux-gnu/libCoin.so] [/usr/include]
-- Coin3D_DOC:                  not found
-- DesignerPlugin:              not built (BUILD_DESIGNER_PLUGIN is OFF)
-- Doxygen:                     1.9.1 Language: English
-- Eigen3:                      3.4.0
-- fmt:                         Sources downloaded to /home/bruce/Apps/freecad-build/_deps/fmt-src
-- Freetype:                    2.11.1
-- HDF5:                        1.10.7
-- Matplotlib:                  3.5.1 PathDirs: /usr/lib/python3/dist-packages/matplotlib
-- MEDFile:                     4.1.0 [/usr/lib/x86_64-linux-gnu/libmedC.so] [/usr/include]
-- NETGEN:                      not enabled
-- OCC:                         .. [/home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/lib] [/home/bruce/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/include/opencascade]
-- OCC_Libs:                    [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat]
-- OpenGL_Lib:                  [/usr/lib/x86_64-linux-gnu/libGL.so]
-- OpenGLU_Incl:                [/usr/include]
-- OpenGLU_Lib:                 [/usr/lib/x86_64-linux-gnu/libGLU.so]
-- pivy:                        0.6.5
-- pybind11:                    not enabled
-- PYCXX:                       7.1.7 Incl: /home/bruce/Apps/freecad-source/src Src:/home/bruce/Apps/freecad-source/src/CXX
-- PySide:                      5.15.2 [/usr/lib/../include/PySide2]
-- PySideTools:                 v: 2  uic: [/usr/lib/qt5/bin/uic]  rcc: [/usr/lib/qt5/bin/rcc]
-- QtConcurrent:                5.15.3
-- QtCore:                      5.15.3
-- QtNetwork:                   5.15.3
-- QtOpenGL:                    5.15.3
-- QtPrintSupport:              5.15.3
-- QtSvg:                       5.15.3
-- QtUiTools:                   5.15.3
-- QtWebEngineWidgets:          5.15.9
-- QtWidgets:                   5.15.3
-- QtXml:                       5.15.3
-- Rift:                        not enabled (BUILD_VR)
-- Shiboken:                    5.15.2 [/usr/lib/../include/shiboken2;/usr/include/python3.10]
-- SMESH:                       7.7.1.0 build internal
-- SPNAV:                       [/usr/lib/libspnav.so] [/usr/include]
-- SWIG:                        4.0.2
-- VTK:                         7.1.1
-- XercesC:                     3.2.3 [/usr/lib/x86_64-linux-gnu/libxerces-c.so] [/usr/include]
-- ZLIB:                        1.2.11

=================================================
Now run 'cmake --build /home/xxx/Apps/freecad-build' to build FreeCAD
=================================================

-- Configuring incomplete, errors occurred!
See also "/home/xxx/Apps/freecad-build/CMakeFiles/CMakeOutput.log".
Any insights would be appreciated. Thanks.
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by chennes »

You should be able to explicitly set "OpenCASCADE_DIR" to the path you want it to use. Make sure you give it the path to the cMake file, not just the installation. e.g. "/usr/local/opencascade/lib/cmake/opencascade/" (or wherever yours is installed).
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
BDL42
Posts: 253
Joined: Mon Jun 06, 2022 5:55 pm

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by BDL42 »

How would one do this with cmake? It's apparently an argument to pass, but it's not clear (to me) how to do this.
I don't understand your instructions. occt-draw is in /usr/bin
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by chennes »

Are you using the cMake GUI, or running on the command line?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
BDL42
Posts: 253
Joined: Mon Jun 06, 2022 5:55 pm

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by BDL42 »

Using cli.

I am following the instructions on https://wiki.freecad.org/Compile_on_Linux in the section: Updating the source code

Code: Select all

The CMake system allows you to intelligently update the source code, and only recompile what has changed, making subsequent compilations faster.

Move to the location where the FreeCAD source code was first downloaded, and pull the new code:

cd freecad-source
git pull

Then move into the build directory where the code was compiled initially, and run cmake specifying the present directory (denoted by a dot); then trigger the re-compilation with make.

cd ../freecad-build
cmake .
make -j$(nproc --ignore=2)
A few months ago these instructions worked. 6 months ago, they worked as well.

About one month ago I compiled some alpha PrusaSlicer software in it's own sandbox, and tonight cmake went into the sandbox!
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by chennes »

Yeah, cMake remembers things it probably shouldn't.

Try searching your system for OpenCASCADEConfig.cmake -- if you have it (for the version you actually want to use), you should be able to:

Code: Select all

cmake ../FreeCAD-src -DOpenCASCADE_DIR=/path/to/that/cmake/file/
If you don't have it, then you will (probably) need to manually set the OCC paths:

Code: Select all

cmake ../FreeCAD-src -DOCC_INCLUDE_DIR=/usr/include/opencascade -DOCC_LIBRARY=/path/to/libTKernel.so
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
BDL42
Posts: 253
Joined: Mon Jun 06, 2022 5:55 pm

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by BDL42 »

The only OpenCASCADEConfig.cmake in my system is the one in the alpha PrusaSlicer. So I need to use the second option.

For pointing to libTKernel.so, do I simply use -DOCC_LIBRARY=/path/to/libTKernel.so which is the base library, rather than
-DOCC_LIBRARY=/path/to/libTKernel.so.7.5.1? The actual path is /usr/lib/x86_64-linux-gnu

Thank you for being so helpful. As you can tell, I'm not a wizard at this...
BDL42
Posts: 253
Joined: Mon Jun 06, 2022 5:55 pm

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by BDL42 »

This is what I executed at the command line:

Code: Select all

$ cmake ../freecad-source -DOCC_INCLUDE_DIR=/usr/include/opencascade -DOCC_LIBRARY=/usr/lib/x86_64-linux-gnu/libTKernel.so
It seems that the "sandboxed alpha code" wasn't sandboxed, since I am still picking up the following:

Code: Select all

-- OCC:                         .. [/home/xxx/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/lib] [/home/xxx/Apps/PrusaSlicer/deps/build/dep_OCCT-prefix/src/include/opencascade]
-- OCC_Libs:                    [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat]
Seems my system is messed up, darn.
User avatar
chennes
Veteran
Posts: 3909
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by chennes »

You can try deleting your CMakeCache.txt file and running the command again, to see if your local cache is messing things up. You can also try (again deleting your cache first) setting CMAKE_IGNORE_PATH, e.g.

Code: Select all

cmake ../freecad-source -DCMAKE_IGNORE_PATH=/home/xxx/Apps/PrusaSlicer/
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
adrianinsaval
Veteran
Posts: 5551
Joined: Thu Apr 05, 2018 5:15 pm

Re: Cmake fails - picking up OCCT inside PrusaSlicer?

Post by adrianinsaval »

what OS are you running? is there a package something like occt-dev available in your package manager that would provide the cmake config file?
Post Reply