randy3k / radian

A 21 century R console
MIT License
2.03k stars 76 forks source link

radian needs to also process `ldpaths` file on macOS #413

Closed mjsteinbaugh closed 1 year ago

mjsteinbaugh commented 1 year ago

Hi @randy3k ,

I'm running into an R configuration issue with radian on macOS. I use a custom ldpaths file to utilize external libraries managed by koopa, which install into /opt/koopa instead of /usr/local. I noticed that radian currently only reads the R ldpaths file on Linux, due to sys.platform.startswith("linux") in app.py.

See code here: https://github.com/randy3k/radian/blob/dde559fe820765436eada91a136292be91fb48c3/radian/app.py#L78

Can we modify this to also parse ldpaths on macOS and use either R_LD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH?

Here's my current ldpaths file, for reference:

: ${JAVA_HOME=/opt/koopa/app/temurin/17.0.7+7}
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/libexec/Contents/Home/lib/server}
R_LD_LIBRARY_PATH="/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib:/opt/koopa/app/cairo/1.16.0/lib:/opt/koopa/app/fontconfig/2.14.2/lib:/opt/koopa/app/xorg-libxext/1.3.5/lib:/opt/koopa/app/proj/9.2.0/lib:/opt/koopa/app/libssh2/1.10.0/lib:/opt/koopa/app/sqlite/3.41.0/lib:/opt/koopa/app/openssl3/3.1.0/lib:/opt/koopa/app/python3.11/3.11.3/lib:/opt/koopa/app/libtiff/4.5.0/lib:/opt/koopa/app/pcre/8.45/lib:/opt/koopa/app/xorg-libx11/1.8.4/lib:/opt/koopa/app/xorg-libxrender/0.9.11/lib:/opt/koopa/app/geos/3.11.2/lib:/opt/koopa/app/gettext/0.21.1/lib:/opt/koopa/app/xz/5.4.1/lib:/opt/koopa/app/libxml2/2.10.3/lib:/opt/koopa/app/libffi/3.4.4/lib:/opt/koopa/app/hdf5/1.14.0/lib:/opt/koopa/app/graphviz/7.1.0/lib:/opt/koopa/app/xorg-libxt/1.2.1/lib:/opt/koopa/app/readline/8.2/lib:/opt/koopa/app/xorg-libsm/1.2.4/lib:/opt/koopa/app/imagemagick/7.1.1-3/lib:/opt/koopa/app/xorg-libice/1.1.1/lib:/opt/koopa/app/xorg-libxrandr/1.5.3/lib:/opt/koopa/app/xorg-libxcb/1.15/lib:/opt/koopa/app/icu4c/72.1/lib:/opt/koopa/app/zstd/1.5.4/lib:/opt/koopa/app/openblas/0.3.23/lib:/opt/koopa/app/zlib/1.2.13/lib:/opt/koopa/app/pcre2/10.42/lib:/opt/koopa/app/fribidi/1.0.12/lib:/opt/koopa/app/gdal/3.6.4/lib:/opt/koopa/app/lapack/3.11.0/lib:/opt/koopa/app/xorg-libxdmcp/1.1.4/lib:/opt/koopa/app/xorg-libpthread-stubs/0.4/lib:/opt/koopa/app/bzip2/1.0.8/lib:/opt/koopa/app/libgit2/1.6.3/lib:/opt/koopa/app/pixman/0.42.2/lib:/opt/koopa/app/curl7/7.88.1/lib:/opt/koopa/app/xorg-libxau/1.0.11/lib:/opt/koopa/app/harfbuzz/7.2.0/lib:/opt/koopa/app/libpng/1.6.39/lib:/opt/koopa/app/libjpeg-turbo/2.1.5.1/lib:/opt/koopa/app/glib/2.75.4/lib:/opt/koopa/app/libiconv/1.17/lib:/opt/koopa/app/freetype/2.13.0/lib:/usr/lib:${R_JAVA_LD_LIBRARY_PATH}:"
export R_LD_LIBRARY_PATH
DYLD_FALLBACK_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
export DYLD_FALLBACK_LIBRARY_PATH

See related issues and pulls:

Best, Mike

mjsteinbaugh commented 1 year ago

See related fix in PyCharm: https://youtrack.jetbrains.com/issue/R-1271/R-console-not-working-in-macos-with-Pycharm-2020.3-and-above-including-latest-2021.1

And here's additional information on external software from the R admin guide: https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#External-software

mjsteinbaugh commented 1 year ago

Closing this issue in favor of proposed pull request