[llvm-bugs] [Bug 45838] New: duplicate symbol error when using llvm-ar and llvm-ranlib to build bash 5

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 8 00:38:48 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45838

            Bug ID: 45838
           Summary: duplicate symbol error when using llvm-ar and
                    llvm-ranlib to build bash 5
           Product: tools
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: llvm-ar
          Assignee: unassignedbugs at nondot.org
          Reporter: zapster at zapster.cc
                CC: llvm-bugs at lists.llvm.org

Building bash 5 on MacOS using llvm-ar and llvm-ranlib fails with "duplicate
symbol" error.
To reproduce the error, get the bash 5 source code (e.g. from here
http://ftpmirror.gnu.org/bash/bash-5.0.tar.gz) and build it using llvm-ar
llvm-ranlib:

tar -xf bash-5.0.tar.gz
mkdir bash-5.0/_build
cd bash-5.0/_build
AR=/path/to/llvm_build/bin/llvm-ar RANLIB=/path/to/llvm_build/bin/llvm-ranlib
../configure
make -j

This will result in an error similar to the following:

gcc -L./builtins -L./lib/readline -L./lib/readline -L./lib/glob -L./lib/tilde 
-L./lib/sh  -Wl,-why_load  -g -O2 -Wno-parentheses -Wno-format-security   -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 -ltermcap -ltilde  lib/intl/libintl.a -liconv -liconv  -ldl
duplicate symbol _copy_history_entry in:
    ./lib/readline/libreadline.a(history.o)
    ./lib/readline/libhistory.a(history.o)
duplicate symbol _free_history_entry in:
    ./lib/readline/libreadline.a(history.o)
    ./lib/readline/libhistory.a(history.o)
duplicate symbol _replace_history_entry in:
    ./lib/readline/libreadline.a(history.o)
    ./lib/readline/libhistory.a(history.o)
...
ld: 38 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bash] Error 1


Mac Os verion:

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.14.6
BuildVersion:   18G103


I've tried this with various llvm version (9.0.0, 10.0.0 and master). Also,
when switching one of the tools (llvm-ar or llvm-ranlib) to the system tool the
error is gone. The compiler does not matter (tried gcc 8 and various clang
versions).

This file was originally filed against the GraalVM LLVM Runtime toolchain,
which uses the llvm binutils:
https://github.com/oracle/graal/issues/2300



https://github.com/oracle/graal/issues/2300

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200508/f3bccaaf/attachment.html>


More information about the llvm-bugs mailing list