Bug 266280 - cad/opencascade: cmake fails to discover opencascade
Summary: cad/opencascade: cmake fails to discover opencascade
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-07 18:46 UTC by Yuri Victorovich
Modified: 2022-09-17 15:42 UTC (History)
0 users

See Also:
thierry: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2022-09-07 18:46:48 UTC
This CMakeLists.txt:
> cmake_minimum_required(VERSION 3.12)
> find_package(OpenCASCADE REQUIRED)

fails during OpenCASCADE discovery:
> $ cmake -DOpenCASCADE_DIR=/usr/local/lib/cmake .
> CMake Error at /usr/local/lib/cmake/OpenCASCADEFoundationClassesTargets.cmake:79 (message):
>   The imported target "TKernel" references the file
> 
>      "/usr/local/lib${OCCT_INSTALL_BIN_LETTER}/libTKernel.so.7.6.0"
> 
>   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/local/lib/cmake/OpenCASCADEFoundationClassesTargets.cmake"
> 
>   but not all the files it references.
> 
> Call Stack (most recent call first):
>   /usr/local/lib/cmake/OpenCASCADEConfig.cmake:101 (include)
>   CMakeLists.txt:10 (find_package)

opencascade-7.6.0_6
cmake-3.23.3
FreeBSD 13.1
Comment 1 Thierry Thomas freebsd_committer freebsd_triage 2022-09-08 07:54:46 UTC
Could you please give more details on the failing port?

cad/freecad and cad/gmsh also use cmake, and they find OpenCASCADE: I'd like to compare their CMakeLists.txt with yours.
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2022-09-08 13:57:59 UTC
The example above is how they find OpenCASCADE:
> cmake_minimum_required(VERSION 3.12)
> find_package(OpenCASCADE REQUIRED)

The same in the context of the f3d project: https://github.com/f3d-app/f3d/blob/master/CMakeLists.txt#L77
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2022-09-08 17:09:15 UTC
Thanks, I have just located the issue:

- OpenCASCADE uses a variable OCCT_INSTALL_BIN_LETTER which can be used to install several versions of its libraries (e.g. under lib64 or libd for debug);

- in the various OpenCASCADE*Targets-release.cmake (installed under /usr/local/lib/cmake/), the dollar sign of this variable is escaped!

E.g. we have
"/usr/local/lib\${OCCT_INSTALL_BIN_LETTER}/libTKernel.so.7.6.0"
where it should be
"/usr/local/lib${OCCT_INSTALL_BIN_LETTER}/libTKernel.so.7.6.0"

Note: in our case OCCT_INSTALL_BIN_LETTER is empty.

I shall try to fix it ASAP.
Comment 4 Thierry Thomas freebsd_committer freebsd_triage 2022-09-10 11:12:23 UTC
A fix has just been committed, please let me know if this is OK for your ports.
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-09-10 11:13:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=31735a5b1aae9a7967e8cc5f12ffab7779acc53c

commit 31735a5b1aae9a7967e8cc5f12ffab7779acc53c
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2022-09-10 11:05:31 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2022-09-10 11:12:13 +0000

    cad/opencascade: fix cmake files

    A cmake macro, which should have configured $OCCT_INSTALL_BIN_LETTER was
    not applied correctly. Thus some cmake files where badly configured, and
    some consumers could not use them.

    PR:             266280
    Reported by:    yuri
    MFH:            2022Q3

 cad/opencascade/Makefile                                |  8 +++++++-
 .../files/patch-adm_cmake_occt__macros.cmake            | 17 ++++++++++++++++-
 .../files/patch-src_Standard_Standard__CString.cxx      |  4 ++--
 3 files changed, 25 insertions(+), 4 deletions(-)
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-09-17 12:39:43 UTC
A commit in branch 2022Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3f4f4b240990348b8b261be32e797811f5ee09b4

commit 3f4f4b240990348b8b261be32e797811f5ee09b4
Author:     Thierry Thomas <thierry@FreeBSD.org>
AuthorDate: 2022-09-10 11:05:31 +0000
Commit:     Thierry Thomas <thierry@FreeBSD.org>
CommitDate: 2022-09-17 12:38:38 +0000

    cad/opencascade: fix cmake files

    A cmake macro, which should have configured $OCCT_INSTALL_BIN_LETTER was
    not applied correctly. Thus some cmake files where badly configured, and
    some consumers could not use them.

    PR:             266280
    Reported by:    yuri
    MFH:            2022Q3

    (cherry picked from commit 31735a5b1aae9a7967e8cc5f12ffab7779acc53c)

 cad/opencascade/Makefile                                |  8 +++++++-
 .../files/patch-adm_cmake_occt__macros.cmake            | 17 ++++++++++++++++-
 .../files/patch-src_Standard_Standard__CString.cxx      |  4 ++--
 3 files changed, 25 insertions(+), 4 deletions(-)
Comment 7 Yuri Victorovich freebsd_committer freebsd_triage 2022-09-17 15:18:04 UTC
(In reply to Thierry Thomas from comment #4)


Thanks Thierry,

My port graphics/f3d now builds fine with OpenCascade.



Yuri
Comment 8 Thierry Thomas freebsd_committer freebsd_triage 2022-09-17 15:42:16 UTC
(In reply to Yuri Victorovich from comment #7)
You’re welcome!