Skip to content

cmake: when no compiler specified, defaults to gcc, but then use libstdc++ -> default build doesn't build #634

@marcusmueller

Description

@marcusmueller

default Docker build as specified in DEVELOPER.md does not work, because cmake as configured seems to use libc++ with the default GCC build. Something's wrong with the cmake logic that determines that stdlib flag, and on first sight it's not clear what it is – the CMAKE_COMPILER_ID against clang and should not trigger on "no flags".

podman run -it --rm ghcr.io/fair-acc/gr4-build-container bash
cd
git clone --recursive https://github.com/fair-acc/gnuradio4
cd gnuradio
cmake -S . -B build

yields

Make Error at /usr/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/usr/bin/gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/tmp/gnuradio4/build/CMakeFiles/CMakeScratch/TryCompile-P98Tew'

    Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_a5a9a/fast
    /usr/bin/gmake  -f CMakeFiles/cmTC_a5a9a.dir/build.make CMakeFiles/cmTC_a5a9a.dir/build
    gmake[1]: Entering directory '/tmp/gnuradio4/build/CMakeFiles/CMakeScratch/TryCompile-P98Tew'
    Building C object CMakeFiles/cmTC_a5a9a.dir/testCCompiler.c.o
    /usr/bin/gcc   -fPIE -o CMakeFiles/cmTC_a5a9a.dir/testCCompiler.c.o -c /tmp/gnuradio4/build/CMakeFiles/CMakeScratch/TryCompile-P98Tew/testCCompiler.c
    Linking C executable cmTC_a5a9a
    /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a5a9a.dir/link.txt --verbose=1
    gcc: error: unrecognized command-line option ‘-stdlib=libc++’
    /usr/bin/gcc  -stdlib=libc++ -lc++  CMakeFiles/cmTC_a5a9a.dir/testCCompiler.c.o -o cmTC_a5a9a
    gmake[1]: *** [CMakeFiles/cmTC_a5a9a.dir/build.make:102: cmTC_a5a9a] Error 1
    gmake[1]: Leaving directory '/tmp/gnuradio4/build/CMakeFiles/CMakeScratch/TryCompile-P98Tew'
    gmake: *** [Makefile:134: cmTC_a5a9a/fast] Error 2





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  build/_deps/pffft-src/CMakeLists.txt:2 (project)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions