[Top][All Lists]

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

Re: Link failure: multiple definition of getenv

From: Chet Ramey
Subject: Re: Link failure: multiple definition of getenv
Date: Sun, 11 Mar 2012 14:59:26 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

On 3/11/12 9:38 AM, Matthew Farkas-Dyck wrote:
> Hello.
> I am trying to build bash against uClibc. Build fails thus:
> $ make
> ...
> x86_64-linux-gcc -L./builtins -L./lib/readline -L./lib/readline
> -L./lib/glob -L./lib/tilde -L./lib/malloc -L./lib/sh  -rdynamic  -g
> -O2 -o bash shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o
> dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o
> flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o
> unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o
> arrayfunc.o assoc.o braces.o bracecomp.o bashhist.o bashline.o  list.o
> stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o
> xmalloc.o  -lbuiltins -lglob -lsh -lreadline -lhistory -lcurses
> -ltilde -lmalloc lib/intl/libintl.a
> /home/strake/buildroot-2011.11/output/host/usr/x86_64-unknown-linux-uclibc/sysroot/usr/lib/libc.a(getenv.os):
> In function `getenv':
> getenv.c:(.text+0x0): multiple definition of `getenv'
> ./lib/sh/libsh.a(getenv.o):/home/strake/bash-4.1/lib/sh/getenv.c:52:
> first defined here
> collect2: ld returned 1 exit status
> make: *** [bash] Error 1
> $
> It fails thus, whether built within or without buildroot.
> uClibc configuration here: http://hpaste.org/64419
> Linkage against glibc works.
> I searched, but the query "bash getenv" or the like yields much about,
> well, bash getenv, rather than the c function.
> How can I link it?

Bash wants to use its own version of getenv so library functions that use
it can look in the shell's variable table instead of the export
environment.  To that end, configure runs a test to see whether or not
getenv() can be redefined.  You probably configured bash against glibc,
for which the test succeeds.

You can either re-run configure and make sure it's using uclibc, look at
config.log to figure out why the getenv replacement test succeeded if
you're already doing that, or force the issue by editing config.cache to
set the value of `bash_cv_getenv_redef' to 0 and rerun `configure -C'.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]