OCCT cMake on MSYS2

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
chennes
Posts: 1038
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

OCCT cMake on MSYS2

Postby chennes » Fri Sep 10, 2021 4:29 am

I'm trying to update the compilation instructions on the FreeCAD wiki to allow compilation on MSYS2 on Windows and I've run into a snag with a cMake command I don't understand. I'm hoping someone with more experience can help me out here. The error generated by cmake is:

Code: Select all

CMake Error at /mingw64/lib/cmake/opencascade/OpenCASCADEModelingDataTargets.cmake:99 (message):
  The imported target "TKernel" references the file

     "/mingw64/lib${OCCT_INSTALL_BIN_LETTER}/libTKernel.dll.a"

If I look into the cMake files in this MSYS2 install, I see the following:

Code: Select all

list(APPEND _IMPORT_CHECK_FILES_FOR_TKernel "${_IMPORT_PREFIX}/lib\${OCCT_INSTALL_BIN_LETTER}/libTKernel.dll.a" "${_IMPORT_PREFIX}/bin\${OCCT_INSTALL_BIN_LETTER}/libTKernel.dll" )
I'm particularly perplexed by backslash in "${_IMPORT_PREFIX}/lib\${OCCT_INSTALL_BIN_LETTER}/libTKernel.dll.a" -- why is the "$" being escaped there?! It seems completely wrong to me, and indeed if I remove it this error goes away (replaced by the next in a long line of basically identical cMake errors relating to different OCCT lines). Am I missing some cMake command related to escape characters? The variable OCCT_INSTALL_BIN_LETTER itself is unset, but that's correct in this case, so it should be evaluating to "".
Chris Hennes
Pioneer Library System
openBrain
Posts: 6325
Joined: Fri Nov 09, 2018 5:38 pm

Re: OCCT cMake on MSYS2

Postby openBrain » Sat Sep 11, 2021 5:48 am

Not a CMake specialist but I agree that this escaping backslash has to be removed.
User avatar
easyw-fc
Posts: 3008
Joined: Thu Jul 09, 2015 9:34 am

Re: OCCT cMake on MSYS2

Postby easyw-fc » Sat Sep 11, 2021 3:23 pm

chennes wrote: Fri Sep 10, 2021 4:29 am I'm trying to update the compilation instructions on the FreeCAD wiki to allow compilation on MSYS2 on Windows
do you have a mini description? I would like to try to build FC in MSYS2 too
User avatar
chennes
Posts: 1038
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: OCCT cMake on MSYS2

Postby chennes » Sat Sep 11, 2021 4:42 pm

easyw-fc wrote: Sat Sep 11, 2021 3:23 pm do you have a mini description?
What I'm doing right now is repeatedly invoking cmake and letting it fail, then installing the next dependency it complains about. So I don't really have anything to report yet, I have to figure out a way around this OCCT problem. I could do a sed/awk thing on my system to fix all these borked cmake files for OCCT, but that doesn't really seem like a good step to have to put on the wiki. So I guess now I have to track down the maintainer of that package and see if they know why that backslash is in there.

ETA: Here's the wiki page I'm working on... https://wiki.freecadweb.org/Compile_on_MinGW
Last edited by chennes on Sat Sep 11, 2021 8:19 pm, edited 1 time in total.
Chris Hennes
Pioneer Library System
User avatar
chennes
Posts: 1038
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: OCCT cMake on MSYS2

Postby chennes » Sat Sep 11, 2021 8:01 pm

Poking around my normal (non-MSYS2) Windows installation, it appears that when OpenCASCADE is installed, it's doing that variable substitution then, so that variable shouldn't be showing up in the final installed cmake files for OCCT. I've submitted a bug report over at the MSYS2 github page, I'll see if someone over there knows what's going on.
Chris Hennes
Pioneer Library System
B0Hr
Posts: 2
Joined: Tue Sep 14, 2021 11:25 pm

Re: OCCT cMake on MSYS2

Postby B0Hr » Tue Sep 14, 2021 11:30 pm

Hi,

I'm stumbled upon the same problem! Glad I found someone who was having the same problems.
First, I thought it was me, that I forgot to define this additional variable.

I've made a small project which compiles on Linux, Windows and MacOS. It relies on MSYS2 on windows.
https://github.com/rebot/OCCTSandbox

Their is room for improvement of course (My CMakeLists.txt is a WIP). For for now, it works and Open Cascade can be used without any problems :)

Kind regards,

Gilles
User avatar
chennes
Posts: 1038
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: OCCT cMake on MSYS2

Postby chennes » Wed Sep 15, 2021 2:48 pm

Thanks for posting, @B0Hr -- a project like that might be a useful testbed for my work on MSYS2. I have running into a whole sequence of problems getting FreeCAD compiling, having a simpler testbed seems like a great idea.
Chris Hennes
Pioneer Library System