emscripten-core / emscripten-core/emscripten

cmake: Detecting C compiler ABI info - failed

Open
#20,889 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.50 (047b82506d6b471873300a5e4d1e690420b582d0)
clang version 18.0.0 (https://github.com/llvm/llvm-project 14028ec0a62210d68a4dd7a046ac79c8c3b7727e)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /Users/legend/Projects/emsdk/upstream/bin

cmake version 3.23.1

**Failing command line in full:**
` emmake cmake ../`

CmakeLists.txt
`
cmake_minimum_required(VERSION 3.10)
project( tricall )

add_definitions( -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER -DLIUNX )

add_executable(tricall tricall.c triangle.c)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -s WASM=1 -gsource-map -O0")

set(CMAKE_CXX_STANDARD_LIBRARIES "-s MODULARIZE=1 --bind")
`

**Full link command and output with `-v` appended:**
`make: cmake ../
-- The C compiler identification is Clang 18.0.0
-- The CXX compiler identification is Clang 18.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Users/legend/Projects/emsdk/upstream/emscripten/emcc
-- Check for working C compiler: /Users/legend/Projects/emsdk/upstream/emscripten/emcc - broken
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.23/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler

"/Users/legend/Projects/emsdk/upstream/emscripten/emcc"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /Users/legend/Projects/emscripten/triangles/build_cmake/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make -f Makefile cmTC_4fde2/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_4fde2.dir/build.make CMakeFiles/cmTC_4fde2.dir/build
Building C object CMakeFiles/cmTC_4fde2.dir/testCCompiler.c.o
/Users/legend/Projects/emsdk/upstream/emscripten/emcc -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -MD -MT CMakeFiles/cmTC_4fde2.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_4fde2.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_4fde2.dir/testCCompiler.c.o -c /Users/legend/Projects/emscripten/triangles/build_cmake/CMakeFiles/CMakeTmp/testCCompiler.c
emcc: error: arm64: No such file or directory ("arm64" was expected to be an input file, based on the commandline arguments provided)
make[1]: *** [CMakeFiles/cmTC_4fde2.dir/testCCompiler.c.o] Error 1
make: *** [cmTC_4fde2/fast] Error 2


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

`

The points, the error happened after updating the latest emsdk version, before that everything works well. However, my emsdk works well without cmake, and cmake works fine without emsdk. there maybe some bugs here.

when I skipped the checking compiler, add "set(CMAKE_C_COMPILER_WORKS TRUE)", then makefile created successfully. but the make output is following:

[ 33%] Building C object CMakeFiles/tricall.dir/tricall.c.o
emcc: error: arm64: No such file or directory ("arm64" was expected to be an input file, based on the commandline arguments provided)
make[2]: *** [CMakeFiles/tricall.dir/tricall.c.o] Error 1
make[1]: *** [CMakeFiles/tricall.dir/all] Error 2

That's all my efforts. Thank you for the reply

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.