xiw/stack

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated

denji opened this issue · 2 comments

configure:7942: result: clang++
configure:7962: clang++  -I/usr/include/c++/4.2.1 -I/usr/local/Cellar/llvm/3.4/include  conftest.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
conftest.c:16:8: error: unknown type name 'Syntax'
                     Syntax error
                     ^
conftest.c:16:20: error: expected ';' after top level declarator
                     Syntax error
                                 ^
                                 ;
2 errors generated.
configure:7962: $? = 1

configure: error: C preprocessor "clang++" fails sanity check
See `config.log' for more details
make: *** No targets specified and no makefile found.  Stop.

build script

#!/bin/sh

export CC=clang
export CXX=clang++
export CPP=clang++
export CPPFLAGS+=" -I/usr/include/c++/4.2.1 -I/usr/local/Cellar/llvm/3.4/include "
export CXXFLAGS+=" -I/usr/include/c++/4.2.1 -I/usr/local/Cellar/llvm/3.4/include "
export CFLAGS+=" -I/usr/local/Cellar/llvm/3.4/include "
export LDFLAGS+=" -L/usr/local/Cellar/llvm/3.4/lib -L/usr/lib "

echo 
echo "CFLAGS = $CFLAGS"
echo "LDFLAGS = $LDFLAGS"
echo "CPPFLAGS/CXXFLAGS = $CXXFLAGS"
echo 

cd ~/Desktop/stack

autoreconf -fvi
./configure --disable-dependency-tracking --enable-silent-rules
make
xiw commented

Looks like the problem is export CPP=clang++ in your build script.

@xiw Maybe you should make a listing of all parameters of the Directive llvm-config everything is setup the compiler environment?

LLVM_CFG="llvm-config-3.5"

export CC="`$LLVM_CFG --bindir`/clang"
export CXX="`$LLVM_CFG --bindir`/clang++"
export CPP="`$LLVM_CFG --bindir`/clang++"
export CPPFLAGS+=" -I`$LLVM_CFG --includedir` -I/usr/include/c++/4.2.1 "
export CXXFLAGS+=" -I`$LLVM_CFG --includedir` -I/usr/include/c++/4.2.1 "
export CFLAGS+=" -I`$LLVM_CFG --includedir` "
export LDFLAGS+=" -L`$LLVM_CFG --libdir` -L/usr/lib "
usage: llvm-config <OPTION>... [<COMPONENT>...]

Get various configuration information needed to compile programs which use
LLVM.  Typically called from 'configure' scripts.  Examples:
  llvm-config --cxxflags
  llvm-config --ldflags
  llvm-config --libs engine bcreader scalaropts

Options:
  --version         Print LLVM version.
  --prefix          Print the installation prefix.
  --src-root        Print the source root LLVM was built from.
  --obj-root        Print the object root used to build LLVM.
  --bindir          Directory containing LLVM executables.
  --includedir      Directory containing LLVM headers.
  --libdir          Directory containing LLVM libraries.
  --cppflags        C preprocessor flags for files that include LLVM headers.
  --cflags          C compiler flags for files that include LLVM headers.
  --cxxflags        C++ compiler flags for files that include LLVM headers.
  --ldflags         Print Linker flags.
  --system-libs     System Libraries needed to link against LLVM components.
  --libs            Libraries needed to link against LLVM components.
  --libnames        Bare library names for in-tree builds.
  --libfiles        Fully qualified library filenames for makefile depends.
  --components      List of all possible components.
  --targets-built   List of all targets currently built.
  --host-target     Target triple used to configure LLVM.
  --build-mode      Print build mode of LLVM tree (e.g. Debug or Release).
  --assertion-mode  Print assertion mode of LLVM tree (ON or OFF).
Typical components:
  all               All LLVM libraries (default).
  engine            Either a native JIT or a bitcode interpreter.