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

**URL:** https://discourse.cmake.org/t/trying-to-build-a-flatpak-fails-with-a-cmake-internal-compiler-test-error/5961
**Category:** Usage
**Created:** [June 29, 2022, 3:03pm UTC](https://discourse.cmake.org/t/trying-to-build-a-flatpak-fails-with-a-cmake-internal-compiler-test-error/5961 "2022-06-29T15:03:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lothar\_Scholz](https://discourse.cmake.org/user_avatar/discourse.cmake.org/lothar_scholz/32/1332_2.png) [@Lothar\_Scholz](https://discourse.cmake.org/u/Lothar_Scholz)
#### Post date: [June 29, 2022, 3:03pm UTC](https://discourse.cmake.org/t/trying-to-build-a-flatpak-fails-with-a-cmake-internal-compiler-test-error/5961/1 "2022-06-29T15:03:06Z")

</div>

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 /home/llothar/Downloads/temp/.flatpak-builder/build/example-program-1

```auto
-- 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

    "/usr/bin/cc"

  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
CMakeFiles/cmTC_1e899.dir/build
    gmake[1]: Entering directory
'/run/build/example-program/_flatpak_build/CMakeFiles/CMakeTmp'
    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
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-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
/run/build/example-program/_flatpak_build/CMakeFiles/CMakeTmp/testCCompiler.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
-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-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-hardened-ld
-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1
-Wl,-dT,/builddir/build/BUILD/.package_note-flatpak-runtime-config-36-1.module_f36+14437+3886a164.x86_64.ld
 CMakeFiles/cmTC_1e899.dir/testCCompiler.c.o -o cmTC_1e899
    /usr/bin/ld: cannot open linker script file
/builddir/build/BUILD/.package_note-flatpak-runtime-config-36-1.module_f36+14437+3886a164.x86_64.ld:
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
'/run/build/example-program/_flatpak_build/CMakeFiles/CMakeTmp'
    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

```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [June 29, 2022, 4:54pm UTC](https://discourse.cmake.org/t/trying-to-build-a-flatpak-fails-with-a-cmake-internal-compiler-test-error/5961/2 "2022-06-29T16:54:05Z")

</div>

> [@Lothar\_Scholz](#):
>
> ```auto
> /usr/bin/ld: cannot open linker script file
> /builddir/build/BUILD/.package_note-flatpak-runtime-config-36-1.module_f36+14437+3886a164.x86_64.ld:
> No such file or directory
> 
> ```

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