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

Report: successful build on Mac Big Sur with LLVM 11! #100

Open
gwerbin opened this issue Sep 29, 2021 · 0 comments
Open

Report: successful build on Mac Big Sur with LLVM 11! #100

gwerbin opened this issue Sep 29, 2021 · 0 comments

Comments

@gwerbin
Copy link

gwerbin commented Sep 29, 2021

After a bit of experimentation, I got C2FFI to build on MacOS 11 ("Big Sur").

Feel free to add this to your README or anywhere else you see fit in the documentation.

#!/bin/sh

set -eux

cd c2ffi
git switch llvm-11.0.0

brew install 'llvm@11' || brew upgrade 'llvm@11'

mkdir -p ./build
cd ./build

# This is needed to find -lSystem on Big Sur
export LDFLAGS="-L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"

# Set the installation prefix to ~/.local, but feel free to change this.
PREFIX=${PREFIX:-${HOME}/.local}

# Set Make options, e.g. -j4
MAKE_OPTS="${MAKE_OPTS:-}"

cmake \
  -DCMAKE_INSTALL_PREFIX="$PREFIX" \
  -DCMAKE_PREFIX_PATH="/usr/local/opt/llvm@11" \
  -DCMAKE_CXX_COMPILER="/usr/local/opt/llvm@11/bin/clang++" \
  -DCMAKE_C_COMPILER="/usr/local/opt/llvm@11/bin/clang" \
  ..

make "${MAKE_OPTS}"

mkdir -p "${PREFIX}/bin"
install -v -m 0755 bin/c2ffi "${PREFIX}/bin/c2ffi"

Note that I did not need to set LIBRARY_PATH as suggested in #59 (comment).

@gwerbin gwerbin changed the title Build instructions for Mac Big Sur with LLVM 11 Report: successful build on Mac Big Sur with LLVM 11! Sep 29, 2021
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

1 participant