[R-sig-Geo] Problems with installing rgdal on Ubuntu "checking gdal: linking with --libs only... no"

Tomislav Hengl tom.hengl at gmail.com
Thu Aug 4 21:49:16 CEST 2016


You were right - I had two gdals, a manual installation and an 
installation from apt* and this confused my system.

So this is what I did:

1. Removed packages 'gdal-bin', 'libgdal-dev' etc using:

sudo apt-get purge --auto-remove gdal-bin
sudo apt-get purge --auto-remove libgdal
sudo apt-get purge --auto-remove libkml-dev

2. Manually removed files from '/usr/local' e.g.:

sudo find /usr/local/bin/ -name 'gdal*' -delete
sudo find /usr/local/lib/ -name 'libgdal*' -delete

After that rgdal installs without a problem.

I am surprised that I had to manually delete files from the disk (I 
guess manual install means manual deletion?), but yes this does solve 
the problem.

Many thanks Edzer and Roger!



On 04/08/16 19:13, Edzer Pebesma wrote:
> What is your output of gdal-config --libs ? On 14.04 I see:
>
> $ gdal-config --libs
> -L/usr/local/lib -lgdal
> $ which gdal-config
> /usr/local/bin/gdal-config
> $ gdal-config --version
> 2.1.0
>
> which indicates a manual install (from source). Your error message below
> indicates a version in /usr/local/ that is broken. Manually installed
> libs in /usr/local override the ones installed by apt* (which are in
> /usr/lib etc -- Robin's post assumes no installs in /usr/local), so now
> you must either:
>
> 1. fix the installed version in /usr/local , or
> 2. remove the ones installed in /usr/local so that the ones in /usr/lib
> are found.
>
> On 04/08/16 16:42, Tomislav Hengl wrote:
>> Hi Roger,
>>
>> Thanks for this. I was looking at this post by Robin
>> (https://www.r-bloggers.com/installing-rgdal-in-ubuntu-13-04/) and I
>> followed all steps but I still get the same results. Should I remove all
>> packages connected with GDAL and then start with installing from
>> scratch? How do I find double installations / broken links? I've tested
>> gdal utils from command line and everything works fine BTW.
>>
>> Here is what I get when I check when I look for gdal on my server:
>>
>> $ sudo apt-cache pkgnames|grep -i gdal
>> libgdal1i
>> libgdal-java
>> libgdal1-1.11.3-grass
>> libgdal1-dev
>> libgdal-dev
>> libgdal-doc
>> libgdal-perl
>> gdal-bin
>> python3-gdal
>> python-gdal
>> dans-gdal-scripts
>>
>> Thank you
>>
>>
>> On 03/08/16 23:00, Roger Bivand wrote:
>>> Hi Tom,
>>>
>>> As you can see from the configure output, your GDAL install is broken:
>>>
>>> ...
>>> checking gdal.h usability... yes
>>> checking gdal.h presence... yes
>>> checking for gdal.h... yes
>>> checking gdal: linking with --libs only... no
>>> checking gdal: linking with --libs and --dep-libs... no
>>> /usr/local/lib/libgdal.so: undefined reference to
>>> `kmlengine::Href::Parse(std::__cxx11::basic_string<char,
>>> std:: char_traits<char>, std::allocator<char> > const&)'
>>> /usr/local/lib/libgdal.so: undefined reference to
>>> `kmlengine::KmzFile::ReadKmlAndGetPath(std::__cxx11::basic_string<char,
>>> std:: char_traits<char>, std::allocator<char> >*,
>>> std: :__cxx11::basic_string<char, std::char_traits<char>,
>>> std:: allocator<char> >*) const'
>>> ...
>>>
>>> My guess is either multiple installed GDAL versions, or a GDAL built
>>> with libkml but without access to the libkml shared object. With
>>> correctly installed GDAL, you would see:
>>>
>>> checking gdal.h usability... yes
>>> checking gdal.h presence... yes
>>> checking for gdal.h... yes
>>> checking gdal: linking with --libs only... yes
>>>
>>> It could also be a C++ version problem between GDAL and its
>>> dependencies, but I suspect a broken GDAL.
>>>
>>> Hope this helps,
>>>
>>> Roger
>>>
>>> On Wed, 3 Aug 2016, Tomislav Hengl wrote:
>>>
>>>> Hi Roger,
>>>>
>>>> I am sorry to bother you with this. I have reinstalled R on my server
>>>> (actually MRO) and I have been stuck now trying to install rgdal
>>>> (constantly getting "configure: Install failure: compilation and/or
>>>> linkage problems. configure: error: GDALAllRegister not found in
>>>> libgdal."). I've looked at numerous posts
>>>> (http://stackoverflow.com/questions/34442010/r-cannot-install-rgdal-package-on-ubuntu-14-04)
>>>> but I do not see where the problem comes from.
>>>>
>>>> Thank you!
>>>>
>>>> Here is my existing GDAL installation:
>>>>
>>>> $ gdal-config --version
>>>> 2.1.0
>>>> $ proj
>>>> Rel. 4.9.2, 08 September 2015
>>>> usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]
>>>>
>>>> $ ldd /usr/lib64/MRO-3.3.0/R-3.3.0/lib/R/bin/exec/R
>>>>          linux-vdso.so.1 =>  (0x00007ffd9098e000)
>>>>          libR.so => not found
>>>>          libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0
>>>> (0x00007f8cebcb3000)
>>>>          libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
>>>> (0x00007f8ceb8e9000)
>>>>          /lib64/ld-linux-x86-64.so.2 (0x000055aff5b57000)
>>>>
>>>>
>>>>>   install.packages("rgdal")
>>>> Installing package into ‘/home/tom/R/x86_64-pc-linux-gnu-library/3.3’
>>>> (as ‘lib’ is unspecified)
>>>> trying URL
>>>> 'https://mran.microsoft.com/snapshot/2016-06-01/src/contrib/rgdal_1.1-10.tar.gz'
>>>> Content type 'application/octet-stream' length 1653393 bytes (1.6 MB)
>>>> ==================================================
>>>> downloaded 1.6 MB
>>>>
>>>> * installing *source* package ‘rgdal’ ...
>>>> ** package ‘rgdal’ successfully unpacked and MD5 sums checked
>>>> configure:  CC: gcc -std=gnu99
>>>> configure:  CXX: g++
>>>> configure:  rgdal: 1.1-10
>>>> checking for /usr/bin/svnversion... yes
>>>> configure:  svn revision: 622
>>>> checking for gdal-config... /usr/local/bin/gdal-config
>>>> checking gdal-config usability... yes
>>>> configure:  GDAL: 2.1.0
>>>> checking GDAL version >= 1.6.3... yes
>>>> configure:  experimental conditional use of GDAL2
>>>> checking for gcc... gcc -std=gnu99
>>>> checking whether the C compiler works... yes
>>>> checking for C compiler default output file name... a.out
>>>> checking for suffix of executables...
>>>> checking whether we are cross compiling... no
>>>> checking for suffix of object files... o
>>>> checking whether we are using the GNU C compiler... yes
>>>> checking whether gcc -std=gnu99 accepts -g... yes
>>>> checking for gcc -std=gnu99 option to accept ISO C89... none needed
>>>> checking how to run the C preprocessor... gcc -std=gnu99 -E
>>>> checking for grep that handles long lines and -e... /bin/grep
>>>> checking for egrep... /bin/grep -E
>>>> checking for ANSI C header files... yes
>>>> checking for sys/types.h... yes
>>>> checking for sys/stat.h... yes
>>>> checking for stdlib.h... yes
>>>> checking for string.h... yes
>>>> checking for memory.h... yes
>>>> checking for strings.h... yes
>>>> checking for inttypes.h... yes
>>>> checking for stdint.h... yes
>>>> checking for unistd.h... yes
>>>> checking gdal.h usability... yes
>>>> checking gdal.h presence... yes
>>>> checking for gdal.h... yes
>>>> checking gdal: linking with --libs only... no
>>>> checking gdal: linking with --libs and --dep-libs... no
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::Href::Parse(std::__cxx11::basic_string<char, std::
>>>> char_traits<char>, std::allocator<char> > const&)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::KmzFile::ReadKmlAndGetPath(std::__cxx11::basic_string<char,
>>>> std:: char_traits<char>, std::allocator<char> >*, std:
>>>> :__cxx11::basic_string<char, std::char_traits<char>, std::
>>>> allocator<char> >*) const'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::KmzFile::OpenFromString(std::__cxx11::basic_string<char,
>>>> std:: char_traits<char>, std::allocator<char> > const&)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmldom::SerializePretty[abi:cxx11](boost::intrusive_ptr<kmldom::Element>
>>>> const&)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmldom::Parse(std::__cxx11::basic_string<char,
>>>> std::char_traits<char>, std:: allocator<char> > const&,
>>>> std::__cxx11::basic_string<char, std:: char_traits<char>,
>>>> std::allocator<char> >*)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::KmzFile::ReadFile(char const*, std:
>>>> :__cxx11::basic_string<char, std::char_traits<char>, std::
>>>> allocator<char> >*) const'
>>>> collect2: error: ld returned 1 exit status
>>>> /usr/bin/ld: warning: libproj.so.10, needed by
>>>> /usr/local/lib/libgdal.so, may conflict with libproj.so.9
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::Href::Parse(std::__cxx11::basic_string<char, std::
>>>> char_traits<char>, std::allocator<char> > const&)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::KmzFile::ReadKmlAndGetPath(std::__cxx11::basic_string<char,
>>>> std:: char_traits<char>, std::allocator<char> >*, std:
>>>> :__cxx11::basic_string<char, std::char_traits<char>, std::
>>>> allocator<char> >*) const'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::KmzFile::OpenFromString(std::__cxx11::basic_string<char,
>>>> std:: char_traits<char>, std::allocator<char> > const&)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmldom::SerializePretty[abi:cxx11](boost::intrusive_ptr<kmldom::Element>
>>>> const&)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmldom::Parse(std::__cxx11::basic_string<char,
>>>> std::char_traits<char>, std:: allocator<char> > const&,
>>>> std::__cxx11::basic_string<char, std:: char_traits<char>,
>>>> std::allocator<char> >*)'
>>>> /usr/local/lib/libgdal.so: undefined reference to
>>>> `kmlengine::KmzFile::ReadFile(char const*, std:
>>>> :__cxx11::basic_string<char, std::char_traits<char>, std::
>>>> allocator<char> >*) const'
>>>> collect2: error: ld returned 1 exit status
>>>> configure:  Install failure: compilation and/or linkage problems.
>>>> configure:  error: GDALAllRegister not found in libgdal.
>>>> ERROR:  configuration failed for package ‘rgdal’
>>>> * removing ‘/home/tom/R/x86_64-pc-linux-gnu-library/3.3/rgdal’
>>>>
>>>>
>>>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list