Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build on macOS Monterey fails with error Unknown CMake command "__cxx_std_process" #104

Open
dg1sbg opened this issue Jan 29, 2022 · 4 comments

Comments

@dg1sbg
Copy link

dg1sbg commented Jan 29, 2022

❯ git clone https://github.com/rpav/c2ffi.git
Cloning into 'c2ffi'...
remote: Enumerating objects: 1487, done.
remote: Counting objects: 100% (220/220), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 1487 (delta 122), reused 179 (delta 100), pack-reused 1267
Receiving objects: 100% (1487/1487), 348.87 KiB | 3.92 MiB/s, done.
Resolving deltas: 100% (980/980), done.
❯ cd c2ffi
❯ export CPPFLAGS="-I/opt/homebrew/opt/llvm@12/include"
❯ export LDFLAGS="-L/opt/homebrew/opt/llvm@12/lib"
❯ export PATH="/opt/homebrew/opt/llvm@12/bin:$PATH"
❯ mkdir build
❯ cd build
❯ cmake ..
-- Config: -Release
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CXX Compiler: AppleClang
-- Building for Linux-x64
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found LibXml2: /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib/libxml2.tbd (found version "2.9.4")
-- Found LLVM 12.0.1
-- LLVM installed in /opt/homebrew/opt/llvm@12
-- Using LLVMConfig.cmake in: /opt/homebrew/opt/llvm@12/lib/cmake/llvm
CMake Error at CMake/cxx_features.cmake:102 (__cxx_std_process):
Unknown CMake command "__cxx_std_process".
Call Stack (most recent call first):
CMakeLists.txt:63 (target_cxx_std)

-- Configuring incomplete, errors occurred!
See also "/Users/goenninger/swdev/c2ffi/build/CMakeFiles/CMakeOutput.log".
See also "/Users/goenninger/swdev/c2ffi/build/CMakeFiles/CMakeError.log".
❯ cmake --version
cmake version 3.22.2

I noticed that it assumes building for "Linux-x64" - is that correct?
I also see (running "make"):
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
Which certainly is not correct.

I also tried issue #100 but no luck ...

Any help really appeciated! - Thanks

frgo

@paines
Copy link

paines commented Feb 13, 2022

it compiles with these commands (even with M1):

git clone https://github.com/rpav/c2ffi.git
cd c2ffi
export CPPFLAGS="-I/opt/homebrew/opt/llvm@12/include"
export LDFLAGS="-L/opt/homebrew/opt/llvm@12/lib"
export PATH="/opt/homebrew/opt/llvm@12/bin:$PATH"
mkdir build
cd build
LLVM_DIR=/opt/homebrew/Cellar/llvm@12/12.0.1_1/lib/cmake/llvm CC="clang" CXX="clang++" cmake ..
make
make install

@Paxa
Copy link

Paxa commented Jul 21, 2022

I applied changes from #83 and it works

in CMake/cxx_features.cmake change

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# to
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")

@cneira
Copy link

cneira commented Sep 2, 2022

I applied changes from #83 and it works

in CMake/cxx_features.cmake change

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# to
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")

I just tried today and that worked thanks!

@jcguu95
Copy link

jcguu95 commented Apr 9, 2023

Thanks for all of the help above. I'm on Monterey version 12.5. What just worked for the step cmake is the following:

  1. Obtain the git repo and switch to a build directory.
$ git clone https://github.com/rpav/c2ffi.git
$ cd c2ffi
$ make build
$ cd build
  1. In CMake/cxx_features.cmake, change
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

to

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
  1. Locate llvm and cmake.
$ whereis cmake
cmake: /opt/homebrew/bin/cmake
$ find /opt/homebrew/ -type d -name llvm
find: /opt/homebrew//var/run/nginx/scgi_temp: Permission denied
find: /opt/homebrew//var/run/nginx/uwsgi_temp: Permission denied
find: /opt/homebrew//var/run/nginx/proxy_temp: Permission denied
find: /opt/homebrew//var/run/nginx/fastcgi_temp: Permission denied
find: /opt/homebrew//var/run/nginx/client_body_temp: Permission denied
/opt/homebrew//Cellar/llvm
/opt/homebrew//Cellar/llvm/16.0.0/include/llvm
/opt/homebrew//Cellar/llvm/16.0.0/include/clang-tidy/llvm
/opt/homebrew//Cellar/llvm/16.0.0/lib/cmake/llvm
/opt/homebrew//Cellar/llvm/16.0.0/lib/python3.11/site-packages/llvm
/opt/homebrew//Cellar/llvm/16.0.0/share/emacs/site-lisp/llvm
  1. In CMakeLists.txt, change version to 16.0.0.
find_package(LLVM 16.0.0 CONFIG)
$ export CPPFLAGS="-I/opt/homebrew/Cellar/llvm/16.0.0/include"
$ export LDFLAGS="-L/opt/homebrew/Cellar/llvm/16.0.0/lib"
$ export PATH="/opt/homebrew/Cellar/llvm/16.0.0/bin:$PATH"
$ LLVM_DIR=/opt/homebrew/Cellar/llvm/16.0.0/lib/cmake/llvm CC="clang" CXX="clang++" cmake ..

However, in the next step make, I encountered two errors

/tmp/c2ffi/src/AST.cpp:277:35: error: no member named 'isAscii' in 'clang::StringLiteral'
                            if(s->isAscii() || s->isUTF8()) {
                               ~  ^
/tmp/c2ffi/src/AST.cpp:284:33: error: call to 'convertUTF32ToUTF8String' is ambiguous
                                convertUTF32ToUTF8String(llvm::ArrayRef<char>(bytes.data(), bytes.size()), value);
                                ^~~~~~~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants