egeulgen / pathfindR

pathfindR: Enrichment Analysis Utilizing Active Subnetworks
https://egeulgen.github.io/pathfindR/
Other
178 stars 25 forks source link

error: Java version not detected: M1 MacMini OSX Monterey #109

Closed akhst7 closed 2 years ago

akhst7 commented 2 years ago

Hi,

pathfindR failed to be built with a following error;

The downloaded source packages are in
    ‘/private/var/folders/sl/253njlzx5797z3x9nlhrs79m0000gn/T/RtmpyJlAFe/downloaded_packages’
Running `R CMD build`...
* checking for file ‘/private/var/folders/sl/253njlzx5797z3x9nlhrs79m0000gn/T/RtmpyJlAFe/remotes128757750c798/egeulgen-pathfindR-d8b33ce/DESCRIPTION’ ... OK
* preparing ‘pathfindR’:
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
Omitted ‘LazyData’ from DESCRIPTION
* building ‘pathfindR_1.6.3.9002.tar.gz’
Installing package into ‘/Volumes/Documents/R_lib’
(as ‘lib’ is unspecified)
* installing *source* package ‘pathfindR’ ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘pathfindR’:
 .onAttach failed in attachNamespace() for 'pathfindR', details:
  call: fetch_java_version()
  error: Java version not detected. Please download and install Java from “https://www.java.com/en/”
Error: loading failed
Execution halted

OpenJDK is installed;

java --version                                                       
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment Zulu16.30+19-CA (build 16.0.1+9)
OpenJDK 64-Bit Server VM Zulu16.30+19-CA (build 16.0.1+9, mixed mode)
echo $JAVA_HOME                                                     
/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/home/jre

It looks like the install script fails to see the location of openJDK ?

Here is a set up for my Mimi;

neofetch                                                             
                    'c.          
                 ,xNMM.          -------------------------
               .OMMMMo           OS: macOS 12.0.1 21A559 arm64
               OMMM0,            Host: Macmini9,1
     .;loddo:' loolloddol;.      Kernel: 21.1.0
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 2 days, 1 hour, 34 mins
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 124 (brew)
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1920x1080
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark)
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: iTerm2
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   Terminal Font: MesloLGS-NF-Regular 14
    kMMMMMMMMMMMMMMMMMMMMMMd     CPU: Apple M1
     ;KMMMMMMMWXXWMMMMMMMk.      GPU: Apple M1
       .cooc,.    .,coo:.        Memory: 2554MiB / 16384MiB
egeulgen commented 2 years ago

hey @akhst7, It seems that most likely R cannot find the JAVA_HOME env variable. Try running R CMD javareconf in the terminal, then installing R . If that doesn't resolve the issue, please share the output of Sys.getenv("JAVA_HOME")

akhst7 commented 2 years ago

@egeulgen, after a bit of struggle and investigation, I found there was another java installed by Homebrew. I got rid of it, reinstalled Oracle openJDK 17, set JAVA_HOME, and run R CMD javareconf. And pathfindR was installed without a hitch.

Thanks.

R CMD javareconf                                                                 08:11:14 PM
Java interpreter : /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/java
Java version     : 17.0.1
Java home path   : /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
Java compiler    : /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/bin/jar

trying to compile and link a JNI program
detected JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
/opt/homebrew/opt/llvm/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/include/darwin  -I"/opt/homebrew/Cellar/hdf5/1.12.1/include" -I"/opt/homebrew/opt/szip/include"  -I"/opt/homebrew/opt/gettext/include" -I"/opt/homebrew/opt/llvm/include"  -I"/opt/homebrew/opt/libomp/include" -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" -Xclang -fopenmp   -fPIC  -g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe -c conftest.c -o conftest.o
/opt/homebrew/opt/llvm/bin/clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/homebrew/opt/llvm/lib -L/opt/homebrew/opt/bison/lib -L/opt/homebrew/opt/gettext/lib -Wl,-rpath,/opt/homebrew/opt/llvm/lib --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -lomp -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation

JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.

R_LDPATH was also set right;

/Library/Frameworks/R.framework/Resources/etc ❯ more ldpaths                                               08:22:03 PM
: ${JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home}
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/server}
if test -n ""; then
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib:}
else
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib}
fi
if test -n "${R_JAVA_LD_LIBRARY_PATH}"; then
  R_LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${R_JAVA_LD_LIBRARY_PATH}"
fi
## This is DYLD_FALLBACK_LIBRARY_PATH on Darwin (macOS) and
## LD_LIBRARY_PATH elsewhere.
## However, on macOS >=10.11 (if SIP is enabled, the default), the
## environment value will not be passed to a script such as R.sh, so
## would not seen here.
if test -z "${DYLD_FALLBACK_LIBRARY_PATH}"; then
  DYLD_FALLBACK_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
else
  DYLD_FALLBACK_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${DYLD_FALLBACK_LIBRARY_PATH}"
fi
export DYLD_FALLBACK_LIBRARY_PATH