make install_utils puts things in /usr/usr

Rob Landley rob at landley.net
Tue Dec 9 20:38:52 UTC 2008


On Tuesday 09 December 2008 03:30:34 Bernhard Reutner-Fischer wrote:
> On Tue, Dec 09, 2008 at 02:43:44AM -0600, Rob Landley wrote:
> >If you look at utils/Makefile.in you'll see that despite prepending PREFIX
> > and RUNTIME_PREFIX, when you install_utils it prepends another "usr" to
> > the start of the path it installs to.
> >
> >So if you say "PREFIX=/usr/local RUNTIME_PREFIX=/" you wind up installing
> > in /usr/local/usr, which is weird.  If you say "PREFIX=/
> > RUNTIME_PREFIX=/usr" you wind up installing in /usr/usr/", which is also
> > weird.
> >
> >Does anybody know what's up with this?
>
> $(TARGET_DIR)/usr/bin/ldd: $(cross_compiler) $(TARGET_DIR)/lib/libc.so.0
>         $(MAKE) -C $(UCLIBC_DIR) \
>                 PREFIX=$(TARGET_DIR) \
> 		utils install_utils

The lower case string "cross_compiler" does not appear anywhere in the
uClibc source, so at a wild guess I'd say you cut and pasted a chunk of the
buildroot build that calls this functionality.  This doesn't address my issue,
it just shows that buildroot doesn't attempt to do what I'm trying to do.
(Are you implying that the fact buildroot doesn't try this means it's not
supported?)

At a guess, TARGET_DIR in buildroot is the root of the target filesystem,
a chroot equivalent of passing "PREFIX=/".  Most packages that use PREFIX
would then install under "/bin" and "/sbin".  If you passed in "PREFIX=/usr"
they would then install in "/usr/bin" and "/usr/sbin".  If you passed in
"PREFIX=/usr/local", they would install in "/usr/local/bin" and
"/usr/local/sbin".

What I was actually referring to is this bit, out of the uClibc sources:

utils_install: utils
    #$(Q)$(INSTALL) -D -m 755 $(utils_OUT)/readelf $(PREFIX)$(RUNTIME_PREFIX)usr/bin/readelf
ifeq ($(HAVE_SHARED),y)
    $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldd $(PREFIX)$(RUNTIME_PREFIX)usr/bin/ldd
    $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/ldconfig $(PREFIX)$(RUNTIME_PREFIX)sbin/ldconfig
endif
ifeq ($(UCLIBC_HAS_LOCALE),y)
    $(Q)$(INSTALL) -D -m 755 $(utils_OUT)/iconv $(PREFIX)$(RUNTIME_PREFIX)usr/bin/iconv
    $(Q)$(INSTALL) -m 755 $(utils_OUT)/locale $(PREFIX)$(RUNTIME_PREFIX)usr/bin/locale
endif

Note that if PREFIX=/usr/local and RUNTIME_PREFIX=/, the first line after
the dependencies will resolve to:
  install -D -m 75 utils/readelf /usr/local/usr/bin

And so it'll install in "/usr/local/usr/bin" which is not _sane_.
There is NO way to tell this install to install them into /usr/local/bin,
because it will insert "usr" right before "bin" no matter what.

This is not the way "PREFIX" works for any other source package out there,
and it calls into question what "RUNTIME_PREFIX" is _for_, exactly.

If the primary design criteria is to make buildroot happy, why not default
"RUNTIME_PREFIX=/usr" which should let the buildroot invocation remain
unchanged while allowing the rest of us the luxury of making PREFIX= work
like it does for other packages, so it is _possible_ to have install_utils
go into something like a Linux From Scratch /tools directory (where it
should be installed as /tools/bin, not /tools/usr/bin).

I can always cp the files myself, but that's just admitting the
install_utils target is uselessly brittle rather than fixing it.

Rob



More information about the uClibc mailing list