Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 100138 - Darwin patch for app-shells/bash-3.0-r12
Summary: Darwin patch for app-shells/bash-3.0-r12
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All OS X
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 91895 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-07-24 10:32 UTC by Kito (RETIRED)
Modified: 2005-08-02 19:55 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
bash-3.0-r12.ebuild.patch (bash-3.0-r12.ebuild.patch,1.37 KB, patch)
2005-07-24 10:33 UTC, Kito (RETIRED)
Details | Diff
bash-3.0-r12.ebuild.patch (bash-3.0-r12.ebuild.patch,1017 bytes, patch)
2005-07-24 10:36 UTC, Kito (RETIRED)
Details | Diff
bash-3.0-r12.ebuild.patch for Darwin/OS X (bash-3.0-r12.ebuild.patch,642 bytes, patch)
2005-07-29 14:30 UTC, Kito (RETIRED)
Details | Diff
configure-force-static.patch (configure-force-static.patch,954 bytes, patch)
2005-07-30 23:53 UTC, SpanKY
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kito (RETIRED) gentoo-dev 2005-07-24 10:32:28 UTC
Need to force silly dyld to not link against system readline.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Kito (RETIRED) gentoo-dev 2005-07-24 10:33:21 UTC
Created attachment 64208 [details, diff]
bash-3.0-r12.ebuild.patch
Comment 2 Kito (RETIRED) gentoo-dev 2005-07-24 10:36:05 UTC
Created attachment 64209 [details, diff]
bash-3.0-r12.ebuild.patch
Comment 3 Kito (RETIRED) gentoo-dev 2005-07-24 12:36:02 UTC
*** Bug 91895 has been marked as a duplicate of this bug. ***
Comment 4 SpanKY gentoo-dev 2005-07-26 18:47:18 UTC
that patch doesnt make any sense ... the default configure uses
--without-installed-readline
Comment 5 SpanKY gentoo-dev 2005-07-29 12:40:57 UTC
well get back to us when you have some info which shows why this is needed
Comment 6 Kito (RETIRED) gentoo-dev 2005-07-29 14:30:02 UTC
Created attachment 64677 [details, diff]
bash-3.0-r12.ebuild.patch for Darwin/OS X

linker flag -search_paths_first allows static readline to be found before
system readline dynamic library
Comment 7 Kito (RETIRED) gentoo-dev 2005-07-29 14:31:57 UTC
Ok, older bash versions forced --with-installed-readline on Darwin and Macos. Seems to be fixed in this 
version. Still need to add the one-liner to make sure it doesn't link against the system readline however.
Comment 8 SpanKY gentoo-dev 2005-07-29 15:16:16 UTC
i'm not quite sure i understand ... can you post a log of running `emerge bash`
w/out the patch you've supplied here ?
Comment 9 Kito (RETIRED) gentoo-dev 2005-07-30 07:32:25 UTC
on a darwin machine: man ld dyld libtool

-search_paths_first
              By  default  when  the  -dynamic  flag is in effect, the -lx and
              -weak-lx  options  first  search  for  a  file   of   the   form
              `libx.dylib'  in each directory in the library search path, then
              a file of the form `libx.a'  is  searched  for  in  the  library
              search  paths.   This  option  changes  it  so that in each path
              `libx.dylib' is searched for then `libx.a' before the next  path
              in the library search path is searched.

Without this the linker will use /usr/lib/libreadline.dylib instead of libreadline.a in the bash builddir.

Without this patch on a vanilla OS X 10.4 system the build will fail  as a result of Tiger readline being a 
symlink to libedit, and without the -search_paths_first passed to the linker, it will find the symlink in /
usr before it finds the libreadline.a that bash builds:


          ***********************************************************
          *                                                         *
          * GNU bash, version 3.00.16(1)-release (powerpc-apple-darwin8)
          *                                                         *
          ***********************************************************

rm -f bash
gcc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde  -L./lib/sh -L./lib/termcap    -
O2 -pipe -mcpu=G4 -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 
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 -lsh -lreadline -lhistory ./lib/termcap/libtermcap.a -lglob -
ltilde    -ldl 
/usr/bin/ld: multiple definitions of symbol _tilde_expand
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(readline.o_s) definition of 
_tilde_expand
./lib/tilde/libtilde.a(tilde.o) definition of _tilde_expand in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _get_history_event
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(readline.o_s) definition of 
_get_history_event
./lib/readline/libhistory.a(histexpand.o) definition of _get_history_event in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _history_arg_extract
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(readline.o_s) definition of 
_history_arg_extract
./lib/readline/libhistory.a(histexpand.o) definition of _history_arg_extract in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _history_expand
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(readline.o_s) definition of 
_history_expand
./lib/readline/libhistory.a(histexpand.o) definition of _history_expand in section (__TEXT,__text)
/usr/bin/ld: multiple definitions of symbol _history_expansion_char
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(readline.o_s) definition of 
_history_expansion_char

Without this patch on a OS X 10.4 system with a proper libreadline, it should build but it will be linked 
against system readline.

gcc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde  -L./lib/sh -L./lib/termcap    -
O2 -pipe -mcpu=G4 -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 
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 -lsh -lreadline -lhistory ./lib/termcap/libtermcap.a -lglob -
ltilde    -ldl 

/usr/bin/ld: warning multiple definitions of symbol _sh_get_env_value
variables.o definition of _sh_get_env_value in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(shell.so) definition of 
_sh_get_env_value
/usr/bin/ld: warning multiple definitions of symbol _sh_get_home_dir
variables.o definition of _sh_get_home_dir in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(shell.so) definition of 
_sh_get_home_dir
/usr/bin/ld: warning multiple definitions of symbol _sh_unset_nodelay_mode
general.o definition of _sh_unset_nodelay_mode in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(shell.so) definition of 
_sh_unset_nodelay_mode

***snip***

As you can see, even though its passing  -L./lib/readline (twice infact, awesome) its using 
/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../libreadline.dylib(shell.so)
Comment 10 SpanKY gentoo-dev 2005-07-30 18:33:05 UTC
yeah, that's what i wanted to double check

imo your linker is broken ... this kind of behavior breaks more than just bash
and i dont think i really want to patch every package for it ...

when you speficy -L on the command line, those paths should always be searched
first before system paths
Comment 11 Kito (RETIRED) gentoo-dev 2005-07-30 20:16:08 UTC
This only applies when dealing with static archives, and FWIW this is the only base-system package in the 
tree I've found where this is an issue. I guess adding it to our default CFLAGS is an option, but to do that 
for one ebuild, and then turn around and filter that flag out when we build all the darwin system packages
(that linker flag will prevent the majority of them from linking correctly) doesn't seem like a good idea... I 
dunno, I'm open for suggestions, but I need bash :(
Comment 12 Kito (RETIRED) gentoo-dev 2005-07-30 20:22:58 UTC
just to make sure we are on the same page, the paths that are searched aren't  the issue, the issue is the 
linker looks for shared libs in each directory in the path first, and if not found, the search starts again but 
this time for .a static libs.

Can you point me to some other packages where you think this same breakage will occur? I don't doubt 
they exist, I just haven't run across it anywhere else but bash/readline...I guess any other packages that 
ship with an included readline would have this same problem...
Comment 13 SpanKY gentoo-dev 2005-07-30 23:53:36 UTC
Created attachment 64771 [details, diff]
configure-force-static.patch

try this patch
Comment 14 Kito (RETIRED) gentoo-dev 2005-07-31 09:30:24 UTC
Works perfectly. I didn't think of just specifying the .a files directly...i guess this is why you make the big 
bucks and have the cushy corner office at the Gentoo compound. 
Comment 15 SpanKY gentoo-dev 2005-08-02 19:55:25 UTC
e-mailed change upstream and added to bash-3.0-r12