[Rcpp-devel] Troubleshooting dependency issues

Naeem Khoshnevis khoshnevis.naeem at gmail.com
Thu Jul 15 22:44:13 CEST 2021


Thanks, Simon and Dirk,

I can install the packages normally on macOS. However, I want to install it
in a conda environment. Thanks for sharing the link. I really appreciate
it.

Here is a reproducible example, in case you have time to try.

On macOS:

Step 1: create a conda environment and install R

conda create -n r-environment r-essentials r-base

Step 2: activate the environment

conda activate r-environment

Step 3: Install rstudio

conda install -c r rstudio

Step 4: Install some required packages

conda install -c r r-devtools
conda install -c r r-wcorr
conda install -c r r-ranger
conda install -c conda-forge r-rcpparmadillo
conda install -c r r-testthat
conda install -c conda-forge r-superlearner
conda install -c conda-forge r-polycor
conda install -c conda-forge r-logger

Step 6:
According to this page, download dependencies:
https://mac.r-project.org/openmp/

And copied them into the environment include and lib directory.


Step 7:
According to this page, I exported variables in step 6.
https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#set-env-vars

#!/bin/sh

export PKG_CPPFLAGS='-Xclang -fopenmp'
export PKG_LIBS='-lomp'

Step 8:
Reactivated the conda environment

Step 9:
run: rstudio

Step 10:
inside rstudio
library(devtools)
install_github("fasrc/CausalGPS")

I get the following error:

Downloading GitHub repo fasrc/CausalGPS at master
Error: Could not find tools necessary to compile a package

I think something is wrong with Step 7. Because apparently, I lost the path
to Xcode. Without Step 7, I get the following error:

In file included from ColorSpace.cpp:1:
In file included from ./ColorSpace.h:4:
In file included from env/bin/../include/c++/v1/typeinfo:60:
In file included from env/bin/../include/c++/v1/exception:81:
In file included from env/bin/../include/c++/v1/cstdlib:85:
In file included from env/bin/../include/c++/v1/stdlib.h:100:
env/bin/../include/c++/v1/math.h:773:12: error: no member named 'labs' in
the global namespace; did you mean 'abs'?
  return ::labs(__x);
         ~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                                      ^
~/env/bin/../include/c++/v1/math.h:777:12: error: no member named 'llabs'
in the global namespace
  return ::llabs(__x);
         ~~^
~/env/bin/../include/c++/v1/math.h:785:12: error: no member named 'fabsf'
in the global namespace
  return ::fabsf(__lcpp_x);
         ~~^
~/env/bin/../include/c++/v1/math.h:789:12: error: no member named 'fabs' in
the global namespace; did you mean 'abs'?
  return ::fabs(__lcpp_x);
         ~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                                      ^
~/env/bin/../include/c++/v1/math.h:794:12: error: no member named 'fabsl'
in the global namespace
  return ::fabsl(__lcpp_x);
         ~~^

Best regards,
Naeem

On Thu, Jul 15, 2021 at 3:25 AM Simon Urbanek <simon.urbanek at r-project.org>
wrote:

> Naeem,
>
> I'm not sure which issues are you talking about specifically. If your
> package is well written, the instructions at
> https://mac.r-project.org/openmp/ should be sufficient with regular CRAN
> installation of R and standard tools.
>
> Cheers,
> Simon
>
>
>
> > On Jul 15, 2021, at 02:41, Naeem Khoshnevis <khoshnevis.naeem at gmail.com>
> wrote:
> >
> > Hi,
> >
> > I hope this email finds you well.
> > I wondered what the best approaches to troubleshooting C++ dependencies
> issues in general and specifically in R are; specifically, those packages
> which are using OpenMP and we want to install on macOS.
> > So far, I am just googling the error and finding out what the problem
> is. However, it is hard to address issues and come up with long-term
> solutions without internalizing the concepts.
> > One example is creating a conda environment for each R package project
> and installing llvm, clang, etc into each environment.
> > I talked to several software engineers; however, I could not find a
> convincing answer. I think I do not know what I do not know about this
> topic, which prevents me from asking good questions. I would be grateful if
> you could let me know your thoughts about these questions.
> >
> > Where is a good place to start learning about this topic?
> > Is a professional C++ developer necessarily good at troubleshooting
> problems with compilers and linkers? Or these are two different topics.
> >
> > Best regards,
> > Naeem Khoshnevis
> > _______________________________________________
> > Rcpp-devel mailing list
> > Rcpp-devel at lists.r-forge.r-project.org
> > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20210715/aef00e0d/attachment-0001.html>


More information about the Rcpp-devel mailing list