carlos-alberto-silva / rGEDI

rGEDI: An R Package for NASA's Global Ecosystem Dynamics Investigation (GEDI) Data Visualization and Processing.
157 stars 67 forks source link

Error installing: libclidar/libLasProcess.c:1:10 on MacOS #18

Closed aplazaa closed 4 years ago

aplazaa commented 4 years ago

I am trying to install the package on MacOS 10.15.6 (19G73) but I am getting the following error message:

libclidar/libLasProcess.c:1:10: fatal error: 'stdio.h' file not found

include "stdio.h"

     ^~~~~~~~~

1 error generated. make: *** [libclidar/libLasProcess.o] Error 1 ERROR: compilation failed for package ‘rGEDI’

Thank you for your help!

caiohamamura commented 4 years ago

Try to install llvm in your terminal: brew install llvm

aplazaa commented 4 years ago

Hi, many thanks for your response.

I reinstalled llvm (it was already installed and update) and tried to install the packages again using "devtools::install_git("https://github.com/carlos-alberto-silva/rGEDI", dependencies = TRUE)", but I have the same error. The complete message is the following:

** libs "/Library/Frameworks/R.framework/Resources/bin/Rscript" ../tools/deps.R /usr/local/clang4/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/include -I/usr/local/opt/szip/include -I/usr/local/Cellar/hdf5/1.12.0_1/include -I/usr/local/Cellar/gsl/2.6/include -DDLLEXPORT -D__STDC_FORMAT_MACROS -DUSEPHOTON -DWITHOUT_GDAL -Igedisimulator -Itools -Icmpfit-1.2 -Ilibclidar -I. -fPIC -Wall -g -O2 -c libclidar/libLasProcess.c -o libclidar/libLasProcess.o libclidar/libLasProcess.c:1:10: fatal error: 'stdio.h' file not found

include "stdio.h"

     ^~~~~~~~~

1 error generated. make: *** [libclidar/libLasProcess.o] Error 1 ERROR: compilation failed for package ‘rGEDI’

Thank you for your help!

caiohamamura commented 4 years ago

Maybe you need to install xcode SDK for MacOS. I don't know exactly how to do that on MacOS, but take a look at this answer from StackOverflow: https://stackoverflow.com/a/52530212/2548351

aplazaa commented 4 years ago

Great! It's working now. Xcode was installed but with the upgrade to OSX Catalina, the folder /usr/include was removed. So I did the following:

  1. xcode-select --install

  2. sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/

  3. export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

Many thanks!