[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Potential bug in library search for libiconv in static build
From: |
gmail |
Subject: |
Potential bug in library search for libiconv in static build |
Date: |
Sun, 03 Apr 2011 15:01:48 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
Hello,
This is my first contact and mail with bash mailing list, to summarize
i'm a coder maintening a personnal home server using several GNU tools
since the late 90's.
I configure BASH-4.2.0 in a chroot jail (gcc 4.5.2/libc 2.13/binutils
2.21/make 3.82) with an athlon architecture on ext3 FS with
--enable-static-link --with-libiconv-prefix=/ and, as root, and notice
the configure script can't find the jail's static libiconv :
[root@pompomgalli] mkdir bash-4.2_static_build && cd
bash-4.2_static_build
[root@pompomgalli] ../bash-4.2_static/configure --prefix=/
--without-bash-malloc --with-curses --enable-static-link
--with-libiconv-prefix=/
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
Beginning configuration for bash-4.2-release for i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for strerror in -lcposix... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
....
checking for ld used by GCC... /bin/ld
checking if the linker (/bin/ld) is GNU ld... yes
checking for shared library run path origin... done
....
checking for __argz_count... yes
checking for __argz_stringify... yes
checking for __argz_next... yes
checking for __fsetlocking... yes
checking for iconv... no, consider installing GNU libiconv
checking for nl_langinfo and CODESET... yes
checking for LC_MESSAGES... yes
checking for bison... bison
checking version of bison... 2.4.3, ok
....
[root@pompomgalli]
I then check if the libiconv library was accessible :
[root@pompomgalli] # ls -ld /lib/libiconv.* /lib
drwxr-xr-x 13 root root 12288 Apr 3 12:14 /lib
-rw-r--r-- 1 root root 1233398 Apr 3 12:14 /lib/libiconv.a
-rw-r--r-- 1 root root 917 Apr 3 12:14 /lib/libiconv.la
lrwxrwxrwx 1 root root 17 Apr 3 12:14 /lib/libiconv.so ->
libiconv.so.2.5.0
lrwxrwxrwx 1 root root 17 Apr 3 12:14 /lib/libiconv.so.2 ->
libiconv.so.2.5.0
-rw-r--r-- 1 root root 1191794 Apr 3 12:14 /lib/libiconv.so.2.5.0
Apparently, the static libiconv.a should had been seen by the configure
script. I check then the config.log :
[root@pompomgalli] # less config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by bash configure 4.2-release, which was
generated by GNU Autoconf 2.63. Invocation command line was
$ ../bash-4.2_static/configure --prefix=/ --without-bash-malloc
--with-curses --enable-static-link --with-libiconv-prefix=/
## --------- ##
## Platform. ##
## --------- ##
hostname = pompomgalli
uname -m = i686
uname -r = 2.6.37.3-Zilog80
uname -s = Linux
uname -v = #15 Mon Mar 28 20:53:38 CEST 2011
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = i686
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: .
PATH: /bin
PATH: /sbin
PATH: /usr/bin
PATH: /usr/sbin
PATH: /usr/local/bin
PATH: /usr/local/sbin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2094: checking build system type
configure:2112: result: i686-pc-linux-gnu
configure:2134: checking host system type
configure:2149: result: i686-pc-linux-gnu
configure:2806: checking for gcc
configure:2833: result: gcc
configure:3065: checking for C compiler version
configure:3073: gcc --version >&5
gcc (GCC) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
configure:3077: $? = 0
configure:3084: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-linux-gnu/4.5.2/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.5.2/configure --enable-clocale=gnu
--enable-threads=posix --enable-__cxa_atexit
--enable-languages=c,c++,java --disable-libstdcxx-pch --prefix=/usr
Thread model: posix
gcc version 4.5.2 (GCC)
configure:3088: $? = 0
...
configure:9745: checking for iconv
configure:9777: gcc -o conftest -g -O2 -fomit-frame-pointer
-march=athlon -fexceptions -I//include -static conftest.c >&5
/tmp/cckzHpkj.o: In function `main':
/usr/src/bash-4.2_static_build/conftest.c:107: undefined reference
to `libiconv_open'
/usr/src/bash-4.2_static_build/conftest.c:108: undefined reference
to `libiconv'
/usr/src/bash-4.2_static_build/conftest.c:109: undefined reference
to `libiconv_close'
collect2: ld returned 1 exit status
configure:9784: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME "bash"
| #define PACKAGE_TARNAME "bash"
| #define PACKAGE_VERSION "4.2-release"
| #define PACKAGE_STRING "bash 4.2-release"
| #define PACKAGE_BUGREPORT "bug-bash@gnu.org"
| #define ALIAS 1
| #define PUSHD_AND_POPD 1
| #define RESTRICTED_SHELL 1
| #define PROCESS_SUBSTITUTION 1
| #define PROMPT_STRING_DECODE 1
| #define SELECT_COMMAND 1
| #define HELP_BUILTIN 1
| #define ARRAY_VARS 1
| #define DPAREN_ARITHMETIC 1
| #define BRACE_EXPANSION 1
| #define COMMAND_TIMING 1
| #define EXTENDED_GLOB 1
| #define EXTGLOB_DEFAULT 0
| #define COND_COMMAND 1
| #define COND_REGEXP 1
| #define COPROCESS_SUPPORT 1
| #define ARITH_FOR_COMMAND 1
| #define NETWORK_REDIRECTIONS 1
| #define PROGRAMMABLE_COMPLETION 1
| #define DEBUGGER 1
| #define CASEMOD_ATTRS 1
| #define CASEMOD_EXPANSIONS 1
| #define MEMSCRAMBLE 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define _FILE_OFFSET_BITS 64
| #define READLINE 1
| #define HISTORY 1
| #define BANG_HISTORY 1
| #define _GNU_SOURCE 1
| #define HAVE_STRINGIZE 1
| #define HAVE_LONG_DOUBLE_WIDER 1
| #define HAVE_LONG_DOUBLE 1
| #define PROTOTYPES 1
| #define __PROTOTYPES 1
| #define restrict __restrict
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE_STDLIB_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_GETPAGESIZE 1
| #define HAVE_MMAP 1
| #define INTDIV0_RAISES_SIGFPE 1
| #define HAVE_INTTYPES_H_WITH_UINTMAX 1
| #define HAVE_STDINT_H_WITH_UINTMAX 1
| #define HAVE_UNSIGNED_LONG_LONG 1
| #define HAVE_UINTMAX_T 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_ARGZ_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_LOCALE_H 1
| #define HAVE_NL_TYPES_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_FEOF_UNLOCKED 1
| #define HAVE_FGETS_UNLOCKED 1
| #define HAVE_GETC_UNLOCKED 1
| #define HAVE_GETCWD 1
| #define HAVE_GETEGID 1
| #define HAVE_GETEUID 1
| #define HAVE_GETGID 1
| #define HAVE_GETUID 1
| #define HAVE_MEMPCPY 1
| #define HAVE_MUNMAP 1
| #define HAVE_PUTENV 1
| #define HAVE_SETENV 1
| #define HAVE_SETLOCALE 1
| #define HAVE_LOCALECONV 1
| #define HAVE_STPCPY 1
| #define HAVE_STRCASECMP 1
| #define HAVE_STRDUP 1
| #define HAVE_STRTOUL 1
| #define HAVE_TSEARCH 1
| #define HAVE___ARGZ_COUNT 1
| #define HAVE___ARGZ_STRINGIFY 1
| #define HAVE___ARGZ_NEXT 1
| #define HAVE___FSETLOCKING 1
| /* end confdefs.h. */
| #include <stdlib.h>
| #include <iconv.h>
| int
| main ()
| {
| iconv_t cd = iconv_open("","");
| iconv(cd,NULL,NULL,NULL,NULL);
| iconv_close(cd);
| ;
| return 0;
| }
configure:9830: gcc -o conftest -g -O2 -fomit-frame-pointer
-march=athlon -fexceptions -I//include -static conftest.c
//lib/libiconv.so -Wl,-rpath -Wl,//lib >&5
/bin/ld: attempted static link of dynamic object `//lib/libiconv.so'
collect2: ld returned 1 exit status
configure:9837: $? = 1
configure: failed program was:
| /* confdefs.h. */
| #define PACKAGE_NAME "bash"
| #define PACKAGE_TARNAME "bash"
| #define PACKAGE_VERSION "4.2-release"
| #define PACKAGE_STRING "bash 4.2-release"
| #define PACKAGE_BUGREPORT "bug-bash@gnu.org"
| #define ALIAS 1
| #define PUSHD_AND_POPD 1
| #define RESTRICTED_SHELL 1
| #define PROCESS_SUBSTITUTION 1
| #define PROMPT_STRING_DECODE 1
| #define SELECT_COMMAND 1
| #define HELP_BUILTIN 1
| #define ARRAY_VARS 1
| #define DPAREN_ARITHMETIC 1
| #define BRACE_EXPANSION 1
| #define COMMAND_TIMING 1
| #define EXTENDED_GLOB 1
| #define EXTGLOB_DEFAULT 0
| #define COND_COMMAND 1
| #define COND_REGEXP 1
| #define COPROCESS_SUPPORT 1
| #define ARITH_FOR_COMMAND 1
| #define NETWORK_REDIRECTIONS 1
| #define PROGRAMMABLE_COMPLETION 1
| #define DEBUGGER 1
| #define CASEMOD_ATTRS 1
| #define CASEMOD_EXPANSIONS 1
| #define MEMSCRAMBLE 1
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define _FILE_OFFSET_BITS 64
| #define READLINE 1
| #define HISTORY 1
| #define BANG_HISTORY 1
| #define _GNU_SOURCE 1
| #define HAVE_STRINGIZE 1
| #define HAVE_LONG_DOUBLE_WIDER 1
| #define HAVE_LONG_DOUBLE 1
| #define PROTOTYPES 1
| #define __PROTOTYPES 1
| #define restrict __restrict
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE_STDLIB_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_GETPAGESIZE 1
| #define HAVE_MMAP 1
| #define INTDIV0_RAISES_SIGFPE 1
| #define HAVE_INTTYPES_H_WITH_UINTMAX 1
| #define HAVE_STDINT_H_WITH_UINTMAX 1
| #define HAVE_UNSIGNED_LONG_LONG 1
| #define HAVE_UINTMAX_T 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_ARGZ_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_LOCALE_H 1
| #define HAVE_NL_TYPES_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_FEOF_UNLOCKED 1
| #define HAVE_FGETS_UNLOCKED 1
| #define HAVE_GETC_UNLOCKED 1
| #define HAVE_GETCWD 1
| #define HAVE_GETEGID 1
| #define HAVE_GETEUID 1
| #define HAVE_GETGID 1
| #define HAVE_GETUID 1
| #define HAVE_MEMPCPY 1
| #define HAVE_MUNMAP 1
| #define HAVE_PUTENV 1
| #define HAVE_SETENV 1
| #define HAVE_SETLOCALE 1
| #define HAVE_LOCALECONV 1
| #define HAVE_STPCPY 1
| #define HAVE_STRCASECMP 1
| #define HAVE_STRDUP 1
| #define HAVE_STRTOUL 1
| #define HAVE_TSEARCH 1
| #define HAVE___ARGZ_COUNT 1
| #define HAVE___ARGZ_STRINGIFY 1
| #define HAVE___ARGZ_NEXT 1
| #define HAVE___FSETLOCKING 1
| /* end confdefs.h. */
| #include <stdlib.h>
| #include <iconv.h>
| int
| main ()
| {
| iconv_t cd = iconv_open("","");
| iconv(cd,NULL,NULL,NULL,NULL);
| iconv_close(cd);
| ;
| return 0;
| }
configure:9861: result: no, consider installing GNU libiconv
So, as you could see, the configure script try to build a static elf by
linking object output with a shared libiconv.so library.
Guessing that this behavior was not the script real goal, i then adapt
the configure script this way :
--- bash-4.2_static/configure.orig 2011-04-03 14:02:35.000000000 +0200
+++ bash-4.2_static/configure 2011-04-03 14:21:38.000000000 +0200
@@ -9128,7 +9128,7 @@
found_so=
found_a=
if test $use_additional = yes; then
- if test -n "$shlibext" && test -f
"$additional_libdir/lib$name.$shlibext"; then
+ if test -n "$shlibext" && test -f
"$additional_libdir/lib$name.$shlibext" && test $opt_static_link != yes;
then
found_dir="$additional_libdir"
found_so="$additional_libdir/lib$name.$shlibext"
if test -f "$additional_libdir/lib$name.la"; then
@@ -9158,7 +9158,7 @@
case "$x" in
-L*)
dir=`echo "X$x" | sed -e 's/^X-L//'`
- if test -n "$shlibext" && test -f
"$dir/lib$name.$shlibext"; then
+ if test -n "$shlibext" && test -f
"$dir/lib$name.$shlibext" && test $opt_static_link != yes; then
found_dir="$dir"
found_so="$dir/lib$name.$shlibext"
if test -f "$dir/lib$name.la"; then
That giving me the following result :
[root@pompomgalli] ../bash-4.2_static/configure --prefix=/
--without-bash-malloc --with-curses --enable-static-link
--with-libiconv-prefix=/
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
Beginning configuration for bash-4.2-release for i686-pc-linux-gnu
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for strerror in -lcposix... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
....
checking for __argz_count... yes
checking for __argz_stringify... yes
checking for __argz_next... yes
checking for __fsetlocking... yes
checking for iconv... yes
checking how to link with libiconv... //lib/libiconv.a
checking for iconv declaration...
extern size_t iconv (iconv_t cd, char * *inbuf, size_t
*inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for nl_langinfo and CODESET... yes
checking for LC_MESSAGES... yes
checking for bison... bison
checking version of bison... 2.4.3, ok
....
[root@pompomgalli] make
....
ls -l bash
-rwxr-xr-x 1 root root 6692431 Apr 3 14:28 bash
size bash
text data bss dec hex filename
1530581 20272 28436 1579289 181919 bash
[root@pompomgalli]
The issue was due to the fact that the configure script postulate that
the host could have a shared libiconv OR a static libiconv, then in fact
a host could have BOTH static and shared libiconv.
For information, the configure script needs other adaptations to produce
a functionnal STATIC bash elf with glibc 2.13 due to specific dlopen issue.
I have currently inhibit getaddrinfo, gethostbyname, getpwent, getpwam,
getpwuid, getservbyname, getservent use in configure script when STATIC
build is required and alter some sources to behave differently if in
static build.
This way i have actually a functionnal static bash 4.2 elf which passes
all the tests except the multybite printf2.sub test (return 195 and not
192, i'm currently investigating).
I can provide the related patchs, if you think it's worth it.
Regards, Cedric.
- Potential bug in library search for libiconv in static build,
gmail <=
- Re: Potential bug in library search for libiconv in static build, Chet Ramey, 2011/04/04
- Re: Potential bug in library search for libiconv in static build, gmail, 2011/04/04
- Re: Potential bug in library search for libiconv in static build, gmail, 2011/04/05
- Re: Potential bug in library search for libiconv in static build, Chet Ramey, 2011/04/05
- Unexpected behavior with TZ, gmail, 2011/04/05
- Re: Unexpected behavior with TZ, Chet Ramey, 2011/04/06
- Re: Unexpected behavior with TZ, gmail, 2011/04/07
- Re: Unexpected behavior with TZ, Marc Herbert, 2011/04/08
- Re: Unexpected behavior with TZ, Chet Ramey, 2011/04/08