32
votes

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?

2
Did you configure it right? I mean ./configure --prefix=<prefix_of_your_choice> ? Try make clean ; make distclean; ./configure --prefix=<prefix_of_your_choice> && make && make install - another.anon.coward
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
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
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

2 Answers

68
votes

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".

1
votes

Using:

make clean 
make distclean 

Works for me.