39

I'm trying to install glib in a non-standard prefix but I get the following when running make install:

/bin/sh ../libtool --mode=install /usr/bin/install -c libgthread-2.0.la '/root/build/lib'
libtool: install: error: cannot install `libgthread-2.0.la' to a directory not ending in /usr/local/lib

Any reason why I have to install gthread only in a prefix ending with /usr/local/lib?

The Student
  • 27,520
  • 68
  • 161
  • 264
Elektito
  • 3,863
  • 8
  • 42
  • 72
  • 5
    Did you configure it right? I mean `./configure --prefix=` ? Try `make clean ; make distclean; ./configure --prefix= && make && make install` – another.anon.coward Apr 23 '12 at 16:00
  • I did all of that, to no avail. I finally did something like `../gcc-4.7.0/configure --prefix=/root/build/usr/local/` to make it work. – Elektito Apr 23 '12 at 21:58
  • You definitely don't have to install glib only in /usr/local/lib; this is due to some libtool or automake weirdness, perhaps stale intermediate files lying around in the tree. I would try untarring a fresh source package and starting from scratch. – gcbenison Apr 26 '12 at 05:46
  • That was a fresh source tree, right out of the tar archive. It doesn't say it has to be /usr/local/lib, it says it has to end with that, which is still weird. – Elektito Apr 26 '12 at 07:09

3 Answers3

72

I also just stumbled over that problem when compiling MonetDB on my Linux machine. Here is the solution/workaround that worked for me: Always make clean after ./configure.

In your example you should be able to do:

./configure --prefix=/root/build && make clean && make && make install

I found the solution in a discussion on an apache httpd bug where Joe Orton shares his knowledge:

A "make clean" is usually necessary after re-running "configure".

Juve
  • 10,584
  • 14
  • 63
  • 90
  • 1
    I had this problem while compiling Gimp 2.9.2. `libtool: error: error: cannot install 'libgimpcolor-2.0.la' to a directory not ending in /usr/local/lib`. The answer works, but isn't there another method instead of running `make clean`. A full build takes ~15 minutes, just because one library seems to somehow hardcode the prefix ... – mxmlnkn Aug 31 '16 at 16:47
1

Using:

make clean 
make distclean 

Works for me.

Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
-1

The install path of a library can usually be customized rather than the default one under somewhere /usr/local/.

For some libraries, you should specify it with ./configure like this:

./configure --prefix=/the/new/install/path
make
make install

Others allow you to specify it when make install:

./configure
make
make install prefix=/the/new/install/path

You can try both. At least one should resolve your issue.

z0gSh1u
  • 355
  • 3
  • 6