-
Notifications
You must be signed in to change notification settings - Fork 39
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
Building c2ffi for macOS X on M1 MacBook Air #95
Comments
Does this still fail if you comment out this line? This probably shouldn't be forcing lld, but I'm not sure that's the specific issue here. |
THANK YOU. |
Yeah my cmake platform detection stuff isn't really set up for macos ... but as long as the compiler setup is right the message shit be harmless. If be happy to take PRs for mac (the lld thing is in the pipeline somewhere already) but I don't have facilities to test myself. |
The architecture of the generated executable is arm64 so it seams to be OK and it generates the json file. Thanks again with hope. |
Hi,
I'm trying to build c2ffi on MacOS X Big Sur with no avail.
% uname -a
Darwin BelasMacBookAir.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64
I am using this build script.
git clone https://github.com/rpav/c2ffi.git
cd c2ffi
mkdir build
cd build/
LLVM_DIR=/opt/homebrew/Cellar/llvm/11.1.0_1/lib/cmake/llvm CC="clang-11" CXX="clang++" cmake ..
LIBRARY_PATH=/opt/homebrew/Cellar/llvm/11.1.0_1/Toolchains/LLVM11.1.0.xctoolchain/usr/lib gmake
I am getting this output during the build:
% sh ./make_c2ffi.sh
Cloning into 'c2ffi'...
remote: Enumerating objects: 62, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 1329 (delta 31), reused 41 (delta 22), pack-reused 1267
Receiving objects: 100% (1329/1329), 307.96 KiB | 2.65 MiB/s, done.
Resolving deltas: 100% (889/889), done.
-- Config: -Release
-- The C compiler identification is Clang 11.1.0
-- The CXX compiler identification is Clang 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/homebrew/opt/llvm/bin/clang-11 - 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: /opt/homebrew/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CXX Compiler: Clang
-- Building for Linux-x64
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found LibXml2: /opt/local/lib/libxml2.dylib (found version "2.9.10")
-- Found LLVM 11.1.0
-- LLVM installed in /opt/homebrew/Cellar/llvm/11.1.0_1
-- Using LLVMConfig.cmake in: /opt/homebrew/Cellar/llvm/11.1.0_1/lib/cmake/llvm
-- c2ffi c++std: -std=c++17
** C++ flags: -W -Wall -Wextra -pedantic-errors -Werror=return-type -Werror=unused-result -Wno-unused-parameter -Wno-gnu-anonymous-struct -Wno-nested-anon-types -Wno-unused-label
** C++ debug flags: -O1 -ggdb2 -fno-omit-frame-pointer
** C++ rwdi flags: -O2 -ggdb2 -fno-omit-frame-pointer -DNDEBUG
** C++ release flags: -O3 -DNDEBUG
** Link flags: -fuse-ld=lld
** Link debug flags:
**
** This build: Release
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/bpecsek/tmp/c2ffi/build
[ 7%] Building CXX object CMakeFiles/c2ffi.dir/src/AST.cpp.o
[ 15%] Building CXX object CMakeFiles/c2ffi.dir/src/Decl.cpp.o
[ 23%] Building CXX object CMakeFiles/c2ffi.dir/src/Expr.cpp.o
[ 30%] Building CXX object CMakeFiles/c2ffi.dir/src/OutputDriver.cpp.o
[ 38%] Building CXX object CMakeFiles/c2ffi.dir/src/Template.cpp.o
[ 46%] Building CXX object CMakeFiles/c2ffi.dir/src/Type.cpp.o
[ 53%] Building CXX object CMakeFiles/c2ffi.dir/src/c2ffi.cpp.o
[ 61%] Building CXX object CMakeFiles/c2ffi.dir/src/drivers/JSON.cpp.o
/Users/bpecsek/tmp/c2ffi/src/drivers/JSON.cpp:36:26: warning: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Wvarargs]
va_start(ap, close);
^
/Users/bpecsek/tmp/c2ffi/src/drivers/JSON.cpp:32:61: note: parameter of type 'bool' is declared here
void write_object(const char *type, bool open, bool close, ...) {
^
1 warning generated.
[ 69%] Building CXX object CMakeFiles/c2ffi.dir/src/drivers/Null.cpp.o
[ 76%] Building CXX object CMakeFiles/c2ffi.dir/src/drivers/Sexp.cpp.o
[ 84%] Building CXX object CMakeFiles/c2ffi.dir/src/init.cpp.o
[ 92%] Building CXX object CMakeFiles/c2ffi.dir/src/options.cpp.o
[100%] Linking CXX executable bin/c2ffi
ld64.lld: warning: ignoring unknown argument: -platform_version
ld64.lld: warning: ignoring unknown argument: -search_paths_first
ld64.lld: warning: ignoring unknown argument: -headerpad_max_install_names
ld64.lld: warning: -sdk_version is required when emitting min version load command. Setting sdk version to match provided min version
Cannot open macos: No such file or directory
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [CMakeFiles/c2ffi.dir/build.make:275: bin/c2ffi] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:165: CMakeFiles/c2ffi.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
It looks like cmake configures c2ffi to be built for Linux-x64 and not macOS arm64.
Compilation succeeds with a couple of warnings but the linking fails.
Can anyone assist me to build c2ffi for Arm64 macOS X?
The text was updated successfully, but these errors were encountered: