Trying to build a flatpak fails with a cmake internal compiler test error.

Trying to build a flatpak makes cmake crash at the 2nd internal test.

As far as i can see everything is right in the build sandbox. cc is redirecting to GNU C 12.
But at the same time i have no real debugging available because --build-shell is for some reason not working too. I do use the latest Fedora to compile and the version 36 runtime.

Any ideas what to do? I’m left alone with this problem because the flatpak community is so tiny nobody responded so far.

Downloading sources
Initializing build dir
Committing stage init to cache
Starting build of app.filesqueezer.example

Building module example-program in

-- The C compiler identification is GNU 12.1.1
-- The CXX compiler identification is GNU 12.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /usr/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler


  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /run/build/example-program/_flatpak_build/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_1e899/fast &&
/usr/bin/gmake  -f CMakeFiles/cmTC_1e899.dir/build.make
    gmake[1]: Entering directory
    Building C object CMakeFiles/cmTC_1e899.dir/testCCompiler.c.o
    /usr/bin/cc   -O2 -flto=auto -ffat-lto-objects -fexceptions -g
-grecord-gcc-switches -pipe -Wall -Werror=format-security
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -m64  -mtune=generic -fasynchronous-unwind-tables
-fstack-clash-protection -fcf-protection  -o
CMakeFiles/cmTC_1e899.dir/testCCompiler.c.o -c
    Linking C executable cmTC_1e899
    /usr/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_1e899.dir/link.txt --verbose=1
    /usr/bin/cc -O2 -flto=auto -ffat-lto-objects -fexceptions -g
-grecord-gcc-switches -pipe -Wall -Werror=format-security
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -m64  -mtune=generic -fasynchronous-unwind-tables
-fstack-clash-protection -fcf-protection  -L/app/lib -Wl,-z,relro
-Wl,--as-needed  -Wl,-z,now
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1
 CMakeFiles/cmTC_1e899.dir/testCCompiler.c.o -o cmTC_1e899
    /usr/bin/ld: cannot open linker script file
No such file or directory
    collect2: error: ld returned 1 exit status
    gmake[1]: *** [CMakeFiles/cmTC_1e899.dir/build.make:99: cmTC_1e899] Error 1
    gmake[1]: Leaving directory
    gmake: *** [Makefile:127: cmTC_1e899/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

-- Configuring incomplete, errors occurred!
See also "/run/build/example-program/_flatpak_build/CMakeFiles/CMakeOutput.log".
See also "/run/build/example-program/_flatpak_build/CMakeFiles/CMakeError.log".
Error: module example-program: Der Kindprozess wurde mit Status 1 beendet

It seems that whatever is setting up the linker shenanigans is being or getting confused here.