Skip to content

Fix macOS source installs with custom R toolchains - #169

Draft
cpsievert wants to merge 5 commits into
mainfrom
fix/issue-144-forward-cxxflags
Draft

cpsievert wants to merge 5 commits into
mainfrom
fix/issue-144-forward-cxxflags

Conversation

@cpsievert

@cpsievert cpsievert commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Installing sass from source on macOS can fail when the R toolchain needs explicit SDK or architecture flags, or when GCC encounters a hard-coded -stdlib=libc++ flag.

The bundled LibSass build now receives R’s active C++ flags on macOS and uses the standard library selected by that toolchain. This keeps the compiler settings for LibSass and the R package aligned.

Validation

Clean source installs on arm64 macOS passed with Apple Clang and Homebrew GCC 16. Each build linked the expected C++ runtime and passed 27 targeted checks. The reported MacPorts GCC 12 PowerPC setup remains unverified.

Closes #120.
Closes #144.

Toolchains such as MacPorts R on macOS carry essential flags (-isysroot,
-arch) in CXX17FLAGS, which never reached the libsass sub-make, failing
the build with confusing libc++ header errors. Passing CXXFLAGS directly
on the command line would override libsass's own ?=/+= appends (dropping
-I include, -fPIC, -O2, -std=c++11), so forward via EXTRA_CXXFLAGS,
which libsass's Makefile appends after its own flags.
The command-line CFLAGS had the same override problem fixed for C++ in
the previous commit: it silently discarded libsass's own C flags
(-Wall -O2 -fPIC). Harmless so far only because the lone C source
(cencode.c) needs no include path and arm64 masks the missing -fPIC.
@cpsievert
cpsievert marked this pull request as draft November 18, 2026 19:57
@cpsievert cpsievert changed the title Fix source installs on toolchains that carry C++ flags in CXX17FLAGS (e.g., MacPorts R) Fix macOS source installs that require SDK or architecture flags Nov 18, 2026
@cpsievert cpsievert changed the title Fix macOS source installs that require SDK or architecture flags Fix macOS source installs with custom R toolchains Nov 18, 2026

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Installation fails on Apple aarch64 -stdlib=libc++ should be conditional on compiler and not hardcoded on macOS

1 participant