1

This is a question/answer post, intended for people encountering the same issue.

This problem only happens when using a separate toolchain (gcc, binutils, libtool) which is not in the standard path.

i.e., which gcc gives a location that is not listed by

sudo env | grep -w "PATH="

This was necessary to compile octave-4.2 on OpenSUSE 13.2 (the standard gcc was too old).

On a standard system, where there is only one toolchain, and this toolchain is in the standard path, sudo make install works just fine.

Here is the error, on sudo make install:

libtool: warning: relinking 'Magick++/lib/libGraphicsMagick++.la'
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
Magick++/lib/.libs/Magick___lib_libGraphicsMagick___la-Image.o: unrecognized relocation (0x2a) in section `.text'
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
libtool: error: error: relink 'Magick++/lib/libGraphicsMagick++.la' with the above command before installing it
ederag
  • 350

1 Answers1

1

Here is the reason why:

The point was that the configure and make steps worked because the PATH was prepended with the location of the toolchain (e.g. gcc)

But sudo does not propagate the variables. Hence sudo make install ran commands with the wrong toolchain (the old gcc for instance).

One solution is to just use su

su
# make install
ederag
  • 350