2

Context

My uname -rv is 4.4.0-64-generic #85~14.04.1-Ubuntu SMP Mon Feb 20 12:10:54 UTC 2017 --- My compiler is GNU gcc 6.3.0 --- I am compiling GNU Octave from source. I have been trying to compile the Octave versions 4.0.2, 4.2.0 and 4.2.1

I configure the build with the invocation

${srcdir}/configure \
--prefix=/opt/octave/4.2.1 \
--with-java-homedir=/usr/lib/jvm/default-java \
--with-java-libdir=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server 

Issue

In all cases the make stage fails with the following error

libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::ping(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::attribute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::CoderInfo::description[abi:cxx11]() const'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::comment[abi:cxx11]() const'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::magick[abi:cxx11]() const'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::CoderInfo::CoderInfo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status

Evidence

In preparation of the manual installation, I had run sudo apt-get build-dep octave. This relates to version 3.8.1 which is the one currently supported by Ubuntu 14.04. Yet, I thought it could be no harm. (Suggestion from the file INSTALL.OCTAVE in the source directory)

To stay on the safe side, I installed the libraries libmagickcore-dev, libmagickwand-dev, libmagick++-dev from the Ubuntu repository 8:6.7.7.10-6ubuntu3.4). The issue arises with or without them.

Hence, dpkg -l | grep magick shows

ii imagemagick 8:6.7.7.10-6ubuntu3.4 amd64 image manipulation programs
ii imagemagick-common 8:6.7.7.10-6ubuntu3.4 all image manipulation programs -- infrastructure
ii libgraphicsmagick++1-dev 1.3.18-1ubuntu3 amd64 format-independent image processing - C++ development files
ii libgraphicsmagick++3 1.3.18-1ubuntu3 amd64 format-independent image processing - C++ shared library
ii libgraphicsmagick1-dev 1.3.18-1ubuntu3 amd64 format-independent image processing - C development files
ii libgraphicsmagick3 1.3.18-1ubuntu3 amd64 format-independent image processing - C shared library
ii libmagick++-dev 8:6.7.7.10-6ubuntu3.4 amd64 object-oriented C++ interface to ImageMagick - development files
ii libmagick++5:amd64 8:6.7.7.10-6ubuntu3.4 amd64 object-oriented C++ interface to ImageMagick
ii libmagickcore-dev 8:6.7.7.10-6ubuntu3.4 amd64 low-level image manipulation library - development files
ii libmagickcore5:amd64 8:6.7.7.10-6ubuntu3.4 amd64 low-level image manipulation library
ii libmagickcore5-extra:amd64 8:6.7.7.10-6ubuntu3.4 amd64 low-level image manipulation library - extra codecs
ii libmagickwand-dev 8:6.7.7.10-6ubuntu3.4 amd64 image manipulation library - development files
ii libmagickwand5:amd64 8:6.7.7.10-6ubuntu3.4 amd64 image manipulation library

The configuration stage exits nicely with status 0.

(Note the configure stage is not 100% foolproof: one previous attempt to build failed because I had no gnulib installed, which had not been caught by configure)

https://stackoverflow.com/questions/39228019/error-while-compiling-octave-with-gcc says that undefined references are a known trait of liboctinterp.so, as of of Octave 4.0.2. Either this buggy behaviour persists in 4.2.0, or there are hidden requirements that I am missing.

Question

What should I do to complete the compilation of Octave successfully?

  • Do the imagemagick++ libraries that you have installed actually include the methods that are shown in the error message? You could try to apt-get source them and grep for the method names, or check their documentation packages. It's not so uncommon that Ubuntu ships obsolete libraries that don't have some features used in some "fresh out of git" source code. – undercat Mar 4 '17 at 22:14
  • Also, did you try to re-do the installation from scratch after that failure that you experienced? Sometimes artifacts from older builds persist and can cause problems during subsequent builds. Sometimes they even persist after make distclean. – undercat Mar 4 '17 at 22:16
  • @vovick Thanks for the suggestions. After a little head-banging, I isolated the cause of the issue in the gcc compiler, which had been built from source code as well. I still have to formulate the issue properly and will ask in a separate post. In this case the libraries seems to in order and yes, I did remove the source build and install directories before each new attempt. – XavierStuvw Mar 5 '17 at 14:21
0

Same error here, but with a warning about conflicting libraries just above, which was the useful clue.

/usr/local/gcc-6.4.0_binutils-2.28.1_isl/lib64/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: libjpeg.so.8, needed by /usr/lib/../lib64/libtiff.so, may conflict with libjpeg.so.62
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::ping(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::attribute(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::CoderInfo::description[abi:cxx11]() const'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::comment[abi:cxx11]() const'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::Image::magick[abi:cxx11]() const'
libinterp/.libs/liboctinterp.so: undefined reference to `Magick::CoderInfo::CoderInfo(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'

Magick::Image::ping is expected to be in the c++ library, let's check which one has been used :

ldd libinterp/.libs/liboctinterp.so | grep -i magick++
        libGraphicsMagick++.so.12 => /usr/local/gcc-6.4.0_binutils-2.28.1_isl/lib64/libGraphicsMagick++.so.12 (0x00007faa870ab000)

But Magick::Image::ping is indeed there :

nm -C /usr/local/gcc-6.4.0_binutils-2.28.1_isl/lib64/libGraphicsMagick++.so | grep ping
000000000004c7a0 T Magick::Image::ping(Magick::Blob const&)
000000000004c740 T Magick::Image::ping(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

Hence something was preventing the linker to correctly use it.

Another clue that the libGraphicsMagick++.so are fine: with the same building procedure, same libraries, the octave stable branch builds fine while the dev branch fails.

Let's take the previous warning seriously. Actually it was already noted that

Note that with openSUSE 12.04 but also with 13.02, libjpeg-devel package lead to libjpeg62.so installation, that may conflict with libjpeg8.so that is also installed. That's why we recommend to not install libjpeg-devel, but rather install libjpeg8-devel.

libjpeg62-devel has to be replaced with libjpeg8-devel, because several packages depend on a jpeg library.

The following commands were issued on openSUSE 42.2.

sudo zypper install libjpeg8-devel

Problem: libjpeg62-devel-62.2.0-35.3.1.x86_64 conflicts with namespace:otherproviders(libjpeg-devel) provided by libjpeg8-devel-8.1.2-119.5.x86_64
Solution 1: deinstallation of libjpeg62-devel-62.2.0-35.3.1.x86_64
Solution 2: do not install libjpeg8-devel-8.1.2-119.5.x86_64

Choose from above solutions by number or cancel [1/2/c] (c): 1

The following NEW package is going to be installed:
libjpeg8-devel

The following package is going to be REMOVED:
libjpeg62-devel

1 new package to install, 1 to remove.
Overall download size: 110.8 KiB. Already cached: 0 B. After the operation, additional 63.6 KiB will be used.
Continue? [y/n/...? shows all options] (y):

but the jpeg library is still there. Let's find the package:

zypper se -f /usr/lib64/libjpeg.so.62.2.0
+ | libjpeg62 | The MMX/SSE accelerated JPEG compression/decompression library | package

Remove the library:

sudo zypper rm libjpeg62
The following package is going to be REMOVED:
libjpeg62

Then rebuild GraphicsMagick-1.3.28, install. The octave build passes now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.