File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1923,15 +1923,44 @@ recompile_into <- function(target) {
19231923# Helper for %||%
19241924`%||%` <- function (x , y ) if (is.null(x )) y else x
19251925
1926+ tcc_library_search_paths <- function (
1927+ sysname = as.character(unname(Sys.info()[[" sysname" ]]))
1928+ ) {
1929+ platform_paths <- tcc_platform_lib_paths(sysname )
1930+
1931+ env_vars <- unique(c(
1932+ tcc_loader_env_key(sysname ),
1933+ " LIBRARY_PATH" ,
1934+ if (identical(sysname , " Darwin" )) {
1935+ " DYLD_FALLBACK_LIBRARY_PATH"
1936+ } else {
1937+ character (0 )
1938+ }
1939+ ))
1940+
1941+ env_paths <- unlist(
1942+ lapply(env_vars , function (key ) {
1943+ value <- Sys.getenv(key , unset = " " )
1944+ if (! nzchar(value )) {
1945+ return (character (0 ))
1946+ }
1947+ strsplit(value , .Platform $ path.sep , fixed = TRUE )[[1 ]]
1948+ }),
1949+ use.names = FALSE
1950+ )
1951+
1952+ unique(c(env_paths [nzchar(env_paths )], platform_paths ))
1953+ }
1954+
19261955# Search for library in platform-dependent paths
19271956tcc_find_library <- function (name ) {
19281957 if (file.exists(name )) {
19291958 return (name )
19301959 }
19311960
1932- # Try platform-specific paths
1961+ # Try platform-specific paths plus relevant loader/linker env paths.
19331962 sysname <- as.character(unname(Sys.info()[[" sysname" ]]))
1934- paths <- tcc_platform_lib_paths (sysname )
1963+ paths <- tcc_library_search_paths (sysname )
19351964
19361965 suffix_pattern <- c(
19371966 Windows = " \\ .dll$" ,
Original file line number Diff line number Diff line change @@ -229,7 +229,7 @@ find_system_math_library <- function() {
229229 }
230230
231231 sysname <- as.character(unname(Sys.info()[[" sysname" ]]))
232- paths <- unique(Rtinycc ::: tcc_platform_lib_paths (sysname ))
232+ paths <- unique(Rtinycc ::: tcc_library_search_paths (sysname ))
233233 patterns <- switch (
234234 sysname ,
235235 Linux = c(" ^libm\\ .so(\\ .[0-9]+)+$" ),
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ find_system_math_library <- function() {
2020 }
2121
2222 sysname <- as.character(unname(Sys.info()[["sysname"]]))
23- paths <- unique(Rtinycc:::tcc_platform_lib_paths (sysname))
23+ paths <- unique(Rtinycc:::tcc_library_search_paths (sysname))
2424 patterns <- switch(
2525 sysname,
2626 Linux = c("^libm\\.so(\\.[0-9]+)+$"),
You can’t perform that action at this time.
0 commit comments