<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - duplicate symbol error when using llvm-ar and llvm-ranlib to build bash 5"
href="https://bugs.llvm.org/show_bug.cgi?id=45838">45838</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>duplicate symbol error when using llvm-ar and llvm-ranlib to build bash 5
</td>
</tr>
<tr>
<th>Product</th>
<td>tools
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>llvm-ar
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>zapster@zapster.cc
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>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
<a href="http://ftpmirror.gnu.org/bash/bash-5.0.tar.gz">http://ftpmirror.gnu.org/bash/bash-5.0.tar.gz</a>) 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:
<a href="https://github.com/oracle/graal/issues/2300">https://github.com/oracle/graal/issues/2300</a>
<a href="https://github.com/oracle/graal/issues/2300">https://github.com/oracle/graal/issues/2300</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>