llvm-gcc linux build broken

Anyone else seeing this?

LLVM/gcc-4.2.llvm-objects/./gcc/xgcc -BLLVM/gcc-4.2.llvm-objects/./gcc/ -B/usr/local/gnat-llvm/x86_64-unknown-linux-gnu/bin/ -B/usr/local/gnat-llvm/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/gnat-llvm/x86_64-unknown-linux-gnu/include -isystem /usr/local/gnat-llvm/x86_64-unknown-linux-gnu/sys-include -c -DHAVE_CONFIG_H -O2 -g -O2 -I. -I../../../gcc-4.2.llvm/libiberty/../include -W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes -Wc++-compat ../../../gcc-4.2.llvm/libiberty/cplus-dem.c -o cplus-dem.o
../../../gcc-4.2.llvm/libiberty/cplus-dem.c:55: warning: function declaration isn’t a prototype
../../../gcc-4.2.llvm/libiberty/cplus-dem.c:55: error: conflicting types for ‘malloc’

It builds here (Linux x86_64), I use the following configure line:
../llvm-gcc4.2/configure
--prefix=/home/edwin/llvm-svn/obj42/../install --program-prefix=llvm-
--enable-llvm=/home/edwin/llvm-svn/llvm/ --disable-multilib
--enable-checking=release --enable-languages=c,c++

What is yours?

Best regards,
--Edwin

It builds here (Linux x86_64), I use the following configure line:
../llvm-gcc4.2/configure
--prefix=/home/edwin/llvm-svn/obj42/../install --program-prefix=llvm-
--enable-llvm=/home/edwin/llvm-svn/llvm/ --disable-multilib
--enable-checking=release --enable-languages=c,c++

I'm using (x86-64 linux, gcc 4.3)

../gcc-4.2.llvm/configure --prefix=/usr/local/gnat-llvm --enable-languages=c,c++ --enable-checking --enable-llvm=$HOME/LLVM/llvm-objects --disable-shared --disable-bootstrap --disable-multilib

Ciao,

Duncan.

It builds here (Linux x86_64), I use the following configure line:
../llvm-gcc4.2/configure
--prefix=/home/edwin/llvm-svn/obj42/../install --program-prefix=llvm-
--enable-llvm=/home/edwin/llvm-svn/llvm/ --disable-multilib
--enable-checking=release --enable-languages=c,c++
    
I'm using (x86-64 linux, gcc 4.3)
  
Yep, same here: gcc version 4.3.2 (Debian 4.3.2-1)
../gcc-4.2.llvm/configure --prefix=/usr/local/gnat-llvm --enable-languages=c,c++ --enable-checking --enable-llvm=$HOME/LLVM/llvm-objects --disable-shared --disable-bootstrap --disable-multilib
  
With those flags it fails for me too:
/home/edwin/llvm-svn/objnew/./gcc/xgcc
-B/home/edwin/llvm-svn/objnew/./gcc/
-B/usr/local/gnat-llvm/x86_64-unknown-linux-gnu/bin/
-B/usr/local/gnat-llvm/x86_64-unknown-linux-gnu/lib/ -isystem
/usr/local/gnat-llvm/x86_64-unknown-linux-gnu/include -isystem
/usr/local/gnat-llvm/x86_64-unknown-linux-gnu/sys-include -c
-DHAVE_CONFIG_H -O2 -g -O2 -I.
-I../../../llvm-gcc4.2/libiberty/../include -W -Wall -pedantic
-Wwrite-strings -Wstrict-prototypes -Wc++-compat
../../../llvm-gcc4.2/libiberty/cplus-dem.c -o cplus-dem.o
../../../llvm-gcc4.2/libiberty/cplus-dem.c:55: warning: function
declaration isn’t a prototype
../../../llvm-gcc4.2/libiberty/cplus-dem.c:55: error: conflicting types
for ‘malloc’
../../../llvm-gcc4.2/libiberty/cplus-dem.c:56: warning: function
declaration isn’t a prototype
../../../llvm-gcc4.2/libiberty/cplus-dem.c: In function
‘code_for_qualifier’:
../../../llvm-gcc4.2/libiberty/cplus-dem.c:582: warning: implicit
declaration of function ‘abort’
../../../llvm-gcc4.2/libiberty/cplus-dem.c:582: warning: incompatible
implicit declaration of built-in function ‘abort’
../../../llvm-gcc4.2/libiberty/cplus-dem.c: In function ‘qualifier_string’:
../../../llvm-gcc4.2/libiberty/cplus-dem.c:622: warning: incompatible
implicit declaration of built-in function ‘abort’
../../../llvm-gcc4.2/libiberty/cplus-dem.c: In function ‘squangle_mop_up’:
../../../llvm-gcc4.2/libiberty/cplus-dem.c:1082: warning: implicit
declaration of function ‘free’
../../../llvm-gcc4.2/libiberty/cplus-dem.c: In function
‘demangle_qualified’:
../../../llvm-gcc4.2/libiberty/cplus-dem.c:3177: warning: implicit
declaration of function ‘atoi’
make[2]: *** [cplus-dem.o] Error 1
make[2]: Leaving directory
`/home/edwin/llvm-svn/objnew/x86_64-unknown-linux-gnu/libiberty'
make[1]: *** [all-target-libiberty] Error 2

I can't get it to not fail: even if I use the flags that
worked for you it fails for me... Maybe the difference
is in how llvm was built? I configured using only default
values, i.e. without passing any parameters to configure.

Ciao,

Duncan.

For llvm:
./configure --enable-targets=x86,cbe,cpp --enable-optimized

One thing I noticed is that sometimes the Debug directory was picked
from llvm while building llvm-gcc, which contained an out-of-date build.
I no longer have a Debug directory though.

I just tried to build in a clean object directory, and it failed with
same error message.

Perhaps some files remained from an old build, and didn't get removed on
a make clean?

This means that I don't have a working llvm-gcc with TOT either.

Best regards,
--Edwin

This means that I don't have a working llvm-gcc with TOT either.

I get the same thing on x86-32.

Ciao,

Duncan.

This means that I don't have a working llvm-gcc with TOT either.
    
I get the same thing on x86-32.

Ciao,

Duncan.
  
HAVE_STDLIB_H is not defined, which causes a 'char* malloc()' definition
in cplus-dem.c.

From config.log:

configure:8421: checking for stdlib.h
configure:8461: result: no

Did you open a bug for this?

--Edwin

Hello, Everyone

Did you open a bug for this?

I backed out few recent llvm-gcc commits and this effectively restored the build. See llvm-commits ML for full explanation of the problems (actually, there were 2).

  

This means that I don't have a working llvm-gcc with TOT either.
    

I get the same thing on x86-32.

Ciao,

Duncan.
  
HAVE_STDLIB_H is not defined, which causes a 'char* malloc()' definition
in cplus-dem.c.

From config.log:
configure:8421: checking for stdlib.h
configure:8461: result: no
  
This is caused by -Wformat-security, which is enabled by default
incorrectly:

configure:3691: checking for stdlib.h
configure:3704: /home/edwin/llvm-svn/objnew/./prev-gcc/xgcc
-B/home/edwin/llvm-svn/objnew/./prev-gcc/ -B/ho
me/edwin/llvm-svn/obj42/../install/x86_64-unknown-linux-gnu/bin/ -E
conftest.c
cc1: warning: -Wformat-security ignored without -Wformat
configure:3710: $? = 0
configure: failed program was:

/* confdefs.h. */

#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
/* end confdefs.h. */
#include <stdlib.h>

configure:3731: result: no

This was likely introduced by revision 55675

Here is a patch that works for me in a clean directory (it probably
needs an LLVM local marker), does it work for you?

Index: gcc/c.opt