Flatpak build error

As @llothar recently wrote: “Flatpak itself seem to not have it’s own forum…”, so I’m here.

I’ve successfully built a Flatpak for “myapp” without one of its dependencies. When I try again with that included it fails with

...configure: creating ./config.status
config.status: creating Makefile
config.status: creating glu.pc
config.status: executing depfiles commands
config.status: executing libtool commands
  CC       src/libutil/error.lo
  CC       src/libutil/glue.lo
  CC       src/libutil/mipmap.lo
src/libutil/error.c:60:10: error: ‘NULL’ undeclared here (not in a function)
   60 |    { ~0, NULL } /* end of list indicator */
      |          ^~~~
src/libutil/error.c:34:1: note: ‘NULL’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
   33 | #include <GL/glu.h>
  +++ |+#include <stddef.h>
   34 | 
make: *** [Makefile:1119: src/libutil/error.lo] Error 1
make: *** Waiting for unfinished jobs....
Error: module glu: Child process exited with code 2

It used to work originally, but now I have some time to attempt to finish it, it no longer works.
I don’t know anything about the included application or how to compile it - someone very helpfully wrote that part of the .yml file for me. I can include more of the yml file if that would help.

This part didn’t link to an existing download, until I added the ‘.git’ could that be it? I don’t know why it has ‘Commit:’ where the other parts have what I would expect - ‘sha256:’ .

sha256 is a checksum for a file. commit is a commit in git.

But if you want to build exiv2, I recommend doing like other packages do, like https://github.com/flathub/com.rawtherapee.RawTherapee/blob/master/com.rawtherapee.RawTherapee.yaml#L160

From there I copied and pasted

  • name: exiv2
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
    • -DCMAKE_BUILD_TYPE=RelWithDebInfo
    • -DEXIV2_BUILD_DOC:BOOL=OFF
    • -DEXIV2_BUILD_SAMPLES:BOOL=OFF
    • -DEXIV2_BUILD_EXIV2_COMMAND:BOOL=OFF
      sources:
    • type: archive
      url: http://www.exiv2.org/builds/exiv2-0.27.3-Source.tar.gz
      sha256: a79f5613812aa21755d578a297874fb59a85101e793edc64ec2c6bd994e3e778
    • type: patch
      path: exiv2-build-arm.patch

This fails with

Failed to download sources: module exiv2: Can’t find file at exiv2-build-arm.patch

I was reluctant to mess with a manifest (specification file) which was written by an expert and I didn’t understand. However, since it no longer works I haven’t got a lot to lose! I have removed all the sections except the one for the particular function I want. That seemed to work better, but later errored complaining it was missing something - which was in another section. Replacing that too has resulted in the building taking a very long time - which is a good thing as it means progress. I’m waiting for it to finish - one way or another.

Edit: It keeps failing complaining that bits are missing, so I keep replacing them, looks like they may all be necessary after all.

which app is that?

You need to get the patch from the same repository and put it next to the manifest.

Are you trying to flatpak Hugin?

(I have it locally here, but the build segfault on 20.08 and work on 19.08)

That sounds useful, myapp uses an OS call to run align-image-stack on some files. I don’t need any other Hugin function. I think align-image-stack is a part of hugin-tools.

If you were able to pick out the bits that are needed I’d be interested to see it.

You can have a look at the PR (draft)

I’ll compare that with what I’ve got.

I will use your version of exiv and I have found the patch for exiv here https://github.com/flathub/com.rawtherapee.RawTherapee/blob/master/exiv2-build-arm.patch but have no idea to include it so have missed it out. Since it mentions “arm”, I’m wondering whether that is something to do with ARM processors and I might not need it.

I had a look at sourceforge, then decided to retry with what I’ve got first. I removed the sections except align-image-stack and replaced them as the build complained about them being missing. They were all necessary. It all seems alright (for about 1/2hr) until it gets to here:

[62/304] Building CXX object src/hugin…inbase.dir/panodata/SrcPanoImage.cpp.o
FAILED: src/hugin_base/CMakeFiles/huginbase.dir/panodata/SrcPanoImage.cpp.o
/usr/bin/c++ -DGLEW_STATIC -Dhuginbase_EXPORTS -Isrc -I…/src/hugin_base -I…/src/celeste -Isrc/celeste -I…/src -I/app/include/OpenEXR -I/app/include -I…/src/foreign -march=x86-64 -mtune=generic -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 -O2 -g -DNDEBUG -fPIC -fopenmp -pthread -std=gnu++11 -MD -MT src/hugin_base/CMakeFiles/huginbase.dir/panodata/SrcPanoImage.cpp.o -MF src/hugin_base/CMakeFiles/huginbase.dir/panodata/SrcPanoImage.cpp.o.d -o src/hugin_base/CMakeFiles/huginbase.dir/panodata/SrcPanoImage.cpp.o -c …/src/hugin_base/panodata/SrcPanoImage.cpp
…/src/hugin_base/panodata/SrcPanoImage.cpp: In member function ‘bool HuginBase::SrcPanoImage::readEXIF()’:
…/src/hugin_base/panodata/SrcPanoImage.cpp:358:30: error: expected unqualified-id before ‘&’ token
catch (const Exiv2::Error& e)
^
…/src/hugin_base/panodata/SrcPanoImage.cpp:358:30: error: expected ‘)’ before ‘&’ token
catch (const Exiv2::Error& e)
~ ^
)
…/src/hugin_base/panodata/SrcPanoImage.cpp:358:30: error: expected ‘{’ before ‘&’ token
…/src/hugin_base/panodata/SrcPanoImage.cpp:358:32: error: ‘e’ was not declared in this scope
catch (const Exiv2::Error& e)
^
[63/304] Building CXX object src/hugin…dir/panodata/ImageVariableGroup.cpp.o

Hopefully if we can align-image-stack working it will be a step towards you getting your Hugin Flatpak working.

the build from the pull request above should actually work. Just that it uses the 19.08 runtime.

I don’t really understand that. Are you saying that the exiv section should be okay? Is it related to this section?

runtime: org.gnome.Platform
runtime-version: “3.30”
sdk: org.gnome.Sdk

This section might be the whole problem. the 3.30 SDK is old. Try 3.36, or 3.38. But for Hugin I just use the org.freedesktop.Platform//19.08 platform / SDK

Mixup! I was supposed to be using 3.38, but I went back to the original manifest to get rid of my mods adn forgot to edit out ‘3.30’. Correcting it to 3.38 brings back the original error. I’ll install org.freedesktop.Platform//19.08 platform / SDK and try that.

the matching GNOME sdk is 3.36 if you prefer that.

(not having the content of your manifest makes it all a guess work)

I couldn’t find a way to attach it and hadn’t included it inline because I thought it was too big, but here it is.

> app-id: com.github.myapp.myapp
> runtime: org.gnome.Platform
> runtime-version: "3.38"
> sdk: org.gnome.Sdk
> command: myapp
> rename-desktop-file: myapp.desktop
> rename-icon: myapp_logo
> copy-icon: true
> finish-args:
>   - --share=ipc
>   - --socket=x11
>   - --socket=wayland
>   - --filesystem=xdg-run/dconf
>   - --filesystem=~/.config/dconf:ro
>   - --talk-name=ca.desrt.dconf
>   - --env=DCONF_USER_CONFIG_DIR=.config/dconf
>   - --filesystem=host:rw
> modules:
>   - name: python3-pillow
>     buildsystem: simple
>     build-commands:
>       - pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} Pillow Pillow-PIL
>     sources:
>       - type: file
>         url: https://files.pythonhosted.org/packages/3c/7e/443be24431324bd34d22dd9d11cc845d995bcd3b500676bcf23142756975/Pillow-5.4.1.tar.gz
>         sha256: 5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f
>       - type: file
>         url: https://files.pythonhosted.org/packages/5d/e1/d298934cd78984a5e8d616945349ed66a74b9df0337fb1941ce76b8a2b7b/Pillow-PIL-0.1dev.tar.gz
>         sha256: d80ee30805f10bf898df9ce7495f46e88990e8f90b5c2b917722d87526252b2c
> 
>   # Hugin deps
>   - shared-modules/glew/glew.json
>   - shared-modules/glu/glu-9.0.0.json
> 
>   - name: wxWidgets
>     rm-configure: true
>     cleanup:
>       - /bin
>       - /share/bakefile
>     config-opts:
>       - --with-opengl
>       - --with-libjpeg
>       - --with-libtiff
>       - --with-libpng
>       - --with-zlib
>       - --disable-sdltest
>       - --enable-unicode
>       - --enable-display
>       - --enable-propgrid
>       - --disable-webkit
>       - --disable-webview
>       - --disable-webviewwebkit
>       - --with-expat=builtin
>       - --with-libiconv=/usr
>     build-options:
>       cxxflags: "-std=c++0x"
>     sources:
>       - type: archive
>         url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.4/wxWidgets-3.0.4.tar.bz2
>         sha256: 96157f988d261b7368e5340afa1a0cad943768f35929c22841f62c25b17bf7f0
>     cleanup:
>       - /bin
>       - /lib
>       - /doc
>       - /share
> 
>   - name: libpano13
>     buildsystem: cmake # cmake-ninja doesn't work OK with libpano13 and __FILE__ macro in its sources
>     builddir: true
>     sources:
>       - type: archive
>         url: https://downloads.sourceforge.net/project/panotools/libpano13/libpano13-2.9.19/libpano13-2.9.19.tar.gz
>         sha256: 037357383978341dea8f572a5d2a0876c5ab0a83dffda431bd393357e91d95a8
>     cleanup:
>       - /bin
>       - /share
> 
>   - name: ilmbase
>     config-opts:
>       - --disable-static
>     sources:
>       - type: archive
>         url: https://download.savannah.nongnu.org/releases/openexr/ilmbase-2.2.1.tar.gz
>         sha256: cac206e63be68136ef556c2b555df659f45098c159ce24804e9d5e9e0286609e
> 
>   - name: openexr
>     config-opts:
>       - --disable-static
>     sources:
>       - type: archive
>         url: https://download.savannah.nongnu.org/releases/openexr/openexr-2.2.1.tar.gz
>         sha256: 8f9a5af6131583404261931d9a5c83de0a425cb4b8b25ddab2b169fbf113aecd
>     cleanup:
>       - /bin
>       - /share/doc
> 
>   - name: vigra
>     buildsystem: cmake-ninja
>     config-opts:
>        - -DWITH_OPENEXR=ON
>     sources:
>       - type: archive
>         url: https://github.com/ukoethe/vigra/archive/Version-1-11-1.tar.gz
>         sha256: b2718250d28baf1932fcbe8e30f7e4d146e751ad0e726e375a72a0cdb4e3250e
>     cleanup:
>       - /bin
>       - /doc
>       - /lib/vigra/
>       - /share
> 
>   - name: exiv2
>     buildsystem: cmake-ninja
>     builddir: true
>     config-opts:
>       - -DCMAKE_BUILD_TYPE=RelWithDebInfo
>       - -DEXIV2_BUILD_DOC:BOOL=OFF
>       - -DEXIV2_BUILD_SAMPLES:BOOL=OFF
>       - -DEXIV2_BUILD_EXIV2_COMMAND:BOOL=OFF
>     sources:
>       - type: archive
>         url: http://www.exiv2.org/builds/exiv2-0.27.3-Source.tar.gz
>         sha256: a79f5613812aa21755d578a297874fb59a85101e793edc64ec2c6bd994e3e778
>         
>   - name: boost
>     buildsystem: simple
>     build-commands:
>       - "./bootstrap.sh --prefix=/app --with-libraries=atomic,chrono,date_time,filesystem,iostreams,program_options,system,thread"
>       - "./b2 -j $FLATPAK_BUILDER_N_JOBS install"
>     sources:
>       - type: archive
>         url: https://dl.bintray.com/boostorg/release/1.68.0/source/boost_1_68_0.tar.bz2
>         sha256: 7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7
>     
>   - name: align_image_stack
>     buildsystem: cmake-ninja
>     builddir: true
>     sources:
>       - type: archive
>         url: https://downloads.sourceforge.net/project/hugin/hugin/hugin-2018.0/hugin-2018.0.0.tar.bz2
>         sha256: d3af0d066ac50e3bb243a175a64ecda136d87178419457e8822e11bcf0e565cb
>     cleanup:
>       - /bin/autooptimiser
>       - /bin/calibrate_lens_gui
>       - /bin/celeste_standalone
>       - /bin/checkpto
>       - /bin/cpclean
>       - /bin/cpfind
>       - /bin/deghosting_mask
>       - /bin/fulla
>       - /bin/geocpset
>       - /bin/hugin*
>       - /bin/icpfind
>       - /bin/linefind
>       - /bin/nona
>       - /bin/pano*
>       - /bin/PT*
>       - /bin/pto_*
>       - /bin/tca_correct
>       - /bin/verdandi
>       - /bin/vig_optimize
>       - /lib/libceleste*
>       - /lib/libhuginbaswwx*
>       - /lib/libicpfindlib*
>       - /lib/liblocalfeatures*
>       - /share
> 
>   - name: myapp
>     buildsystem: meson
>     sources:
>       - type: git
>         url: https://github.com/myapp/myapp
configure: creating ./config.status
config.status: creating Makefile
config.status: creating glu.pc
config.status: executing depfiles commands
config.status: executing libtool commands
  CC       src/libutil/error.lo
  CC       src/libutil/glue.lo
  CC       src/libutil/mipmap.lo
src/libutil/error.c:60:10: error: ‘NULL’ undeclared here (not in a function)
   60 |    { ~0, NULL } /* end of list indicator */
      |          ^~~~
src/libutil/error.c:34:1: note: ‘NULL’ is defined in header ‘<stddef.h>’; did you forget to ‘#include <stddef.h>’?
   33 | #include <GL/glu.h>
  +++ |+#include <stddef.h>
   34 | 
make: *** [Makefile:1119: src/libutil/error.lo] Error 1
make: *** Waiting for unfinished jobs....
Error: module glu: Child process exited with code 2

Using 36 I still get the same old error.

I thought I’d better include these from the shared-modules directory.
glu-9.0.0.json

{
  "name": "glu",
  "config-opts": ["--disable-static"],
  "sources": [
    {
      "type": "archive",
      "url": "https://mesa.freedesktop.org/archive/glu/glu-9.0.0.tar.bz2",
      "sha256": "1f7ad0d379a722fcbd303aa5650c6d7d5544fde83196b42a73d1193568a4df12"
    }
  ],
  "cleanup": [ "/include", "/lib/*.a", "/lib/*.la", "/lib/pkgconfig" ]
}

glew.json

{
“name”: “glew”,
“no-autogen”: true,
“make-args”: [
“GLEW_PREFIX=/app”,
“GLEW_DEST=/app”,
“LIBDIR=/app/lib”
],
“make-install-args”: [
“GLEW_PREFIX=/app”,
“GLEW_DEST=/app”,
“LIBDIR=/app/lib”
],
“sources”: [
{
“type”: “archive”,
“url”: “https://downloads.sourceforge.net/project/glew/glew/2.1.0/glew-2.1.0.tgz”,
“sha256”: “04de91e7e6763039bc11940095cd9c7f880baba82196a7765f727ac05a993c95”
}
],
“cleanup”: [
“/include”,
“/lib/pkgconfig”,
“/lib/*.a”
]
}

Strangely three of my posts have been hidden because they are “spam” or “advertisements”, I suspect the system is a trifle over-sensitive.

Try updating the shared-modules and then you need to use the renamed json. The manifest for glu has changed, and I suspect that the source of your troubles.