VCityTeam / 3DUSE

Other
5 stars 5 forks source link

Dependency GDAL 1.11.4 won't install (on Ubuntu 16.04) #46

Open andredaa opened 5 years ago

andredaa commented 5 years ago

I am trying to setup 3DUSE - which has a dependency on GDAL 1.11.4 This however won't install on Ubuntu 16.04 due to internal errors.

gdalwmsdataset.cpp:383:37: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if(pszHttpZeroBlockCodes == '\0') { ^~~~ ../../GDALmake.opt:562: recipe for target '../o/gdalwmsdataset.lo' failed make[2]: [../o/gdalwmsdataset.lo] Error 1 make[2]: Leaving directory '/tmp/gdal-1.11.4/frmts/wms' GNUmakefile:10: recipe for target 'wms-install-obj' failed make[1]: [wms-install-obj] Error 2 make[1]: Leaving directory '/tmp/gdal-1.11.4/frmts' GNUmakefile:63: recipe for target 'frmts-target' failed make: *** [frmts-target] Error 2

EricBoix commented 5 years ago

I'm currently (like yesterday morning) working on embedding 3DUse within a Docker container using an Ubuntu 16.04 as base. I also hit a snag when trying to install Gdal 1.11.4 on Ubuntu 16.04. The difficulty arises because gdal has many dependencies that are not pulled by default and that you must know about (for details on this look in the comment in the Dockerfile I'm providing below).

In order to avoid myself this trouble, I found out that one can simply use the default 1.X version of Gdal as provided by the apt-get packaging utility (it's 1.10.1 under the hood) on top of which 3DUse can also be compiled smoothly.

Please find below the current (unpolished) state of the Dockerfile that builds 3DUse on Ubuntu 16.04. You might want to extract the commands (in case you are not familiar with Dockerfiles, basically it suffice to remove the heading RUN docker command as well as removing the && \ and \ line folders) enabling you to build 3DUse on that platform.

Hoping this will do the trick for you, without messing up you current package ecosystem...

FROM ubuntu:16.04
LABEL vendor="RICT project"

# Core dependencies
RUN apt-get update
RUN apt-get -y install libboost-all-dev
RUN apt-get -y install libassimp-dev
RUN apt-get -y install libxml2-dev
RUN apt-get install -y libgdal1-dev  # Pulls version 1.10.1
                                     # Check with apt-cache policy libgdal1-dev

# Notes concerning the GDAL dependency
# The last documented GDAL version in the 1.X series that worked with
# 3DUSE is 1.11.4. That version, that is not packaged for Ubuntu can be
# installed with the following commands (see below). Yet this installation
# fails in being effective for 3DUSE, because GDAL has many optional 
# sub-dependencies (e.g. proj, json-c, libgeotiff, libtiff, libspatialite,
# liblwgeom 2.4.4) that are not automatically pulled by the following
# manual install. And by default when GDAL is not compiled without prior
# install of say libgeos-dev, then some methods will change their behavior
# and e.g. OGRPolygon::IsValid() will always return false.
# cd /tmp
# wget http://download.osgeo.org/gdal/1.11.4/gdal-1.11.4.tar.gz
# tar zxvf gdal-1.11.4.tar.gz
# cd gdal-1.11.4
# mkdir $HOME/local/
# ./configure --prefix=$HOME/local/gdal-1.11.4 --enable-shared
# make
# make install

# Graphical User Interface dependencies
RUN apt-get -y install libopenscenegraph-dev
RUN apt-get -y install qt4-default libqt4-opengl-dev

# Software engineering tools (build stages)
RUN apt-get -y install build-essential g++ # Pulls gcc, make...
RUN apt-get -y install git
RUN apt-get -y install cmake
RUN apt-get -y install wget

# PCL is optionnal: when selected it has its own sub-dependencies
RUN apt-get -y install libeigen3-dev
RUN apt-get -y install libflann-dev
RUN apt-get -y install libqhull-dev
RUN apt-get -y install libpng12-dev

# For 3DUSE, a specific version of PCL is required. Proceed with manual install
RUN cd /tmp &&                                 \
    wget https://download.gforge.liris.cnrs.fr/meppbin/travis-trusty/pcl-pcl-1.7.2.travis-trusty.tgz && \
    tar zxf pcl-pcl-1.7.2.travis-trusty.tgz && \
    cd pcl-pcl-1.7.2/buildR &&                 \
    make &&                                    \
    make install  # Must be root

# Eventually install 3DUSE internal (embarked) dependencies
RUN cd                                                 && \
    git clone https://github.com/MEPP-team/3DUSE       && \
    cd 3DUSE                                           && \
    cd externals/laslib                                && \
    mkdir Build                                        && \
    cd Build                                           && \
    cmake .. -DCMAKE_BUILD_TYPE=Release                   \
             -DCMAKE_INSTALL_PREFIX=$HOME/local/laslib && \
    make                                               && \
    make install
# And terminate the install by building 3DUSE itself
RUN cd ~/3DUSE                                      && \
    mkdir Build                                     && \
    cd Build                                        && \
    cmake --verbose                                    \
    -DBUILD_GUI_QT4=ON                                 \
    -DBUILD_PCL=ON                                     \
    -DLASLIB_INCLUDE_DIR=~/local/laslib/include        \
    -DLASLIB_LIBRARY=~/local/laslib/lib/liblaslib.a    \
    ..                                              && \
    make                                            && \
    make install
andredaa commented 5 years ago

Hello @EricBoix
awesome! Thank you so much for the fast response! I wouldnt mind using 3Duse in a docker :) Will it expose a port on the localhost to open 3Duse in a browser? How do I run the actual tool , once the docker is up? (I never saw 3Duse in action, so I don't actually know what to expect :D - but it looks like it is not actually browser based?) Thanks! Andre

EricBoix commented 5 years ago

@andredaa : since 3DUse code is already (the drift happened in less than 18 months) off-sync with the default package ecosystem required for it (e.g. gdal-1X instead of gdal-2.Y) it is indeed a drag to restore that required context (specially on an uptodate development desktop that you don't want to tear appart). And by going to Docker my hope was indeed to have the ad-hoc dependency "sandbox" for 3DUse.

I'm a newbie to Docker, but what I understood is that you expose ports for services to be visible and clients to hit such services. 3DUse is an X11 client (which reverses things) and if you launch it, it won't know what X11 server to contact. This ended my attempt to launch 3DUse from the CMD Docker entry. In other terms, and with my limited understanding, Docker doesn't seem conceived to launch X11 clients...

Instead what I tried is to launch the Docker image in interactive mode while transmitting the X11 DISPLAY variable (and possibly the ad-hoc Xauth keys): refer to this StackOverflow for the full trick explanation. So assuming the Docker image is named three-d-use, I launch it with

docker run -v /tmp/.X11-unix:/tmp/.X11-unix:ro -e DISPLAY=$DISPLAY -it three-d-use

and, from the (interactive) shell you obtain, I launch the 3DUse client with the command

(docker-shell): 3DUSE/Build/3DUSE

The following picture gives you some hint of what you get in terms of GUI: 3duse-mainwindow

BUT BUT BUT (there is always a but), 3DUse uses OpenGL for handling 3D-Graphics and the Docker layers seems to block access to the graphic board. The usage of 3DUse thus becomes dogish and the GUI is soooo slow to react (to a simple menu pull down) that it is NOT usable anymore... I guess there is no such thing as free lunch.

andredaa commented 5 years ago

"I guess there is no such thing as free lunch" :D I think the GUI looks tempting! Not a docker-pro neither, but yes it doesn't look like it was made to be used with a GUI / or to be using basic hardware. Itried to use Docker on a raspi once - couldnt get down to the GPIO (other people probably can, I couldnt). I think I would just set up a VirtualBox VM and follow your dockerfile for installation :) Won't have time to try until Wednesday unfortunately. But I let you know :) Thank you so much for your help! Best Andre

EricBoix commented 5 years ago

@andredaa We did hit the same issue (that is gdalwmsdataset.cpp:383:37: error: ISO C++ forbids comparison between pointer and integer) when installing 3DUSE on one our of desktops. After inquiring we found out that the 3DUSE compile was falling because of a "collision" with an Anaconda based concurrent installation of GDAL (or one of its many sub-dependencies).

This "collision" happened because in order to use Anaconda the user's PATH environnement variable ended-up prefixed with some anaconda related directories (e.g. PATH=/home/kyron/anaconda3/bin:/home/kyron/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:...). Down the road this setup ended up messing up the compilation of 3DUSE since some included files were gotten from the Anaconda file hierarchy.

In to fix this "collision" we simply expurged the PATH from any anaconda reference and 3DUSE could be build without further difficulty.

Could it be that you have another installation of GDAL (or its dependencies) and that they have compiler/linker level priority ?