MSYS2 build error help: "missing" file

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

MSYS2 build error help: "missing" file

Post by chennes »

I'm working on updating our MSYS2/MinGW build instructions (https://wiki.freecadweb.org/index.php?t ... e_on_MinGW). I've made good progress through a number of errors, and have the initial cMake run actually working now, but I'm getting a build error that is over my head. The error I get when I try to run cmake --build ./ is:

Code: Select all

ninja: error: 'D:/a/_temp/msys/msys64/mingw64/lib/libopenvr_api.dll.a', needed by 'bin/libSMDS.dll', missing and no known rule to make it
The path it's looking in is garbage, there's nothing there. But E:/msys/msys64/mingw64/lib/libopenvr_api.dll.a does exist. The build.ninja file shows a number of libraries that are being searched for in that incorrect path. Does anyone have any idea where it might be coming from?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: MSYS2 build error help: "missing" file

Post by chennes »

Update: I've poked around at this some, and that path (D:/a/_temp/) looks suspiciously like a GitHub CI thing. If I compile OpenCASCADE from scratch on my MSYS2 installation and use that version instead, I don't get this particular error.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: MSYS2 build error help: "missing" file

Post by wmayer »

chennes wrote: Tue Sep 14, 2021 3:27 am If I compile OpenCASCADE from scratch on my MSYS2 installation and use that version instead, I don't get this particular error.
How well does it work to build OCCT on your own? When I have built it 10 years ago with MSYS/MinGW inside a command line prompt it was a major PITA because for a lot of dlls there were a few thousand source files included that has exceeded the maximum number of allowed characters of the program parameters.

I had to split these dlls into several static libs and afterwards build a dll out of them. It took me several days to finish it.
User avatar
kwahoo
Posts: 679
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: MSYS2 build error help: "missing" file

Post by kwahoo »

chennes wrote: Mon Sep 13, 2021 12:20 am The path it's looking in is garbage, there's nothing there. But E:/msys/msys64/mingw64/lib/libopenvr_api.dll.a does exist.
I am curious why there is dependency on OpenVR? SMESH should not need it, at least for the functionality needed by FreeCAD.
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: MSYS2 build error help: "missing" file

Post by chennes »

wmayer wrote: Wed Sep 15, 2021 10:28 am How well does it work to build OCCT on your own?
I used the MinGW packaging setup here: https://github.com/msys2/MINGW-packages ... pencascade

Then just ran

Code: Select all

MINGW_ARCH=mingw64 makepkg-mingw -sLf


It compiled out of the box with no changes from me, except I had to do a little sed work after to remove those extraneous unreplaced variables. And of course, it doesn't seem to actually work for compiling :x

I don't know why it's being compiled with VR support enabled, but I suspect that that's a red herring, and if I removed VR support I'd get an identical error on some other package.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: MSYS2 build error help: "missing" file

Post by wmayer »

Ah great. Maybe I should retry the MinGW version again.

Btw, when I did the initial MinGW build of OCCT I also ported the source code to that compiler: https://dev.opencascade.org/content/cma ... cc-builder
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: MSYS2 build error help: "missing" file

Post by wmayer »

chennes wrote: Mon Sep 13, 2021 12:20 am I'm working on updating our MSYS2/MinGW build instructions (https://wiki.freecadweb.org/index.php?t ... e_on_MinGW). I've made good progress through a number of errors, and have the initial cMake run actually working now, but I'm getting a build error that is over my head. The error I get when I try to run cmake --build ./ is:

Code: Select all

ninja: error: 'D:/a/_temp/msys/msys64/mingw64/lib/libopenvr_api.dll.a', needed by 'bin/libSMDS.dll', missing and no known rule to make it
The path it's looking in is garbage, there's nothing there. But E:/msys/msys64/mingw64/lib/libopenvr_api.dll.a does exist. The build.ninja file shows a number of libraries that are being searched for in that incorrect path. Does anyone have any idea where it might be coming from?
Currently I am testing the MSYS2/MinGW build and succeeded to set up the environment.
Now when trying to build the SMESH sources I immediately get an error due to the cast of a pointer to a long and back. How did you got this working? gcc is version 10.3.0. For now I disabled FEM and MeshPart to avoid to build the SMESH libs.
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: MSYS2 build error help: "missing" file

Post by wmayer »

chennes wrote: Mon Sep 13, 2021 12:20 am ninja: error: 'D:/a/_temp/msys/msys64/mingw64/lib/libopenvr_api.dll.a', needed by 'bin/libSMDS.dll', missing and no known rule to make it
Inside the bin directory of minwg64 you will find a file env.bat and this uses this odd path.

However, when I change it and rerun CMake the build.make files still use the wrong path. So, for now I work around it by creating that path and putting the affected libs.

When searching inside /mingw64 for all files that has included this paths then there are more than 5000 hits. So I guess it must have come from the build process to create the MSYS tools, libs, ...
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: MSYS2 build error help: "missing" file

Post by chennes »

It looks like we're not alone having that path problem, but I don't think the MSYS folks are seeing that there's a pattern:
https://github.com/msys2/MINGW-packages/issues/9411
https://github.com/msys2/MINGW-packages/issues/9615
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
User avatar
chennes
Veteran
Posts: 3868
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: MSYS2 build error help: "missing" file

Post by chennes »

wmayer wrote: Sat Sep 18, 2021 12:13 pm Now when trying to build the SMESH sources I immediately get an error due to the cast of a pointer to a long and back.
In the function at src/3rdParty/salomesmesh/inc/ObjectPool.hxx around line 133, I replaced all of the int data types with int64_t. I had to make the same change at src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_ProjectionUtils.cpp +109

That still left me with one more error (well, a whole set of errors) related to the DLL generation:

Code: Select all

In file included from E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/src/StdMeshers/StdMeshers_QuadFromMedialAxis_1D2D.cpp:32:
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:85:18: error: function 'SMESH_MeshEditor::ElemFeatures::ElemFeatures(SMDSAbs_ElementType, bool, bool)' definition is marked dllimport
   85 |     SMESH_EXPORT ElemFeatures( SMDSAbs_ElementType type=SMDSAbs_All, bool isPoly=false, bool isQuad=false )
      |                  ^~~~~~~~~~~~
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:88:32: error: function 'SMESH_MeshEditor::ElemFeatures& SMESH_MeshEditor::ElemFeatures::Init(SMDSAbs_ElementType, bool, bool)' definition is marked ort
   88 |     SMESH_EXPORT ElemFeatures& Init( SMDSAbs_ElementType type, bool isPoly=false, bool isQuad=false )
      |                                ^~~~
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:93:32: error: function 'SMESH_MeshEditor::ElemFeatures& SMESH_MeshEditor::ElemFeatures::Init(double)' definition is marked dllimport
   93 |     SMESH_EXPORT ElemFeatures& Init( double diameter )
      |                                ^~~~
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:96:32: error: function 'SMESH_MeshEditor::ElemFeatures& SMESH_MeshEditor::ElemFeatures::Init(std::vector<int>&, bool)' definition is marked dllimpor
   96 |     SMESH_EXPORT ElemFeatures& Init( std::vector<int>& quanities, bool isQuad=false )
      |                                ^~~~
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:100:32: error: function 'SMESH_MeshEditor::ElemFeatures& SMESH_MeshEditor::ElemFeatures::Init(const std::vector<int>&, bool)' definition is marked drt
  100 |     SMESH_EXPORT ElemFeatures& Init( const std::vector<int>& quanities, bool isQuad=false )
      |                                ^~~~
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:104:32: error: function 'SMESH_MeshEditor::ElemFeatures& SMESH_MeshEditor::ElemFeatures::SetPoly(bool)' definition is marked dllimport
  104 |     SMESH_EXPORT ElemFeatures& SetPoly(bool isPoly) { myIsPoly = isPoly; return *this; }
      |                                ^~~~~~~
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:105:32: error: function 'SMESH_MeshEditor::ElemFeatures& SMESH_MeshEditor::ElemFeatures::SetQuad(bool)' definition is marked dllimport
  105 |     SMESH_EXPORT ElemFeatures& SetQuad(bool isQuad) { myIsQuad = isQuad; return *this; }
      |                                ^~~~~~~
E:/msys64/tmp/FreeCAD-chennes/src/3rdParty/salomesmesh/inc/SMESH_MeshEditor.hxx:106:32: error: function 'SMESH_MeshEditor::ElemFeatures& SMESH_MeshEditor::ElemFeatures::SetID(int)' definition is marked dllimport
  106 |     SMESH_EXPORT ElemFeatures& SetID  (int ID)      { myID = ID; return *this; }
      |                                ^~~~~
I hacked around those by modifying src/3rdParty/salomesmesh/inc/SMESH_SMESH.hxx and #define SMESH_EXPORT to nothing just to advance to the next error.

Did you resolve the bad cast in src/Base/TimeInfo.cpp +69?
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply