r-lidar-lab / lidRviewer

An OpenGL point cloud viewer for R able to handle several millions of points
74 stars 17 forks source link

Cannot install due to SDL.h not being found #5

Closed Napoleongl closed 4 years ago

Napoleongl commented 4 years ago

Hi!

I'm running into the following error when attempting install:

devtools::install_github("Jean-Romain/PointCloudViewer")
Downloading GitHub repo Jean-Romain/PointCloudViewer@master
✔  checking for file ‘/tmp/Rtmp8mfSL5/remotes67d83df20d72/Jean-Romain-PointCloudViewer-6101481/DESCRIPTION’ ...
─  preparing ‘PointCloudViewer’:
✔  checking DESCRIPTION meta-information
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘PointCloudViewer_0.2.0.tar.gz’

* installing *source* package ‘PointCloudViewer’ ...
** using staged installation
** libs
x86_64-conda_cos6-linux-gnu-c++ -std=gnu++11 -I"/home/guslun/anaconda3/envs/renv/lib/R/include" -DNDEBUG  -I"/home/guslun/anaconda3/envs/renv/lib/R/library/Rcpp/include" -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -I/home/guslun/anaconda3/envs/renv/include -Wl,-rpath-link,/home/guslun/anaconda3/envs/renv/lib  -fpic  -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/guslun/anaconda3/envs/renv/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1562872960081/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/home/guslun/anaconda3/envs/renv=/usr/local/src/conda-prefix  -c RcppExports.cpp -o RcppExports.o
x86_64-conda_cos6-linux-gnu-c++ -std=gnu++11 -I"/home/guslun/anaconda3/envs/renv/lib/R/include" -DNDEBUG  -I"/home/guslun/anaconda3/envs/renv/lib/R/library/Rcpp/include" -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -I/home/guslun/anaconda3/envs/renv/include -Wl,-rpath-link,/home/guslun/anaconda3/envs/renv/lib  -fpic  -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/guslun/anaconda3/envs/renv/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1562872960081/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/home/guslun/anaconda3/envs/renv=/usr/local/src/conda-prefix  -c camera.cpp -o camera.o
In file included from camera.cpp:1:0:
camera.h:4:10: fatal error: SDL/SDL.h: No such file or directory
 #include <SDL/SDL.h>
          ^~~~~~~~~~~
compilation terminated.
make: *** [/home/guslun/anaconda3/envs/renv/lib/R/etc/Makeconf:175: camera.o] Error 1
ERROR: compilation failed for package ‘PointCloudViewer’
* removing ‘/home/guslun/anaconda3/envs/renv/lib/R/library/PointCloudViewer’
Error: Failed to install 'PointCloudViewer' from GitHub:
  (converted from warning) installation of package ‘/tmp/Rtmp8mfSL5/file67d87b71489e/PointCloudViewer_0.2.0.tar.gz’ had non-zero exit status

Both prereq libraries have been installed however, albeit with a warning for SDL that a newer verion is used as far as I understand the issue.

(renv) guslun@K2006559:~$ sudo apt-get install libsdl-dev freeglut3-dev
[sudo] password for guslun: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libsdl1.2-dev' instead of 'libsdl-dev'
freeglut3-dev is already the newest version (2.8.1-3).
libsdl1.2-dev is already the newest version (1.2.15+dfsg2-0.1ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
(renv) guslun@K2006559:~$ locate SDL.h
/usr/include/SDL/SDL.h

Is there a way of getting the installation to find SDL.h so I can use the package properly?

Jean-Romain commented 4 years ago

My SDL.h is at the same location than yours. Your version of the SLD is up-to-date according to apt-get. It should work. Try to restart your computer first.

Napoleongl commented 4 years ago

Nope, didnt work.Even

apt remove libsdl-dev --purge 
apt autoremove
reboot
apt install libsdl-dev

didnt work. Also cloned repo, and copied tie entire SDL-folder from usr/include to both the root of the package and /src and then tried to compile, same error. Also copied only the SDL.h - file to /src and tried to compile. no luck... Any hints on where R looks for header files when it tries to compile?

Jean-Romain commented 4 years ago

On Linux R searches for libraries on their regular place i.e. /usr/include/ or any other relevant places. In your case we can see that it looks in /home/guslun/anaconda3/envs/renv/include and other paths pretty similar. I don't know what is anaconda but if you are working in a kind of container or whatever this is your responsibility to know how it works.

Napoleongl commented 4 years ago

Anaconda is a package and virtual environment manager that among other things simplifies reproducible research. And apparently it makes certain things harder than they should as well! Copying SGL and GL-libraries into the above include-path solved som problems and then others arose, but they should be solvable if I get Anaconda to look for things in the right places. So this issue can be closed or if you prefer that I submit my solution whenever I get one just for completeness!

Jean-Romain commented 4 years ago

You can post your solution. It may help other users of anaconda.

JZL commented 1 year ago

Hi,

This is a great package, thanks so much for writing it. Scales beautifully

For what it's worth, I got it to work with anaconda using these packages (you can use conda not mamba but mamba is great)

mamba install -c conda-forge sdl freeglut libglu
mamba install -c conda-forge mesalib
mamba install -c conda-forge mesa-libgl-devel-cos7-x86_64

The last one is the only strange one, and there are a lot of similar sounding package names on anaconda which all might work, I chose this one instead of cos6 since it seemed newer