knausb / vcfR

Tools to work with variant call format files
248 stars 54 forks source link

cannot install for R version 4 on Mac #168

Closed brockels closed 4 years ago

brockels commented 4 years ago

Used

devtools::install_github(repo="knausb/vcfR") result: ERROR: lazy loading failed for package ‘vcfR’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/vcfR’ Error: Failed to install 'vcfR' from GitHub: (converted from warning) installation of package ‘/var/folders/tj/r62qq3tx55bg7wlq57g3z_jr0000gn/T//RtmpipgmLz/file132f25657f7f9/vcfR_1.12.0.tar.gz’ had non-zero exit status Cant seem to fix it: is it a mac issue or an R version issue?
knausb commented 4 years ago

Used:

devtools::install_github(repo="knausb/vcfR")

and it installed just fine on my MacBook Pro. Do you have Xcode installed? This does not appear to be an issue with Mac or R but instead is specific to your system.

soulsacross commented 4 years ago

@brockels If you are using Catalina, /usr/include is purged and protected by SIP, thus C fails to compile.

Make sure you have command line tools installed and updated (xcode-select --install), then set the toolchain from the beginning with this tutorial on setting up the development toolchain for R4.0.0+, uninstall any devel toolchain you have first. You will also need to include on your new ~/.R/Makevars file the following

LOC = /usr/local/gfortran/
CC=$(LOC)/bin/gcc -fopenmp
CXX=$(LOC)/bin/g++ -fopenmp
# -O3 should be faster than -O2 (default) level optimisation ..
CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe
LDFLAGS=-L/usr/local/opt/gettext/lib -L$(LOC)/lib -Wl,-rpath,$(LOC)/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I$(LOC)/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include

After that, if you get errors likeerror: no member named 'signbit' in the global namespace, take a look at this post

knausb commented 4 years ago

Hi @soulsacross ,

Thank you for providing a detailed response with links to more information! I'm using macOS Catalina 10.15.6 and feel I'm seeing different things than you. I'm not using a Makevars file and am not finding compilers in the locations you appear to have specified.

Brians-MacBook-Pro-2:~ knausb$ ls ~/.R/Makevars
ls: /Users/knausb/.R/Makevars: No such file or directory
Brians-MacBook-Pro-2:~ knausb$ ls /usr/local/gfortran
ls: /usr/local/gfortran: No such file or directory
Brians-MacBook-Pro-2:~ knausb$ ls /bin/gcc
ls: /bin/gcc: No such file or directory
Brians-MacBook-Pro-2:~ knausb$ ls /bin/gcc++
ls: /bin/gcc++: No such file or directory

Yet vcfR builds just fine on my system. I am concerned that your recommendations may be system specific (i.e., not portable). Perhaps users should make sure Xcode is installed first before trying your suggestions? Thank you!