How to include libraries into my first ever flatpak?

I use Flatpak 1.14.4 on Ubuntu 22.03. I have been using like end-user flatpaks for years. But now I would like to build one of the flatpak myself.

I would like to build probably quite simple flatpak using PasswordSafe password manager.
Home page: XXXwww.pwsafe.orgXXX
Source code: XXXhttps://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gzXXX

I am complete newbee building flatpaks! I have been reading tons of internet sources related to flatpak and now I am try and miss…

BUILD PASSWORDSAFE PROGRAM FROM SOURCE

  1. Download program’s source code from: https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz
  2. Extract tar file.
  3. In extracted directory there is Misc subdir. From this subdir execute: ./setup-linux-dev-env.sh
    This command installs dependency libraries.
  4. More or less compile program’s source code, by following instructions in: README.LINUX.DEVELOPERS.md file (just copy/paste few commands).

BUILDING FLATPAK
Now I would like to create my first flatpak (if ignoring the ones on several internet sources).

  1. I opened terminal and changed directory to ~/Downloads, created file make.sh with 700 file permissions and then run the file: “./make.sh” Content of file is:
#!/bin/bash

# Install flatpak-builder
sudo apt -y install flatpak-builder

# Create src dir
mkdir src

# Download programs source code from https://github.com/pwsafe/pwsafe/releases?q=non-windows&expanded=true
wget https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz --directory-prefix src/

# Create Manifest file
cat > com.github.pwsafe.pwsafe.yml <<EOL
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
modules:
  - name: pwsafe
    buildsystem: cmake
    sources:
      - type: archive
        path: src/1.17.0.tar.gz
EOL

# Build flatpak
flatpak-builder --force-clean build-dir com.github.pwsafe.pwsafe.yml
  1. Output of ./make.sh is missing dependency library: “libqrencode-dev(el) not installed”.
Details
========================================================================
Building module pwsafe in /home/igor/Downloads/.flatpak-builder/build/pwsafe-2
========================================================================
-- The CXX compiler identification is GNU 12.2.0
-- The C compiler identification is GNU 12.2.0
-- 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
-- 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
-- Interprocedural optimization (LTO/LTCG) is enabled.
-- Found UnixCommands: /usr/bin/bash  
-- Performing Test HARDEN_COMPILE_WFORMAT
-- Performing Test HARDEN_COMPILE_WFORMAT - Success
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY - Success
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY - Failed
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION - Success
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG - Success
-- Performing Test HARDEN_LINK_Z_RELRO
-- Performing Test HARDEN_LINK_Z_RELRO - Success
-- Performing Test HARDEN_LINK_Z_NOW
-- Performing Test HARDEN_LINK_Z_NOW - Success
-- Looking for qrencode.h
-- Looking for qrencode.h - not found
CMake Error at CMakeLists.txt:85 (message):
  libqrencode-dev(el) not installed: install or select NO_QR

Compiler is throwing out an error, because dependency library is missing. When compiling into binary file those packages are installed as “apt install libqrencode-dev” (from Misc/setup-linux-dev-env.sh).

Like I understand, somehow in my Manifest file I need to include dependency libraries.

For example I have found required library source code for my error “libqrencode-dev”. It is available from: https://fukuchi.org/works/qrencode/qrencode-4.1.1.tar.gz
Library home page: hhttps://fukuchi.org/works/qrencode/index.html

Do I need to download and compile every dependent library main program is requiring or can I include it from some other source like deb package or something?

I am stuck here… any idea is greatly appreciated.

I know there are Dependencies and Manifests in documentation, but… pretty steep learning curve.

Regards

Hey, you can probably just borrow the module code from one of these. https://github.com/search?q=org%3Aflathub+libqrencode&type=code

I would also advice, to not build the flatpak in your download folder, as there are probably many more files in there, that could confuse you/make stuff hard to find. At least move it into a sub folder of downloads. (or better something else)

And if you know your way around git, feel free to push it somewhere, makes it much easier to jump in and help you.

1 Like

@razzeee, your link really helped. I have added “libqrencode” to my manifest file following your advice and also added “wxwidgets” the same way, because of new error message I got.

Now I am stuck at the error:

fatal: unable to access XXXhttps://github.com/google/googletest.git/:XXX Could not resolve host: XXXgithub.comXXX

Note: I have added XXX, because forum is complaining I can post those web links.

Details
Downloading sources
Starting build of com.github.pwsafe.pwsafe
Cache hit for libqrencode, skipping build
Cache hit for wxwidgets, skipping build
Cache miss, checking out last cache hit
========================================================================
Building module pwsafe in /home/igor/flatpak/.flatpak-builder/build/pwsafe-12
========================================================================
-- The CXX compiler identification is GNU 12.2.0
-- The C compiler identification is GNU 12.2.0
-- 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
-- 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
-- Interprocedural optimization (LTO/LTCG) is enabled.
-- Found UnixCommands: /usr/bin/bash  
-- Performing Test HARDEN_COMPILE_WFORMAT
-- Performing Test HARDEN_COMPILE_WFORMAT - Success
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY - Success
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY - Failed
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION - Success
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG - Success
-- Performing Test HARDEN_LINK_Z_RELRO
-- Performing Test HARDEN_LINK_Z_RELRO - Success
-- Performing Test HARDEN_LINK_Z_NOW
-- Performing Test HARDEN_LINK_Z_NOW - Success
-- Looking for qrencode.h
-- Looking for qrencode.h - found
-- Found wxWidgets: -L/app/lib;-pthread;;;-lwx_gtk3u_aui-3.2;-lwx_baseu-3.2;-lwx_gtk3u_core-3.2;-lwx_gtk3u_html-3.2;-lwx_baseu_net-3.2 (found version "3.2.2") 
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.9")  
-- Found Magic: /usr/lib/x86_64-linux-gnu/libmagic.so  
-- Looking for uuid/uuid.h
-- Looking for uuid/uuid.h - found
-- Looking for yk_init in ykpers-1
-- Looking for yk_init in ykpers-1 - not found
-- Yubikey support disabled
CMake Warning at CMakeLists.txt:147 (message):
  XML enabled but XercesC_INCLUDE_DIR unset - using default


CMake Warning at CMakeLists.txt:151 (message):
  XML enabled but XercesC_LIBRARY unset - using default


-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /run/build/pwsafe/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
-- Had to git clone more than once: 3 times.
CMake Error at googletest-download/googletest-prefix/tmp/googletest-gitclone.cmake:39 (message):
  Failed to clone repository: 'https://github.com/google/googletest.git'


make[2]: *** [CMakeFiles/googletest.dir/build.make:99: googletest-prefix/src/googletest-stamp/googletest-download] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/googletest.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
CMake Error at CMakeLists.txt:240 (add_subdirectory):
  add_subdirectory given source "/run/build/pwsafe/googletest-src" which is
  not an existing directory.


-- Found Git: /usr/bin/git (found version "2.41.0") 
-- Updating version file (1.17.0 local).
-- Configuring incomplete, errors occurred!
Error: module pwsafe: Child process exited with code 1

My current manifest file:

app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
modules:

  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  - name: pwsafe
    buildsystem: cmake
    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744

The module pwsafe is trying to download googletest during the build stage, of which it cant as internet access is disabled then.

So you will either need to add a module similar to how you did for wxwidgets and libqrencode, or somehow disable testing during the build, to avoid needing googletest in the first place.

If you go the path off adding googletest to the manifest, since its just a build dependency you should remember to clean it up afterwards.

1 Like

@HighKingofMelons, thanks. According to your advice I have now added googletest to my manifest:

  - name: gtest
    buildsystem: cmake
    sources:
       -  type: archive
          url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
          sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

but I am still getting the same error message:
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com

My new manifest
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
modules:

  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  - name: gtest
    buildsystem: cmake
    sources:
       -  type: archive
          url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
          sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

  - name: pwsafe
    buildsystem: cmake
    build-commands:
        git config --global --unset https.proxy
    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744
New flatpak-builder output
Emptying app dir 'build-dir'
Downloading sources
Starting build of com.github.pwsafe.pwsafe
Cache hit for libqrencode, skipping build
Cache hit for wxwidgets, skipping build
Cache hit for gtest, skipping build
Cache miss, checking out last cache hit
========================================================================
Building module pwsafe in /opt/flatpak/.flatpak-builder/build/pwsafe-5
========================================================================
-- The CXX compiler identification is GNU 12.2.0
-- The C compiler identification is GNU 12.2.0
-- 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
-- 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
-- Interprocedural optimization (LTO/LTCG) is enabled.
-- Found UnixCommands: /usr/bin/bash  
-- Performing Test HARDEN_COMPILE_WFORMAT
-- Performing Test HARDEN_COMPILE_WFORMAT - Success
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY - Success
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY - Failed
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION - Success
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG - Success
-- Performing Test HARDEN_LINK_Z_RELRO
-- Performing Test HARDEN_LINK_Z_RELRO - Success
-- Performing Test HARDEN_LINK_Z_NOW
-- Performing Test HARDEN_LINK_Z_NOW - Success
-- Looking for qrencode.h
-- Looking for qrencode.h - found
-- Found wxWidgets: -L/app/lib;-pthread;;;-lwx_gtk3u_aui-3.2;-lwx_baseu-3.2;-lwx_gtk3u_core-3.2;-lwx_gtk3u_html-3.2;-lwx_baseu_net-3.2 (found version "3.2.2") 
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.9")  
-- Found Magic: /usr/lib/x86_64-linux-gnu/libmagic.so  
-- Looking for uuid/uuid.h
-- Looking for uuid/uuid.h - found
-- Looking for yk_init in ykpers-1
-- Looking for yk_init in ykpers-1 - not found
-- Yubikey support disabled
CMake Warning at CMakeLists.txt:147 (message):
  XML enabled but XercesC_INCLUDE_DIR unset - using default


CMake Warning at CMakeLists.txt:151 (message):
  XML enabled but XercesC_LIBRARY unset - using default


-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /run/build/pwsafe/googletest-download
[ 11%] Creating directories for 'googletest'
[ 22%] Performing download step (git clone) for 'googletest'
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
Cloning into 'googletest-src'...
fatal: unable to access 'https://github.com/google/googletest.git/': Could not resolve host: github.com
-- Had to git clone more than once: 3 times.
CMake Error at googletest-download/googletest-prefix/tmp/googletest-gitclone.cmake:39 (message):
  Failed to clone repository: 'https://github.com/google/googletest.git'


make[2]: *** [CMakeFiles/googletest.dir/build.make:99: googletest-prefix/src/googletest-stamp/googletest-download] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/googletest.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
CMake Error at CMakeLists.txt:240 (add_subdirectory):
  add_subdirectory given source "/run/build/pwsafe/googletest-src" which is
  not an existing directory.


-- Found Git: /usr/bin/git (found version "2.41.0") 
-- Updating version file (1.17.0 local).
-- Configuring incomplete, errors occurred!
Error: module pwsafe: Child process exited with code 1

@HighKingofMelons I have figured out how to disable Google Test. Option can be made to cmake compiter like:

    config-opts:
      - -DNO_GTEST=ON

Now build gone pass google-test, but now I am falling into new issue, like another library missing. I have search github flatpak, but can’t find “libos” library in any other flatpak manifest. Error I get:

[ 23%] Linking CXX static library libos.a
[ 23%] Built target os
make: *** [Makefile:166: all] Error 2
My new manifest
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
modules:

  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  #- name: gtest
  #  buildsystem: cmake
  #  sources:
  #     -  type: archive
  #        url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
  #        sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

  - name: pwsafe
    buildsystem: cmake
    config-opts:
      - -DNO_YUBI=ON
      - -DNO_GTEST=ON
      - -DGTEST_BUILD=OFF

    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744
New flatpak-builder output
Downloading sources
Starting build of com.github.pwsafe.pwsafe
Cache hit for libqrencode, skipping build
Cache hit for wxwidgets, skipping build
Cache miss, checking out last cache hit
========================================================================
Building module pwsafe in /opt/flatpak/.flatpak-builder/build/pwsafe-15
========================================================================
-- The CXX compiler identification is GNU 12.2.0
-- The C compiler identification is GNU 12.2.0
-- 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
-- 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
-- Interprocedural optimization (LTO/LTCG) is enabled.
-- Found UnixCommands: /usr/bin/bash  
-- Performing Test HARDEN_COMPILE_WFORMAT
-- Performing Test HARDEN_COMPILE_WFORMAT - Success
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WFORMAT_SECURITY - Success
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY
-- Performing Test HARDEN_COMPILE_WERROR_FORMAT_SECURITY - Failed
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION
-- Performing Test HARDEN_COMPILE_STACK_CLASH_PROTECTION - Success
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_COMPILE_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK
-- Performing Test HARDEN_LINK_SANITIZE_SAFE_STACK - Failed
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG
-- Performing Test HARDEN_COMPILE_STACK_PROTECTOR_STRONG - Success
-- Performing Test HARDEN_LINK_Z_RELRO
-- Performing Test HARDEN_LINK_Z_RELRO - Success
-- Performing Test HARDEN_LINK_Z_NOW
-- Performing Test HARDEN_LINK_Z_NOW - Success
-- Looking for qrencode.h
-- Looking for qrencode.h - found
-- Found wxWidgets: -L/app/lib;-pthread;;;-lwx_gtk3u_aui-3.2;-lwx_baseu-3.2;-lwx_gtk3u_core-3.2;-lwx_gtk3u_html-3.2;-lwx_baseu_net-3.2 (found version "3.2.2") 
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.9")  
-- Found Magic: /usr/lib/x86_64-linux-gnu/libmagic.so  
-- Looking for uuid/uuid.h
-- Looking for uuid/uuid.h - found
-- Yubikey support disabled
CMake Warning at CMakeLists.txt:147 (message):
  XML enabled but XercesC_INCLUDE_DIR unset - using default


CMake Warning at CMakeLists.txt:151 (message):
  XML enabled but XercesC_LIBRARY unset - using default


-- Found Git: /usr/bin/git (found version "2.41.0") 
-- Updating version file (1.17.0 local).
-- Configuring done (2.0s)
-- Generating done (0.0s)
-- Build files have been written to: /run/build/pwsafe
[  0%] Generating core_st.cpp, core_st.h
[  1%] Generating helpEN.zip
[  2%] Generating version.h, version.h.nosuchfile
[  3%] Generating helpRU.zip
[  3%] Generating mos/da/LC_MESSAGES/pwsafe.mo
[  3%] Building CXX object src/os/CMakeFiles/os.dir/unix/KeySend.cpp.o
[  4%] Generating pwsafe.1.gz
mv: '/run/build/pwsafe/src/core/core_st.cpp' and '/run/build/pwsafe/src/core/core_st.cpp' are the same file
make[2]: *** [src/core/CMakeFiles/core.dir/build.make:75: src/core/core_st.cpp] Error 1
make[2]: *** Deleting file 'src/core/core_st.cpp'
make[1]: *** [CMakeFiles/Makefile2:327: src/core/CMakeFiles/core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  4%] Generating helpDE.zip
-- Updating version file (1.17.0 local).
[  5%] Building CXX object src/os/CMakeFiles/os.dir/unix/UUID.cpp.o
[  5%] Built target manpage
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_da.po:8: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_da.po:8: warning: header field 'PO-Revision-Date' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_da.po:8: warning: header field 'Last-Translator' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_da.po:8: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_da.po:8: warning: header field 'Language' still has the initial default value
[  6%] Generating mos/de/LC_MESSAGES/pwsafe.mo
[  6%] Built target pws_version_intermediate
[  6%] Generating mos/es/LC_MESSAGES/pwsafe.mo
[  6%] Generating helpES.zip
[  7%] Generating helpFR.zip
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_es.po:8: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_es.po:8: warning: header field 'PO-Revision-Date' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_es.po:8: warning: header field 'Last-Translator' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_es.po:8: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_es.po:8: warning: header field 'Language' still has the initial default value
[  7%] Generating helpPL.zip
[  7%] Generating helpZH.zip
[  8%] Generating mos/fr/LC_MESSAGES/pwsafe.mo
[  9%] Building CXX object src/os/CMakeFiles/os.dir/unix/cleanup.cpp.o
[  9%] Building CXX object src/os/CMakeFiles/os.dir/unix/debug.cpp.o
[ 10%] Building CXX object src/os/CMakeFiles/os.dir/unix/dir.cpp.o
[ 10%] Building CXX object src/os/CMakeFiles/os.dir/unix/env.cpp.o
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_fr.po:7: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_fr.po:7: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_fr.po:7: warning: header field 'Language' still has the initial default value
[ 10%] Generating mos/hu/LC_MESSAGES/pwsafe.mo
[ 10%] Built target helpfiles
[ 11%] Generating mos/it/LC_MESSAGES/pwsafe.mo
[ 11%] Generating mos/ko/LC_MESSAGES/pwsafe.mo
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_it.po:7: warning: header field 'Language-Team' still has the initial default value
[ 12%] Generating mos/nl/LC_MESSAGES/pwsafe.mo
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_ko.po:8: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_ko.po:8: warning: header field 'PO-Revision-Date' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_ko.po:8: warning: header field 'Last-Translator' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_ko.po:8: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_ko.po:8: warning: header field 'Language' still has the initial default value
[ 12%] Generating mos/pl/LC_MESSAGES/pwsafe.mo
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_nl.po:8: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_nl.po:8: warning: header field 'PO-Revision-Date' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_nl.po:8: warning: header field 'Last-Translator' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_nl.po:8: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_nl.po:8: warning: header field 'Language' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_pl.po:8: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_pl.po:8: warning: header field 'PO-Revision-Date' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_pl.po:8: warning: header field 'Last-Translator' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_pl.po:8: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_pl.po:8: warning: header field 'Language' still has the initial default value
[ 13%] Generating mos/ru/LC_MESSAGES/pwsafe.mo
[ 13%] Generating mos/sv/LC_MESSAGES/pwsafe.mo
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_sv.po:7: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_sv.po:7: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_sv.po:7: warning: header field 'Language' still has the initial default value
[ 14%] Generating mos/zh/LC_MESSAGES/pwsafe.mo
[ 15%] Building CXX object src/os/CMakeFiles/os.dir/unix/file.cpp.o
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_zh.po:8: warning: header field 'Project-Id-Version' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_zh.po:8: warning: header field 'PO-Revision-Date' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_zh.po:8: warning: header field 'Last-Translator' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_zh.po:8: warning: header field 'Language-Team' still has the initial default value
/run/build/pwsafe/src/ui/wxWidgets/I18N/pos/pwsafe_zh.po:8: warning: header field 'Language' still has the initial default value
[ 15%] Built target mos
[ 15%] Building CXX object src/os/CMakeFiles/os.dir/unix/keyname.cpp.o
[ 17%] Building CXX object src/os/CMakeFiles/os.dir/unix/logit.cpp.o
[ 17%] Building CXX object src/os/CMakeFiles/os.dir/unix/media.cpp.o
[ 18%] Building CXX object src/os/CMakeFiles/os.dir/unix/mem.cpp.o
[ 19%] Building CXX object src/os/CMakeFiles/os.dir/unix/pws_str.cpp.o
[ 19%] Building CXX object src/os/CMakeFiles/os.dir/unix/pws_time.cpp.o
[ 19%] Building CXX object src/os/CMakeFiles/os.dir/unix/rand.cpp.o
[ 20%] Building CXX object src/os/CMakeFiles/os.dir/unix/registry.cpp.o
[ 20%] Building CXX object src/os/CMakeFiles/os.dir/unix/run.cpp.o
[ 21%] Building CXX object src/os/CMakeFiles/os.dir/unix/sleep.cpp.o
[ 21%] Building CXX object src/os/CMakeFiles/os.dir/unix/unicode2keysym.cpp.o
[ 22%] Building CXX object src/os/CMakeFiles/os.dir/unix/utf8conv.cpp.o
[ 22%] Building CXX object src/os/CMakeFiles/os.dir/unix/xsendstring.cpp.o
/run/build/pwsafe/src/os/unix/utf8conv.cpp: In constructor ‘Startup::Startup()’:
/run/build/pwsafe/src/os/unix/utf8conv.cpp:36:19: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |       (void) write(STDERR_FILENO, wrnmess, sizeof(wrnmess)/sizeof(*wrnmess)-1);
      |              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/run/build/pwsafe/src/os/unix/utf8conv.cpp:42:19: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   42 |       (void) write(STDERR_FILENO, errmess, sizeof(errmess)/sizeof(*errmess)-1);
      |              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/run/build/pwsafe/src/os/unix/utf8conv.cpp:47:19: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |       (void) write(STDERR_FILENO, errmess, sizeof(errmess)/sizeof(*errmess)-1);
      |              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 23%] Linking CXX static library libos.a
[ 23%] Built target os
make: *** [Makefile:166: all] Error 2
Error: module pwsafe: Child process exited with code 2

Maybe there is something else a problem…
Error from previous post when building is:

/run/build/pwsafe/src/os/unix/utf8conv.cpp:36:19: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |       (void) write(STDERR_FILENO, wrnmess, sizeof(wrnmess)/sizeof(*wrnmess)-1);
      |              ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/run/build/pwsafe/src/os/unix

I have now opened file /run/build/pwsafe/src/os/unix/utf8conv.cpp and checked the 36 line:

 33 // Couldn't get environment-specified locale, warn user
 34 // and punt to default "C"
 35 char wrnmess[] = "Couldn't load locale, falling back to default\n";
 36 (void) write(STDERR_FILENO, wrnmess, sizeof(wrnmess)/sizeof(*wrnmess)-1);
 37 sl = setlocale(LC_ALL, gl);

Above code looks like a environment variable “language” problem. I remember when compiling PasswordSafe in “distrobox/podman” using fedora:38 I was required to install language package:
sudo dnf install langpacks-en.noarch

Maybe I need to add something additionally related to language. Any idea?

So, the error we care about appears to be this:

mv: '/run/build/pwsafe/src/core/core_st.cpp' and '/run/build/pwsafe/src/core/core_st.cpp' are the same file
make[2]: *** [src/core/CMakeFiles/core.dir/build.make:75: src/core/core_st.cpp] Error 1
make[2]: *** Deleting file 'src/core/core_st.cpp'
make[1]: *** [CMakeFiles/Makefile2:327: src/core/CMakeFiles/core.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Which is apparently caused by the project expecting an ‘out-of-source’ build, see:

We can add the builddir option, set to true, to the pwsafe module, to have it build in a seperate directory, which should solve it.

This is just a warning for an unused result, not really an error, so it shouldnt affect whether the build fails.

1 Like

@HighKingofMelons, thank you for advice.

I fixed problems:

  • In manifest file I have added: builddir: true to my main program as you adviced and problem solved.
  • Then a new problem appeared and I tracked it down to include another library
    - name: Xerces-C in manifest file and problem solved.

New issue:

  1. Now I have rerun flatpak-builder with my new manifest file and there is no error in output.
My new manifest file
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
modules:

  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  #- name: gtest
  #  buildsystem: cmake
  #  sources:
  #     -  type: archive
  #        url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
  #        sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

  - name: Xerces-C
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/apache/xerces-c
        tag: v3.2.4
        commit: 5052c90b067dcc347d58822b450897d16e2c31e5

  - name: pwsafe
    builddir: true
    buildsystem: cmake
    config-opts:
      - -DNO_YUBI=ON
      - -DNO_GTEST=ON
      - -DGTEST_BUILD=OFF

    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744
Flatpak-builder output
Emptying app dir 'build-dir'
Downloading sources
Fetching git repo https://github.com/apache/xerces-c, ref refs/tags/v3.2.4
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 826 bytes | 826.00 KiB/s, done.
Starting build of com.github.pwsafe.pwsafe
Cache hit for libqrencode, skipping build
Cache hit for wxwidgets, skipping build
Cache hit for Xerces-C, skipping build
Cache hit for pwsafe, skipping build
Cache hit for cleanup, skipping
Cache hit for finish, skipping
Everything cached, checking out from cache
Pruning cache
  1. I tested the build and no error were returned.
    flatpak-builder --user --install --force-clean build-dir com.github.pwsafe.pwsafe.yml
Test install output
Emptying app dir 'build-dir'
Downloading sources
Fetching git repo https://github.com/apache/xerces-c, ref refs/tags/v3.2.4
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0
Receiving objects: 100% (1/1), 826 bytes | 826.00 KiB/s, done.
Starting build of com.github.pwsafe.pwsafe
Cache hit for libqrencode, skipping build
Cache hit for wxwidgets, skipping build
Cache hit for Xerces-C, skipping build
Cache hit for pwsafe, skipping build
Cache hit for cleanup, skipping
Cache hit for finish, skipping
Everything cached, checking out from cache
Exporting com.github.pwsafe.pwsafe to repo
Commit: e1c7784fe139f4c08fcd1a9c8406ed042ea57daa5f9a75492002e5047787d036
Metadata Total: 135
Metadata Written: 7
Content Total: 568
Content Written: 0
Content Bytes Written: 0 (0 bytes)
Exporting com.github.pwsafe.pwsafe.Locale to repo
Commit: edb310ecc387e1c75dd1026fb4a04a2b92fe47491de308fe96363fdc201c1250
Metadata Total: 101
Metadata Written: 2
Content Total: 13
Content Written: 0
Content Bytes Written: 0 (0 bytes)
Exporting com.github.pwsafe.pwsafe.Debug to repo
Commit: 59f744ec3281546c3f8d2add76c5237d16c1385d3ee8baf32bebea8c83a054c0
Metadata Total: 255
Metadata Written: 2
Content Total: 2936
Content Written: 0
Content Bytes Written: 0 (0 bytes)
Installing runtime/com.github.pwsafe.pwsafe.Locale/x86_64/master
Installing app/com.github.pwsafe.pwsafe/x86_64/master
Pruning cache
  1. I run a flatpak: flatpak run com.github.pwsafe.pwsafe
    and got an error:
    Error: Unable to initialize GTK+, is DISPLAY set properly?

You havent given the app any permissions yet, so in this case it can’t access your display server/wayland compositer.

In this case adding a finish-args section like this:

finish-args:
  - --socket=fallback-x11
  - --socket=wayland

Will let the application open its ui.

also be sure to have a look at these aswell:

https://docs.flatpak.org/en/latest/manifests.html#finishing
https://docs.flatpak.org/en/latest/sandbox-permissions.html
https://docs.flatpak.org/en/latest/sandbox-permissions-reference.html

1 Like

@HighKingofMelons, thank you.

  1. I added your advised permissions.
  2. I additionally added permission to access Documents home directory.
  3. Uninstalled flatpak, installed it again (to get permissions), and run flatpak.
    FLATPAK STARTED THE APPLICATION SUCCESSFULLY!!!
  4. I tested application:
    – From GUI I clicked on “New” to create new password manager database.
    – Selected Documents location to store new database.
    – Right click on blank space bellow icons and Add Entry.
    – Typed in data: Title, Username, Password, Confirm fields and OK button
    – Closed down application.
    – Started it again and saved entry appears. Double click on entry. Paste to text editor.
    – Password is successfully pasted.
    – IT LOOKS AT LEAST BASIC FUNCTIONALITY WORKS FINE!!!

Few thinks not working:

  1. When I start application and press Alt+Tab there is incorrect program’s icon. Icon appears as “setting” icon. How to add icon to flatpak?
  2. I can successfully start flatpak application from terminal. But I am so used to launch applications by pressing “Super” key and type in like a letter or two of program name and application icon should be displayed and just pressing Enter key should launch application.
  3. Related to previous point. When icon is displayed right mouse on icon should work so “Add to favorites” could be selected and icon added to the Linux launcher bar.
  4. When I start application and click on “New” button file chooser dialog is displayed with default path pointing to: /home/"user"/.var/app/com.github.pwsafe.pwsafe/config/pwsafe This is probably location user do not want to save there password database. Is it possible to set default to /home/"user"/Documents
My new manifesto
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --filesystem=xdg-documents
modules:
  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  #- name: gtest
  #  buildsystem: cmake
  #  sources:
  #     -  type: archive
  #        url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
  #        sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

  - name: Xerces-C
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/apache/xerces-c
        tag: v3.2.4
        commit: 5052c90b067dcc347d58822b450897d16e2c31e5

  - name: pwsafe
    builddir: true
    buildsystem: cmake
    config-opts:
      - -DNO_YUBI=ON
      - -DNO_GTEST=ON
      - -DGTEST_BUILD=OFF

    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744
1 Like

This is because we are not providing the necessary metadata, in this case we are missing a .desktop file and an icon.

we can install them by defining some post-install commands using the post-install option similar to this example:

In this case we dont need to add the icon and .desktop files as sources as they are in the source archive already.

The project is as far as i can see appdata, which will mean for the time being we’ll need to provide our own (until its pushed upstream it that is).

There is some info on that aswell as some other requirements here:

and here:

1 Like

I didnt add it to the example earlier but apparently you get a performance penalty on x11 if you dont add:

--share=ipc

So you probably should.

Its also freely allowed on flathub, as per:

1 Like

@HighKingofMelons

  1. I have added permission for --share=ipc as you advised.
  2. I have added post install tasks. But my icon is still not displayed if I press Super key and type in pwsafe.
    post-install:
      mkdir -p /app/share/applications
      cp install/desktop/pwsafe.desktop /app/share/applications
      mkdir -p /app/share/icons/hicolor/128x128/apps
      cp install/graphics/pwsafe.png /app/share/icons/hicolor/128x128/apps

Did I specify correct paths in post-install?

My new manifest
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --share=ipc
  - --filesystem=xdg-documents
modules:
  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  #- name: gtest
  #  buildsystem: cmake
  #  sources:
  #     -  type: archive
  #        url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
  #        sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

  - name: Xerces-C
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/apache/xerces-c
        tag: v3.2.4
        commit: 5052c90b067dcc347d58822b450897d16e2c31e5

  - name: pwsafe
    builddir: true
    buildsystem: cmake
    config-opts:
      - -DNO_YUBI=ON
      - -DNO_GTEST=ON
      - -DGTEST_BUILD=OFF

    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744

    post-install:
    #  - install -Dm644 install/desktop/pwsafe.desktop /app/share/applications/pwsafe.desktop
    #  - install -Dm644 install/graphics/pwsafe.png /app/share/icons/hicolor/128x128/apps/pwsafe.png
      mkdir -p /app/share/applications
      cp install/desktop/pwsafe.desktop /app/share/applications
      mkdir -p /app/share/icons/hicolor/128x128/apps
      cp install/graphics/pwsafe.png /app/share/icons/hicolor/128x128/apps

Ok, so i had another look and as it turns out they do actually install both the .desktop file and the icon during the build.

Meaning we dont need to. However the files need to be named after the app-id of the application, to be properly exported by flatpak.

https://docs.flatpak.org/en/latest/flatpak-builder-command-reference.html#flatpak-manifest

Luckily, this page lists a few manifest options that should help. Namely rename-desktop-file and rename-icon.

1 Like

@HighKingofMelons, thanks for help.

I added rename-desktop-file and rename-icon to manifest file and now when pressing Super key and type in passwordsave (or less letters) program’s icon is displayed and I can launch the program. I can also add the icon to Linux lauchpad and also Alt+Tab show the icon. Excellent problem solved.

My new manifest
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
rename-icon: pwsafe
rename-desktop-file: pwsafe.desktop
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --share=ipc
  - --filesystem=xdg-documents
modules:
  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  #- name: gtest
  #  buildsystem: cmake
  #  sources:
  #     -  type: archive
  #        url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
  #        sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

  - name: Xerces-C
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/apache/xerces-c
        tag: v3.2.4
        commit: 5052c90b067dcc347d58822b450897d16e2c31e5

  - name: pwsafe
    builddir: true
    buildsystem: cmake
    config-opts:
      - -DNO_YUBI=ON
      - -DNO_GTEST=ON
      - -DGTEST_BUILD=OFF

    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744

Now I have uninstalled flatpack application and removed the $HOME/.var/app/com.github.pwsafe.pwsafe directory. Rebuild application and now error appeared: Could not initialize help subsystem. Help will not be available. with
checkbox Don’t show this warning again. I remember I have checked this box before and confirmed with OK button and application GUI starts successfully. On another start it does not ask this question anymore, but inside application menu selection Help | Help does not work, no error is displayed.

I have found exactly the same error message on project bug tracker and it looks like related to environment variable: XXXhttps://github.com/pwsafe/pwsafe/issues/720

Few weeks ago I installed password safe inside distrobox/podman on Fedora Silverblue and I remember I was required to install sudo dnf --assumeyes install langpacks-en.noarch

Now I have searched for this “package” or “library” in github, but can’t figure it out if this is environment variable problem or some missing package/library.

Any idea?

By searching for the error message in the project, and backtracking through the code, I managed to trace the issue back to this function:

The helpfiles in the flatpak build get installed in /app/share/passwordsafe/help/, rather than in /user/share. This means we’ll need to set PWS_HELPDIR to our location and it should work.

1 Like

@HighKingofMelons, inside finish-args I have added - --env=PWS_HELPDIR=/app/share/passwordsafe/help/ and now flatpak application starts without error referencing to help. When I select menu option Help | Help and help is correctly displayed. Thanks a lot. Problem solved.

My new manifest
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
rename-icon: pwsafe
rename-desktop-file: pwsafe.desktop
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --share=ipc
  - --filesystem=xdg-documents
  - --env=PWS_HELPDIR=/app/share/passwordsafe/help/
modules:
  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  #- name: gtest
  #  buildsystem: cmake
  #  sources:
  #     -  type: archive
  #        url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
  #        sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363

  - name: Xerces-C
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/apache/xerces-c
        tag: v3.2.4
        commit: 5052c90b067dcc347d58822b450897d16e2c31e5

  - name: pwsafe
    builddir: true
    buildsystem: cmake
    config-opts:
      - -DNO_YUBI=ON
      - -DNO_GTEST=ON
      - -DGTEST_BUILD=OFF

    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744

Reading documentation I have seen at the end of process “cleansing” processes is recommended, to make flatpak package as small as possible.

I checked the size of installed flatpak: flatpak run --command=sh --devel and it outputs 49 MB. It is relatively small program.

I entered into inside of flaptak package with: flatpak run --command=sh --devel com.github.pwsafe.pwsafe and list all of directories and files in it with ls / -R > out.txt

List of all directories and files. Click on bellow link and click on “Download”. Untar the file and there is out.txt file in it with whole dir/file structure.

My new manifest
app-id: com.github.pwsafe.pwsafe
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: pwsafe
rename-icon: pwsafe
rename-desktop-file: pwsafe.desktop
finish-args:
  - --socket=fallback-x11
  - --socket=wayland
  - --share=ipc
  - --filesystem=xdg-documents
  - --env=PWS_HELPDIR=/app/share/passwordsafe/help/
  # YubiKey USB access
  - --device=all
cleanup-commands:
  # Delete unnecessary files after build 
  - rm -rf /app/share/doc/xerces-c/
  - rm -rf /app/include/xercesc/dom/*.hpp
  - rm -rf /app/include/xercesc/dom/impl/*.hpp
  - rm -rf /app/include/xercesc/framework/*.hpp
  - rm -rf /app/include/xercesc/framework/psvi/*.hpp
  - rm -rf /app/include/xercesc/internal/*.hpp
  - rm -rf /app/include/xercesc/parsers/*.hpp
  - rm -rf /app/include/xercesc/sax/*.hpp
  - rm -rf /app/include/xercesc/sax2/*.hpp
  - rm -rf /app/include/xercesc/util/*.hpp
  - rm -rf /app/include/xercesc/util/FileManagers/*.hpp
  - rm -rf /app/include/xercesc/util/MsgLoaders/*.hpp
  - rm -rf /app/include/xercesc/util/MsgLoaders/InMemory/*.hpp
  - rm -rf /app/include/xercesc/util/MutexManagers/*.hpp
  - rm -rf /app/include/xercesc/util/NetAccessors/Curl/*.hpp
  - rm -rf /app/include/xercesc/util/Transcoders/ICU/*.hpp
  - rm -rf /app/include/xercesc/util/regx/*.hpp
  - rm -rf /app/include/xercesc/validators/DTD/*.hpp
  - rm -rf /app/include/xercesc/validators/common/*.hpp
  - rm -rf /app/include/xercesc/validators/datatype/*.hpp
  - rm -rf /app/include/xercesc/validators/datatype/*.hpp
  - rm -rf /app/include/xercesc/validators/schema/*.hpp
  - rm -rf /app/include/xercesc/validators/schema/identity/*.hpp
  - rm -rf /app/include/xercesc/xinclude/*.hpp
  - rm -rf /app/include/qrencode.h
  - rm -rf /app/include/xercesc/dom/impl/*.c
  - rm -rf /app/include/xercesc/framework/psvi/*.c
  - rm -rf /app/include/xercesc/util/*.c
  - rm -rf /app/lib/cmake/XercesC/*.cmake

modules:
  - name: libqrencode
    buildsystem: autotools
    sources:
      - type: archive
        url: https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
        sha256: 5385bc1b8c2f20f3b91d258bf8ccc8cf62023935df2d2676b5b67049f31a049c

  - name: wxwidgets
    cleanup:
      - /bin
      - /include
      - /lib/cmake
      - /lib/wx
      - /share
    sources:
      - type: archive
        url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.2.2.1/wxWidgets-3.2.2.1.tar.bz2
        sha256: dffcb6be71296fff4b7f8840eb1b510178f57aa2eb236b20da41182009242c02
        x-checker-data:
          type: anitya
          project-id: 5150
          stable-only: true
          url-template: https://github.com/wxWidgets/wxWidgets/releases/download/v/wxWidgets-.tar.bz2

  ### Google tests
  #- name: gtest
  #  buildsystem: cmake
  #  sources:
  #     -  type: archive
  #        url: https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz
  #        sha256: ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363
  ### Google tests

  - name: Xerces-C
    buildsystem: cmake-ninja
    sources:
      - type: git
        url: https://github.com/apache/xerces-c
        tag: v3.2.4
        commit: 5052c90b067dcc347d58822b450897d16e2c31e5

  - name: pwsafe
    builddir: true
    buildsystem: cmake
    config-opts:
      - -DNO_GTEST=ON
      - -DGTEST_BUILD=OFF
    sources:
      - type: archive
        url: 'https://github.com/pwsafe/pwsafe/archive/refs/tags/1.17.0.tar.gz'
        sha256: 0890bb4163d596f12578dc82a378f01fcaa8077e7653db321ee4adb11ad20744

I have manage to:

  1. Do some cleansing of unnecessary files (“cleanup-command” section in manifest file). It reduced flatpak package size from 49,2 MB to 44,6 MB which is 5 MB. Better something then nothing. :slight_smile:
  2. I have added YubiKey support that I have temporally disabled before, to simplify the process.

I am very satisfied with the current state of PasswordSafe flatpak package. I did some basic testing and so far no issue at all.

Future next few days plan?
a) I need to perform in deep testing of flatpak package. I will probably need few days.
b) Then I will most probably need some help to go through publishing package in Flathub. Any hint at pointing me to some good source?

The whole for-app-authors section here:

Is pretty good to go through, probably especially the Requirements and Submission sections.

Otherwise you can also ask questions on matrix:

1 Like