flatpak / flatpak-builder

Tool to build flatpaks from source
GNU Lesser General Public License v2.1
141 stars 91 forks source link

Per-module strip option is ignored #358

Open gasinvein opened 4 years ago

gasinvein commented 4 years ago

Linux distribution and version

Fedora 32

Flatpak-builder version

1.0.10

Flatpak version

1.8.1

Description of the problem

If global build-options set strip to true, then per-module build-options with strip set to false have no effect - module files are stripped anyway.

Steps to reproduce

Minimal manifest to demonstrate the problem:

id: org.khronos.glslang
sdk: org.freedesktop.Sdk
runtime: org.freedesktop.Platform
runtime-version: "19.08"
build-options:
  strip: true
modules:
  - name: glslang
    build-options:
      strip: false
    buildsystem: cmake-ninja
    post-install:
      - chmod 555 ${FLATPAK_DEST}/bin/*
    sources:
      - type: archive
        url: "https://github.com/KhronosGroup/glslang/archive/8.13.3559.tar.gz"
        sha256: c58fdcf7e00943ba10f9ae565b2725ec9d5be7dab7c8e82cac72fcaa83c652ca

Here we make the installed binary non-writable, what makes flatpak-builder error out on trying to strip it:

stripping: files/bin/glslangValidator
strip: unable to copy file '/home/gasinvein/.cache/flatpak-builder/state/rofiles/rofiles-u8Wvcs/files/bin/glslangValidator'; reason: Permission denied
Error: module glslang: Child process exited with code 1
tinywrkb commented 2 years ago

Also, if you have a later module setting strip to true, then it will strip everything that's already in ${FLATPAK_DEST}, doesn't matter which module installed it.

...
modules:
  - name: moduleA
  - ....
  - name: moduleX
    build-options:
      strip: true
charlesthobe commented 1 year ago

Now it just strips everything, even with both global stripping build option and permodule ones set to false.

build-options:
  strip: false
modules:
  - name: module1
    buildsystem: simple
    build-options:
      strip: false

I have tried all combinations to no avail. system info: Flatpak 1.14.4 flatpak-builder 1.2.3 Host OS: Debian bookworm I'm not sure whether I should open a new bug or if this one should naturally encompass my issue.

charlesthobe commented 1 year ago

I think that it's worth noting that the build system for said module is set to "simple", so I guess the issue I'm facing is with the build system. bug reports of the same issue: https://github.com/flatpak/flatpak/issues/469 https://github.com/flatpak/flatpak/issues/1791 The problem they were facing is they were extracting a tar with read-only permission set to some files so stripping fails, adding chmod -R +w "${FLATPAK_DEST}"/$module_installation_location fixes it, but I wish there was an option to disable stripping while using the "simple" build system.

kornrunner commented 1 year ago

It seems that setting

build-options:
  strip: false
  no-debuginfo: true

At the top level skips stripping (for all modules) and later overrides per module seem to work. Hope this helps.