oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.06k stars 2.67k forks source link

Compilation error: Target "cmTC_24044" requires the language dialect "C17" (with compiler extensions), but CMake does not know the compile flags to use to enable it. #11623

Open s-h-a-d-o-w opened 3 months ago

s-h-a-d-o-w commented 3 months ago

What is the type of issue?

Documentation is incorrect, Example code is not working

What is the issue?

Followed Ubuntu compilation instructions precisely, on WSL2 Ubuntu 20.04.6.

Got:

-- The C compiler identification is Clang 16.0.6
-- Check for working C compiler: /usr/bin/clang-16
CMake Error in /home/sh4dow/dev/bun/src/deps/base64/build/CMakeFiles/CMakeTmp/CMakeLists.txt:
  Target "cmTC_24044" requires the language dialect "C17" (with compiler
  extensions), but CMake does not know the compile flags to use to enable it.

CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:44 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  CMakeLists.txt:20 (project)

-- Configuring incomplete, errors occurred!
See also "/home/sh4dow/dev/bun/src/deps/base64/build/CMakeFiles/CMakeOutput.log".
Failed to build base64
error: script "setup" exited with code 1

Where did you find it?

https://bun.sh/docs/project/contributing

StevenLaczko commented 1 month ago

Getting the same thing, different dependency.

--The C compiler identification is Clang 16.0.6 Check for working C compiler: /usr/bin/clang-16 CMake Error in /home/slaczko/projects/bun/src/deps/boringssl/build/CMakeFiles/CMakeTmp/CMakeLists.txt: Target "cmTC_58ad2" requires the language dialect "C17" (with compiler extensions), but CMake does not know the compile flags to use to enable it. CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:44 (try_compile): Failed to generate test project build system. Call Stack (most recent call first): CMakeLists.txt:22 (enable_language) -- Configuring incomplete, errors occurred! See also "/home/slaczko/projects/bun/src/deps/boringssl/build/CMakeFiles/CMakeOutput.log". See also "/home/slaczko/projects/bun/src/deps/boringssl/build/CMakeFiles/CMakeError.log". Failed to build boringssl error: script "setup" exited with code 1

CMakeError.log says:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed. Compiler: /usr/bin/clang-16 Build flags: -O3;-fno-exceptions;-fvisibility=hidden;-fvisibility-inlines-hidden;-mno-omit-leaf-frame-pointer;-fno-omit-frame-pointer;-fno-asynchronous-unwind-tables;-fno-unwind-tables;;;-ffunction-sections;-fdata-sections;-faddrsig;;-fno-pie;-fno-pic Id flags: The output was: /usr/bin/ld: /tmp/CMakeCCompilerId-f789db.o: relocation R_X86_64_32S against hidden symbol `info_version' can not be used when making a PIE object clang: error: linker command failed with exit code 1 (use -v to see invocation)

190n commented 1 month ago

@s-h-a-d-o-w are you able to upgrade to a newer version of CMake and check whether the issue still occurs? It seems only CMake 3.21 and up are aware of C17 while you seem to have 3.16 installed.