[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#395177: libc6: default library search path is inconsistent with gcc



Package: libc6
Version: 2.3.6.ds1-7
Severity: normal

(Not sure if this is a bug in libc6 or binutils or another package;
I first thought it was a bug in gcc, but a gcc developer said no:
<http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29588>.)

gcc has /usr/local/include in its default search path, i.e. without
setting any special environment variable. Therefore, in order to be
consistent, the linker should have /usr/local/lib is its search path
too, *by default*.

Here's a way to reproduce the problem (just an example):

  0. Make sure you have default *PATH settings (i.e. no C_INCLUDE_PATH,
     no LIBRARY_PATH, no LD_LIBRARY_PATH set to some value).

  1. Install the official GMP packages, so that one has GMP 4.2.1
     files installed in /usr/include and /usr/lib directories.

  2. Download GMP 4.2.1 and replace the __GNU_MP_VERSION_PATCHLEVEL
     value, e.g. by 17.

  3. Build and install GMP 4.2.17 with configure, make, make install
     (install-nodist_includeexecHEADERS and install-libLTLIBRARIES
     are sufficient).

  4. Compile the following program with either:

       gcc -Wall gmpversion.c -o gmpversion -lgmp

or

       gcc -Wall -static gmpversion.c -o gmpversion -lgmp

#include <stdio.h>
#include <gmp.h>
int main (void)
{
  printf ("GMP .....  Library: %-6s -  Header: %d.%d.%d\n",
          gmp_version, __GNU_MP_VERSION, __GNU_MP_VERSION_MINOR,
          __GNU_MP_VERSION_PATCHLEVEL);
  return 0;
}

  5. Run it. You should get:

GMP .....  Library: 4.2.1  -  Header: 4.2.17

This is an incorrect behavior. With default settings, one should get
the same header and library versions (whether this is 4.2.1 or 4.2.17,
I don't care, this is just a policy matter).

A solution could be: add /usr/local/lib to /etc/ld.so.conf by default.

I've not tried, though. I hope this fixes the behavior with libtool
too. But I don't know about the -static option (perhaps a bug in ld,
thus in the binutils package?).

Note: because of this problem, we get bug reports for our software
because of inconsistent header and library versions. This is a problem
with GMP in particular as GMP 4.1.4 (from Debian/stable) and GMP 4.2.1
are incompatible.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-1-686-bigmem
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1)

Versions of packages libc6 depends on:
ii  tzdata                        2006n-1    Time Zone and Daylight Saving Time

libc6 recommends no packages.

-- no debconf information



Reply to: