<html>
<head>
<base href="http://llvm.org/bugs/" />
</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 --- - clang and gold plugin of 3.2 cannot generate bc file for MySQL"
href="http://llvm.org/bugs/show_bug.cgi?id=15206">15206</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang and gold plugin of 3.2 cannot generate bc file for MySQL
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stdstack@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Using the recent 3.2 clang and gold plugin, I failed to compile MySQL with lto
to generate bc files, where 3.0 version has no problems.
Tested MySQL version:
=====================
* 5.1.67, 5.1.50
Tested OS versions:
===================
* Ubuntu 11.04 with tool chain gcc 4.5.2, binutils 2.23 with gold plugin
enabled
* CentOS 6.3 with tool chain gcc 4.4.6, binutils 2.23 with gold plugin
enabled
Steps to reproduce:
===================
0. Setup gold plugin:
* /home/ryan/software/binutils/build/2.23 is where the binutils are installed
* /home/ryan/software/llvm/build/3.2 is where LLVM is installed
* cd /home/ryan/software/binutils/build/2.23/bin
* cp ld ld.default
* cp ld.gold ld
* cd ../lib
* mkdir bfd-plugins
* cd bfd-plugins
* ln -s /home/ryan/software/llvm/build/3.2/lib/LLVMgold.so
* Put /home/ryan/software/binutils/build/2.23/bin in PATH
1. Setup ENV:
export CC="clang -use-gold-plugin -flto"
export CXX="clang++ -use-gold-plugin -flto"
export CFLAGS="-g -O0"
export CXXFLAGS="-g -O0"
export RANLIB=/bin/true
1.1 Additional setup for 3.2
export AR="clang-ar"
export NM="nm --plugin
/home/ryan/software/llvm/build/3.2/lib/LLVMgold.so"
where `clang-ar` is a wrapper put in
/home/ryan/software/binutils/build/2.23/bin/
Its content:
#!/bin/sh
firstarg=${1}
shift
exec /home/ryan/software/binutils/build/2.23/bin/ar "${firstarg}"
--plugin /home/ryan/software/llvm/build/3.2/lib/LLVMgold.so "${@}"
2. Compile MySQL
* Modify the Makefile.am and Makefile.in in the unpacked mysql source, say
mysql-5.1.67: remove/comment the block in `do_abi_check` at line 312.
* ./configure
* make -j4
Expected result:
===================
In 3.0 versions, there's no compilation error and after the compilation is
finished, there're bc files generated.
In 3.2 version, there's error as attached in the end.
>From MySQL's document
<a href="http://dev.mysql.com/doc/refman/5.1/en/compilation-problems.html">http://dev.mysql.com/doc/refman/5.1/en/compilation-problems.html</a>
It seems like `configure` script is misbehaving, but I guess this might relate
to some changes in clang.
<span class="quote">> "By default, the configure script attempts to determine the correct number of arguments by using g++ (the GNU C++ compiler). This test yields incorrect results if g++ is not installed..."</span >
Error Messages:
===============
libtool: compile: clang -use-gold-plugin -flto
-DDEFAULT_CHARSET_HOME=\"/usr/local\" -DMYSQL_DATADIR=\"/usr/local/var\"
-DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX
-DDEFAULT_SYSCONFDIR=\"/usr/local/etc\" -DSHAREDIR=\"/usr/local/share/mysql\"
-DMYSQL_CLIENT_NO_THREADS -DDONT_USE_RAID -I. -I../include -I../include
-I../include -g -O0 -DUNIV_LINUX -DUNIV_LINUX -MT password.lo -MD -MP -MF
.deps/password.Tpo -c password.c -o password.o >/dev/null 2>&1
manager.c:132:10: error: too few arguments to function call, expected 6, have 5
hp = my_gethostbyname_r(host,&tmp_hostent,buff2,sizeof(buff2),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/my_net.h:113:74: note: expanded from macro 'my_gethostbyname_r'
#define my_gethostbyname_r(A,B,C,D,E) gethostbyname_r((A),(B),(C),(D),(E))
~~~~~~~~~~~~~~~ ^
/usr/include/netdb.h:180:1: note: 'gethostbyname_r' declared here
extern int gethostbyname_r (__const char *__restrict __name,
^
1 error generated.
make[2]: *** [manager.lo] Error 1
make[2]: *** Waiting for unfinished jobs....</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>