rstudio / sass

Sass compiler package for R
https://rstudio.github.io/sass/
Other
102 stars 17 forks source link

ensure CXX is used to link the final shared object #104

Closed paleolimbot closed 2 years ago

paleolimbot commented 2 years ago

This PR fixes #94, which is a similar problem to one we see in 'arrow' when compiling with slightly different C++ flags (in our case, -stdlib=libc++ to replicate the custom clang build that exists on fedora-clang-devel; see https://github.com/apache/arrow/pull/12734). The final .so is getting linked with CC instead of CXX because there are no .cpp files (I think). This PR just renames init.c to init.cpp and includes the relevant changes to make sure that compile.c/compile.h work as they did before.

With reprex:

# docker pull rhub/fedora-clang-devel
/opt/R-devel/bin/R -e 'install.packages(c("withr", "remotes"), repos = "https://cloud.r-project.org/")'
/opt/R-devel/bin/R -e 'withr::with_makevars(list(CXX = "-stdlib=libc++"), remotes::install_github("rstudio/sass"), assignment = "+=")'
# ...
# ** testing if installed package can be loaded from temporary location
# Error: package or namespace load failed for ‘sass’ in dyn.load(file, DLLpath = DLLpath, ...):
#  unable to load shared object '/opt/R-devel/lib64/R/library/00LOCK-sass/00new/sass/libs/sass.so':
#   /opt/R-devel/lib64/R/library/00LOCK-sass/00new/sass/libs/sass.so: undefined symbol: _ZTINSt3__113basic_ostreamIcNS_11char_traitsIcEEEE
/opt/R-devel/bin/R -e 'withr::with_makevars(list(CXX = "-stdlib=libc++"), remotes::install_github("rstudio/sass#104"), assignment = "+=")'
# ...works!
CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

paleolimbot commented 2 years ago

(I can't seem to sign the CLA, I just get a window with a select box that won't let me choose anything)

wch commented 2 years ago

Thanks!