[LLVMbugs] [Bug 15206] New: clang and gold plugin of 3.2 cannot generate bc file for MySQL

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 7 16:06:34 PST 2013


            Bug ID: 15206
           Summary: clang and gold plugin of 3.2 cannot generate bc file
                    for MySQL
           Product: clang
           Version: 3.2
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stdstack at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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
  * CentOS 6.3 with tool chain gcc 4.4.6, binutils 2.23 with gold plugin 

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

      where `clang-ar` is a wrapper put in   

      Its content:
      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

It seems like `configure` script is misbehaving, but I guess this might relate
to some changes in clang.

> "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..."

Error Messages:

libtool: compile:  clang -use-gold-plugin -flto
-DDEFAULT_CHARSET_HOME=\"/usr/local\" -DMYSQL_DATADIR=\"/usr/local/var\"
-DDEFAULT_SYSCONFDIR=\"/usr/local/etc\" -DSHAREDIR=\"/usr/local/share/mysql\"
-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....

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/20130208/225eb72e/attachment.html>

More information about the llvm-bugs mailing list