[solved] gmsh: win build errors, update to occt7.5

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: gmsh: win build errors, update to occt7.5

Post by Kunda1 »

looo wrote: Wed Mar 24, 2021 12:31 pm As it seems to get more difficult to build gmsh with visual-studio this would be an easy orkaround. Not sure which occt version is used for the gmsh.exe.

Do we have any possibilities to communicate with gmsh developers? Anyone active in the forum?
Good question, i'm not certain they're on our forum. But..,we can talk to them on their gitlab https://gitlab.onelab.info/gmsh/gmsh/

edit: typo
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: gmsh: win build errors, update to occt7.5

Post by looo »

wmayer wrote: Wed Mar 24, 2021 3:37 pm
looo wrote: Wed Mar 24, 2021 12:31 am
wmayer wrote: Thu Feb 18, 2021 9:18 am
do you have an idea? This blocks us from moving to occt7.5 which is reported to have some important fixes.
Where do you get the gmsh source code from? I guess OCCT support is optional there and possibly to create the gmsh DLL a needed OCCT library (Standard_ErrorHandler is part of TKernel) is not set.
It's defined in the recipe source section:
https://github.com/conda-forge/gmsh-fee ... /meta.yaml
http://gmsh.info/src/gmsh-4.6.0-source.tgz

I had a brief look into the cmake files, but it seems like TKernel is part of the linked libraries:

Code: Select all

    set(OCC_LIBS_REQUIRED
	# subset of DataExchange
      	TKSTEP TKSTEP209 TKSTEPAttr TKSTEPBase TKIGES TKXSBase
      	# ModelingAlgorithms
      	TKOffset TKFeat TKFillet TKBool TKMesh TKHLR TKBO TKPrim TKShHealing
      	TKTopAlgo TKGeomAlgo
      	# ModelingData
      	TKBRep TKGeomBase TKG3d TKG2d
      	# FoundationClasses
      	TKMath TKernel)
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: gmsh: win build errors, update to occt7.5

Post by looo »

This are the occ libraries which are used to link against:

Code: Select all

-- OCC_LIBS: 
${PREFIX}/Library/lib/TKSTEP.lib;
${PREFIX}/Library/lib/TKSTEP209.lib;
${PREFIX}/Library/lib/TKSTEPAttr.lib;
${PREFIX}/Library/lib/TKSTEPBase.lib;
${PREFIX}/Library/lib/TKIGES.lib;
${PREFIX}/Library/lib/TKXSBase.lib;
${PREFIX}/Library/lib/TKOffset.lib;
${PREFIX}/Library/lib/TKFeat.lib;
${PREFIX}/Library/lib/TKFillet.lib;
${PREFIX}/Library/lib/TKBool.lib;
${PREFIX}/Library/lib/TKMesh.lib;
${PREFIX}/Library/lib/TKHLR.lib;
${PREFIX}/Library/lib/TKBO.lib;
${PREFIX}/Library/lib/TKPrim.lib;
${PREFIX}/Library/lib/TKShHealing.lib;
${PREFIX}/Library/lib/TKTopAlgo.lib;
${PREFIX}/Library/lib/TKGeomAlgo.lib;
${PREFIX}/Library/lib/TKBRep.lib;
${PREFIX}/Library/lib/TKGeomBase.lib;
${PREFIX}/Library/lib/TKG3d.lib;
${PREFIX}/Library/lib/TKG2d.lib;
${PREFIX}/Library/lib/TKMath.lib;
${PREFIX}/Library/lib/TKernel.lib
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: gmsh: win build errors, update to occt7.5

Post by looo »

Looking at the header files it seems like empty definitions for the missing functions are available if "OCC_CONVERT_SIGNALS" is not defined. In the gmsh cmake file "OCC_CONVER_SIGNALS" is defined for windows and therefor these functions should be implemented by gmsh (right?)

Code: Select all

// If OCC_CONVERT_SIGNALS is not defined,
// provide empty inline implementation
#if ! defined(OCC_CONVERT_SIGNALS)
inline Standard_ErrorHandler::Callback::Callback ()
       : myHandler(0), myPrev(0), myNext(0)
{
}
inline Standard_ErrorHandler::Callback::~Callback ()
{
  (void)myHandler;
  (void)myPrev;
}
inline void Standard_ErrorHandler::Callback::RegisterCallback ()
{
}
inline void Standard_ErrorHandler::Callback::UnregisterCallback ()
{
}
#endif
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: gmsh: win build errors, update to occt7.5

Post by looo »

wmayer wrote: Wed Mar 24, 2021 3:40 pm
- why occt7.4 works but 7.5 not?
- can we remove the OCC_CONVERT_SIGNALS definition, as it seems to make the builds succeed.
wmayer
Founder
Posts: 20305
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: gmsh: win build errors, update to occt7.5

Post by wmayer »

The description inside Standard_ErrorHandler.hxx explains it all:
//! Support of handling of C signals as C++-style exceptions, and implementation
//! of C++ exception handling on platforms that do not implement these natively.
//!
//! The implementation is based on C long jumps.
//!
//! If macro OCC_CONVERT_SIGNALS is defined, this enables macro OCC_CATCH_SIGNALS
//! that can be used in the code (often inside try {} blocks) to convert C-style
//! signals to standard C++ exceptions. This works only when OSD::SetSignal()
//! is called to set appropriate signal handler. In the case of signal (like
//! access violation, division by zero, etc.) it will jump to the nearest
//! OCC_CATCH_SIGNALS in the call stack, which will then throw a C++ exception.
//! This method is useful for Unix and Linux systems where C++ exceptions
//! cannot be thrown from C signal handler.
//!
//! On Windows with MSVC compiler, exceptions can be thrown directly from
//! signal handler, this OCC_CONVERT_SIGNALS is not needed. Note however that
//! this requires that compiler option /EHa is used.
OCC_CONVERT_SIGNALS only has to be set if not using the MSVC compiler. When building OCCT with MSVC it shouldn't be used because it has the compiler option /EHa to enable Structured Exception Handling (SEH).
- why occt7.4 works but 7.5 not?
I don't know. The content of the files Standard_ErrorHandler.hxx/Standard_ErrorHandler.cxx is almost identical for 7.4 and 7.5.
What I can imagine is that when building OCCT OCC_CONVERT_SIGNALS is not defined and when linking gmsh against OCCT it is set somewhere. The result is that the definition of the Callback class inside the header is not enabled.
- can we remove the OCC_CONVERT_SIGNALS definition, as it seems to make the builds succeed.
Is this set somewhere in one of the CMake files of gmsh?
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: gmsh: win build errors, update to occt7.5

Post by looo »

Thanks for the explaination.
wmayer wrote: Sat Mar 27, 2021 9:47 am Is this set somewhere in one of the CMake files of gmsh?
yes it is set only for windows. Patching this line makes the build succeed:

https://github.com/conda-forge/gmsh-fee ... 1ccb25d93c
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: gmsh: win build errors, update to occt7.5

Post by looo »

I guess this section should be switched:

instead of:

Code: Select all

    if(WIN32)
      list(APPEND EXTERNAL_LIBRARIES "winspool")
      add_definitions(-DOCC_CONVERT_SIGNALS)
    elseif(MSVC)
      add_definitions(-DWNT)
    endif()
it should be:

Code: Select all

   
    if(MSVC)
      add_definitions(-DWNT)
    elseif(WIN32)
      list(APPEND EXTERNAL_LIBRARIES "winspool")
      add_definitions(-DOCC_CONVERT_SIGNALS)
    endif()
Post Reply