Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • VTK VTK
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 778
    • Issues 778
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 211
    • Merge requests 211
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #18033
Closed
Open
Created Oct 16, 2020 by ccorn@ccorn

Provide or replace `FT_CALLBACK_DEF`

freetype as of v2.10.3 no longer exports FT_CALLBACK_DEF. This breaks builds of VTK-8.2.0 when using the system's freetype:

/build/vtk/src/VTK-8.2.0/Rendering/FreeType/vtkFreeTypeTools.cxx:391:1: error: expected constructor, destructor, or type conversion before ‘vtkFreeTypeToolsFaceRequester’
  391 | vtkFreeTypeToolsFaceRequester(FTC_FaceID face_id,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/vtk/src/VTK-8.2.0/Rendering/FreeType/vtkFreeTypeTools.cxx: In member function ‘virtual FT_Error vtkFreeTypeTools::CreateFTCManager()’:
/build/vtk/src/VTK-8.2.0/Rendering/FreeType/vtkFreeTypeTools.cxx:1252:26: error: ‘vtkFreeTypeToolsFaceRequester’ was not declared in this scope; did you mean ‘vtkFreeTypeToolsCleanupCounter’?

Source files using FT_CALLBACK_DEF are:

  • Rendering/FreeType/vtkFreeTypeTools.cxx
  • Rendering/FreeTypeFontConfig/vtkFontConfigFreeTypeTools.cxx

The attached patch files (to be applied with -p1) each work around this error. Each patch file is sufficient; you may want to think about their pros and contras.

  1. Provide the (unchanged) definition of FT_CALLBACK_DEF, unless already defined, in ThirdParty/freetype/vtk_freetype.h.in. This eliminates the need to change the usage.

  2. Explicitly eliminate the reference to FT_CALLBACK_DEF at the points of usage. This basically means using extern "C" explicitly and seems to match the intent of the freetype developers more closely, but the freetype definition still notes the following caveat:

      /* Some 16bit compilers have to redefine these macros to insert    */
      /* the infamous `_cdecl` or `__fastcall` declarations.             */

    If that flexibility is important to you, better stick with (1).

    Note that vtkFontConfigFreeTypeTools.cxx wraps an anonymous namespace around the FT_CALLBACK_DEF. The second patch removes that anonymous namespace because its effect is undone by the extern "C" anyway.

vtk-freetype-2.10.3-provide-FT_CALLBACK_DEF.patch

vtk-freetype-2.10.3-replace-FT_CALLBACK_DEF.patch

Edited Oct 16, 2020 by ccorn
Assignee
Assign to
Time tracking