Skip to content

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

Description

@gwerbin

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions