Need to force silly dyld to not link against system readline. Reproducible: Always Steps to Reproduce: 1. 2. 3.
Created attachment 64208 [details, diff] bash-3.0-r12.ebuild.patch
Created attachment 64209 [details, diff] bash-3.0-r12.ebuild.patch
*** Bug 91895 has been marked as a duplicate of this bug. ***
that patch doesnt make any sense ... the default configure uses --without-installed-readline
well get back to us when you have some info which shows why this is needed
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
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.
i'm not quite sure i understand ... can you post a log of running `emerge bash` w/out the patch you've supplied here ?
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)
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
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 :(
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...
Created attachment 64771 [details, diff] configure-force-static.patch try this patch
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.
e-mailed change upstream and added to bash-3.0-r12