Building a C++ module

I’m updating a Flatpak so it’ll run on Gnome platform 41. C++ has been updated, to the point that several modules from other sources which it depends on, which were written for much older versions fail. I have managed to fix most of them, however I couldn’t get Vigra to compile and it hasn’t had any work done on it for years.

  - name: vigra
    buildsystem: cmake
    config-opts:
       - -DWITH_OPENEXR=ON
    sources:
      - type: archive
        path: /home/chris/vigra-1.11.1.tar.gz
    cleanup:
      - /bin
      - /doc
      - /lib/vigra/
      - /share

Fedora has patched it and I created the patched version by doing this (from Ask Fedora):

sudo dnf -y install fedpkg
fedpkg clone --anonymous vigra
cd vigra
fedpkg prep

That creates a vigra-1.11.1 sub-directory which has all of the Fedora patches applied. Unfortunately that fails too. I am not a C++ programmer so I’m stuck now.

========================================================================
Building module vigra in /home/chris/.flatpak-builder/build/vigra-13
========================================================================
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.21)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
CMake Warning (dev) at examples/tutorial/CMakeLists.txt:23 (ADD_EXECUTABLE):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /run/build/vigra/examples/tutorial/graph_agglomerative_clustering.cxx
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at examples/tutorial/CMakeLists.txt:23 (ADD_EXECUTABLE):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /run/build/vigra/examples/tutorial/smooth_blockwise.cxx
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    WITH_OPENEXR


-- Build files have been written to: /run/build/vigra
[1/22] Building CXX object impex/CMakeFiles/vigraimpex.dir/bmp.o
FAILED: impex/CMakeFiles/vigraimpex.dir/bmp.o 
/usr/bin/c++   -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -MD -MT impex/CMakeFiles/vigraimpex.dir/bmp.o -MF impex/CMakeFiles/vigraimpex.dir/bmp.o.d -o impex/CMakeFiles/vigraimpex.dir/bmp.o -c /run/build/vigra/impex/bmp.cxx
/run/build/vigra/impex/bmp.cxx:38:10: fatal error: vigra/config.hxx: No such file or directory
   38 | #include "vigra/config.hxx"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
Error: module vigra: Child process exited with code 1

vigra builds fine with Hugin (21.08 is the base for GNOME 41)

I’ve found that my manifest with align-image-stack can’t be built on most gnome platforms which is why I have my own. I’m giving yours a try. I’ve looked at the manifest to see where to put the new files, I assumed it was looking for them locally like glu and glew.

net.sourceforge.Hugin.json  is in /home/chris/flatpak
exiftool-sources.json 			  /home/chris/flatpak
openexr-no-docs.patch 		      /home/chris/flatpak/patches

It finds exiftools-sources, but not openexr-no-docs
{
“type”: “patch”,
“path”: “patches/openexr-no-docs.patch”
},
maybe it’s looking for it in a location related to the URL in the lines above it.

I’d rather adapt yours as mine requires constant maintenance as some of the external modules are no longer maintained. The version of mine I am working on no longer needs ilmbase as it uses openexrv3.1.3 which uses imath instead which is perhaps an advantage.

If I use your vigra module adapted to the yml format in my manifest:

  - name: vigra
    buildsystem: cmake-ninja
    config-opts:
       - -DWITH_OPENEXR=ON 
    sources:
      - type: archive
        url: https://github.com/ukoethe/vigra/releases/download/Version-1-11-1/vigra-1.11.1-src.tar.gz
        sha256: a5564e1083f6af6a885431c1ee718bad77d11f117198b277557f8558fa461aaf        
    post-install:
      - install: Dm644 -t ${FLATPAK_DEST}/share/licenses/vigra LICENSE.txt"
    cleanup:
      - /bin
      - /doc
      - /include
      - /lib/vigra/
      - /share
      - /lib/vigra/*.cmake
      - /share/man

align-image-stack (I don’t need all of hugin) fails:

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
Building module align_image_stack in /home/chris/.flatpak-builder/build/align_image_stack-11
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
-- The C compiler identification is GNU 11.2.0
-- The CXX compiler identification is GNU 11.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Current HG revision is f77f3586f101
-- Assuming this is a tarball (release) build for 2021.0.0
-- Looking for log1p
-- Looking for log1p - found
-- Found wxWidgets: -L/app/lib;-pthread;;;-lwx_baseu-3.1;-lwx_gtk3u_core-3.1;-lwx_gtk3u_aui-3.1;-lwx_gtk3u_xrc-3.1;-lwx_gtk3u_html-3.1;-lwx_baseu_xml-3.1;-lwx_gtk3u_gl-3.1;-lwx_baseu_net-3.1;-lwx_gtk3u_qa-3.1 (found version "3.1.5") 
-- Found TIFF: /usr/include
-- Found JPEG: /usr/include
-- Found ZLIB: /usr/include
-- Found PNG: /usr/include
-- WARNING: you are using the obsolete 'PKGCONFIG' macro, use FindPkgConfig
-- Could not find OPTIONAL package OPENEXR
-- Found OPENEXR: /app/lib/libOpenEXR.so;/app/lib/libImath.so;/app/lib/libIex.so;/app/lib/libIlmThread.so;/usr/lib/x86_64-linux-gnu/libz.so
-- Found VIGRA: /app/lib/libvigraimpex.so
-- VIGRA version: 1.11.1
CMake Error at CMakeModules/FindVIGRA.cmake:78 (MESSAGE):
  Libvigraimpex found.  But vigraimpex seems to compiled without OpenEXR
  support.  OpenEXR support is required for Hugin.
Call Stack (most recent call first):
  CMakeLists.txt:223 (FIND_PACKAGE)

-- Configuring incomplete, errors occurred!
See also "/run/build/align_image_stack/_flatpak_build/CMakeFiles/CMakeOutput.log".
Error: module align_image_stack: Child process exited with code 1