CMake on Kali Linux "is not able to compile a simple test program" due to incompatible libc and ld-linux-x86-64

785 Views Asked by At

I am running CLion with snap on my Kali Linux virtual machine. When I am creating a new executable C Project, I get the following error that I cannot seem to solve:

CMake Error at /snap/clion/209/bin/cmake/linux/share/cmake-3.23/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: /home/kali/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/snap/clion/209/bin/ninja/linux/ninja cmTC_17880 && [1/2] Building C object CMakeFiles/cmTC_17880.dir/testCCompiler.c.o
    [2/2] Linking C executable cmTC_17880
    FAILED: cmTC_17880 
    : && /usr/bin/cc   CMakeFiles/cmTC_17880.dir/testCCompiler.c.o -o cmTC_17880   && :
    /usr/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: unknown type [0x13] section `.relr.dyn'
    /usr/bin/ld: skipping incompatible /lib/x86_64-linux-gnu/libc.so.6 when searching for /lib/x86_64-linux-gnu/libc.so.6
    /usr/bin/ld: cannot find /lib/x86_64-linux-gnu/libc.so.6
    /usr/bin/ld: /lib64/ld-linux-x86-64.so.2: unknown type [0x13] section `.relr.dyn'
    /usr/bin/ld: skipping incompatible /lib64/ld-linux-x86-64.so.2 when searching for /lib64/ld-linux-x86-64.so.2
    /usr/bin/ld: cannot find /lib64/ld-linux-x86-64.so.2
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.

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


-- Configuring incomplete, errors occurred!
See also "/home/kali/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "/home/kali/CLionProjects/untitled1/cmake-build-debug/CMakeFiles/CMakeError.log". 

If anyone has a fix, I would really appreciate it.

1

There are 1 best solutions below

0
pepe On

I could fix it by running apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y.