Trouble building master: missing coin3d

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
freman
Veteran
Posts: 2200
Joined: Tue Nov 27, 2018 10:30 pm

Trouble building master: missing coin3d

Post by freman »

Hi,

after having some instabilities I decided to delete the entire master tree and build directory and start afresh.
I also have a local build of opencascade. Coin3d-4.0.0 Coin3D-devel and pivy are distro installed ( Fedora ).

Code: Select all

cmake  -Wno-dev -S../FreeCAD  -DBUILD_QT5=ON -DPYTHON_EXECUTABLE=/usr/bin/python3  -DCCACHE_PROGRAM=


-- Found SWIG: /bin/swig (found version "4.0.2")  
-- Found Eigen3: /usr/include/eigen3 (found suitable version "3.3.9", minimum required is "2.91.0") 
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Coin3D (missing: COIN3D_INCLUDE_DIRS)                                                                                                   
Call Stack (most recent call first):                                                                                                                     
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)                                                              
  /usr/share/cmake/Modules/FindCoin3D.cmake:75 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)                                                                       
  cMake/FreeCAD_Helpers/SetupCoin3D.cmake:9 (find_package)                                                                                               
  CMakeLists.txt:73 (SetupCoin3D)                                                                                                                        
If I build coin3d-4.0.1 from source FreeCAD finds it OK and master builds. However this causes problems with distro pivy which has deps on distro coin .... and I'm going round in circles. I include this fact to show it does build without other issues when I build coin3d as well. The missing pivy thows errors on loading.

I've been going back and forth for days trying to get a working build and can't see why this no longer works like it did 3 or 4 weeks back last time I built master.

Any ideas ?

TIA.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Trouble building master: missing coin3d

Post by adrianinsaval »

probably due to git commit 7a198ca
what version of Fedora and cmake are you running?
User avatar
freman
Veteran
Posts: 2200
Joined: Tue Nov 27, 2018 10:30 pm

Re: Trouble building master: missing coin3d

Post by freman »

Thanks for the suggestion but that test does return a finite result.

Code: Select all

python -c "import pivy as p; print(p.__version__,end='')"
0.6.7
cmake version 3.22.2

Plus that test comes after the Coin test, and mine seems to be dropping out on Coin.

I have found a difference in the structure of the distro installation and source build. I'd guess that this is throwing it.

/usr/local/include/Inventor
/usr/include/Coin4/Inventor

Any idea what I need to do to tell it where to look ?
Thanks.
Last edited by freman on Thu Aug 04, 2022 6:58 am, edited 1 time in total.
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: Trouble building master: missing coin3d

Post by FreddyFreddy »

The referenced commit deleted the FreeCAD version of SetupCoin3D.cmake, preferring the cmake internal one. The FreeCAD version had some extra paths. Maybe your setup needs one or more of these?
User avatar
freman
Veteran
Posts: 2200
Joined: Tue Nov 27, 2018 10:30 pm

Re: Trouble building master: missing coin3d

Post by freman »

Ah, thanks Freddy. I had not realised that commit removed an entire file. I thought it was just the four extra lines. That's almost certainly the cause of the problem.

Now what do I need to do to fix it ? Where is the cmake code for this, I don't see any addition.
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: Trouble building master: missing coin3d

Post by FreddyFreddy »

The cmake version is a part of cmake.

I'm not knowledgeable on this stuff, but maybe @wmayer can advise?
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Trouble building master: missing coin3d

Post by wmayer »

freman wrote: Thu Aug 04, 2022 6:19 am Now what do I need to do to fix it ? Where is the cmake code for this, I don't see any addition.
Does your system version of Coin3D provide the file coin-config.cmake (or CoinConfig.cmake)? If yes, then the call of

Code: Select all

find_package(Coin CONFIG REQUIRED)
inside SetupCoin3D.cmake should fix it.

Since the file coin-config.cmake (or CoinConfig.cmake) is not necessarily provided by all Coin3D packages for all distributions we have to handle the Coin3D stuff like this:

Code: Select all

# Config mode
find_package(Coin CONFIG REQUIRED)
if (NOT Coin_FOUND)
    find_package(Coin3D REQUIRED)
endif()
...
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Trouble building master: missing coin3d

Post by wmayer »

Change the content of SetupCoin3D.cmake to:

Code: Select all

macro(SetupCoin3D)
# -------------------------------- Coin3D --------------------------------

    # First try CONFIG mode
    find_package(Coin CONFIG)
    if (Coin_FOUND)
        set (COIN3D_INCLUDE_DIRS ${Coin_INCLUDE_DIR})
        set (COIN3D_LIBRARIES ${Coin_LIBRARIES})
    else()
        # Try MODULE mode now
        if (WIN32 AND MINGW)
            find_path(COIN3D_INCLUDE_DIRS Inventor/So.h)
            find_library(COIN3D_LIBRARIES Coin)
        endif ()

        find_package(Coin3D REQUIRED)
        if(NOT COIN3D_FOUND)
            message(FATAL_ERROR "=================\n"
                                "Coin3D not found.\n"
                                "=================\n")
        endif(NOT COIN3D_FOUND)
    endif()

    IF(NOT PIVY_VERSION)
      execute_process (COMMAND ${Python3_EXECUTABLE} -c "import pivy as p; print(p.__version__,end='')" OUTPUT_VARIABLE PIVY_VERSION)
    ENDIF()

endmacro(SetupCoin3D)
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Trouble building master: missing coin3d

Post by wmayer »

FYI, this is the official check for Linux platforms:

Code: Select all

find_path(COIN3D_INCLUDE_DIRS Inventor/So.h)
find_library(COIN3D_LIBRARIES Coin)

include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS)

mark_as_advanced(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES )
while the removed file did this:

Code: Select all

    # Try to use pkg-config first...
    find_package(PkgConfig)
    pkg_check_modules(COIN3D Coin)
    # ... then fall back to manual lookup
    IF(NOT COIN3D_FOUND)
      FIND_PATH(COIN3D_INCLUDE_DIRS Inventor/So.h
        ${CMAKE_INCLUDE_PATH}
        /usr/include/Coin3
        /usr/include
        /usr/include/coin
        /usr/local/include
      )

      FIND_LIBRARY(COIN3D_LIBRARIES Coin
        ${CMAKE_LIBRARY_PATH}
        /usr/lib
        /usr/local/lib
        PATH_SUFFIXES Coin2 Coin3
      )
    ENDIF(NOT COIN3D_FOUND)
User avatar
babaroga
Posts: 178
Joined: Sun Aug 14, 2016 6:52 pm
Location: Banja Luka, Republic of Srpska, Bosnia and Herzegovina

Re: Trouble building master: missing coin3d

Post by babaroga »

I had same problem with Manjaro.

Solved it by manually returning FindCoin3D.cmake to cMake folder. It was deleted by git commit 7a198ca

Code: Select all

[code]
OS: Manjaro Linux (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.21.29938 (Git)
Build type: Unknown
Branch: hlrThreadrc1
Hash: 6159fbafd202429ff1cffca4fd5f93c2407accab
Python 3.10.5, Qt 5.15.5, Coin 4.0.1, Vtk 9.1.0, OCC 7.5.3
Locale: English/United States (en_US)
Installed mods: 
  * Manipulator 1.4.5
  * Render 2022.2.0
  * fasteners 0.3.44
  * Assembly4 0.12.0
  * A2plus 0.4.56a
  * sheetmetal 0.2.49
  * InventorLoader 1.3.0
  * Curves 0.4.4
  * kicadStepUpMod 10.13.0
[/code]
Post Reply