Building clang with MingW and MSYS

I am trying to build clang with MingW and MSYS. I have followed the instructions on the Clang "Getting Started" page. When I execute:

../llvm/configure

I receive:

$ ../llvm/configure
configure: error: Already configured in ../llvm

Huh ?

There are no files in the 'build' directory except for a config.log which says:

"This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by llvm configure 3.0svn, which was
generated by GNU Autoconf 2.60. Invocation command line was

   $ ../llvm/configure

## --------- ##
## Platform. ##
## --------- ##

hostname = k9a2-vista64
uname -m = i686
uname -r = 1.0.16(0.48/3/2)
uname -s = MINGW32_NT-6.0
uname -v = 2010-09-29 00:07

/usr/bin/uname -p = unknown
/bin/uname -X = unknown

/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown

PATH: .
PATH: /usr/local/bin
PATH: /mingw/bin
PATH: /bin
PATH: /c/Program Files/Common Files/Microsoft Shared/Windows Live
PATH: /c/Program Files (x86)/Common Files/Microsoft Shared/Windows Live
PATH: /c/Program Files (x86)/PC Connectivity Solution/
PATH: /c/Windows/system32
PATH: /c/Windows
PATH: /c/Windows/System32/Wbem
PATH: /c/Perl64/site/bin
PATH: /c/Perl64/bin
PATH: /c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static
PATH: /c/Windows/System32/WindowsPowerShell/v1.0/
PATH: /c/Program Files (x86)/Microsoft SQL Server/90/Tools/binn/
PATH: /c/Program Files/TortoiseSVN/bin
PATH: /c/Program Files (x86)/Common Files/HP/Digital Imaging/bin
PATH: /c/Program Files (x86)/doxygen/bin
PATH: /c/Program Files (x86)/jEdit
PATH: /c/Program Files (x86)/PKWARE/pkzipc
PATH: /c/PROGRA~1/IBM/SQLLIB/BIN
PATH: /c/PROGRA~1/IBM/SQLLIB/FUNCTION
PATH: /c/PROGRA~1/IBM/SQLLIB/SAMPLES/REPL
PATH: /c/Program Files (x86)/Git/cmd
PATH: /c/Program Files (x86)/Common Files/Acronis/SnapAPI/
PATH: /c/Program Files/Windows Imaging/
PATH: /c/Program Files (x86)/Graphviz2.26.3/bin
PATH: /c/Program Files (x86)/QuickTime Alternative/QTSystem
PATH: /c/Program Files (x86)/Windows Live/Shared
PATH: /c/Program Files/SlikSvn/bin/
PATH: /c/Program Files/TortoiseGit/bin
PATH: /c/Programming/bin
PATH: /c/Utilities/Comeau/V43101/bin
PATH: /c/Program Files (x86)/Gallio/bin
PATH: /c/Utilities/Scala/Version28/bin
PATH: /c/Utilities/Python26
PATH: /c/Utilities/Python26/Scripts
PATH: /mingw/bin
PATH: /c/Utilities/dm/bin
PATH: /c/Program Files (x86)/CMake 2.8/bin
PATH: /c/Programming/VersionControl/LLVM/llvm/bin/Debug
PATH: /c/Utilities/GnuWin32/GetGnuWin32/gnuwin32/bin
PATH: /c/Utilities/odb-1.0.0-i686-windows/bin
PATH: /c/Program Files (x86)/CVSNT/
PATH: /c/Programming/VersionControl/LLVM/llvm/bin/Debug

## ----------- ##
## Core tests. ##
## ----------- ##

configure:1966: error: Already configured in ../llvm

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=

## ----------------- ##
## Output variables. ##
## ----------------- ##

ALL_BINDINGS=''
AR=''
ARCH=''
BINDINGS_TO_BUILD=''
BINPWD=''
BINUTILS_INCDIR=''
BUILD_CC=''
BUILD_CXX=''
BUILD_EXEEXT=''
BZIP2=''
CAT=''
CC=''
CFLAGS=''
CIRCO=''
CLANGPATH=''
CLANGXXPATH=''
CMP=''
CONVENIENCE_LTDL_FALSE=''
CONVENIENCE_LTDL_TRUE=''
CP=''
CPP=''
CPPFLAGS=''
CVSBUILD=''
CXX=''
CXXFLAGS=''
DATE=''
DEBUG_RUNTIME=''
DEBUG_SYMBOLS=''
DEFS=''
DISABLE_ASSERTIONS=''
DOT=''
DOTTY=''
DOXYGEN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ENABLE_BUILT_CLANG=''
ENABLE_CBE_PRINTF_A=''
ENABLE_DOCS=''
ENABLE_DOXYGEN=''
ENABLE_EMBED_STDCXX=''
ENABLE_EXPENSIVE_CHECKS=''
ENABLE_OPTIMIZED=''
ENABLE_PIC=''
ENABLE_POLLY=''
ENABLE_PROFILING=''
ENABLE_PTHREADS=''
ENABLE_SHARED=''
ENABLE_THREADS=''
ENABLE_TIMESTAMPS=''
ENABLE_VISIBILITY_INLINES_HIDDEN=''
ENDIAN=''
EXEEXT=''
EXPENSIVE_CHECKS=''
EXTRA_OPTIONS=''
FDP=''
FIND=''
GAS=''
GRAPHVIZ=''
GREP=''
GROFF=''
GV=''
GZIPBIN=''
HAVE_LINK_VERSION_SCRIPT=''
HAVE_PERL=''
HAVE_PTHREAD=''
HOST_OS=''
HUGE_VAL_SANITY=''
INSTALL_DATA=''
INSTALL_LTDL_FALSE=''
INSTALL_LTDL_TRUE=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
JIT=''
LDFLAGS=''
LIBADD_DL=''
LIBOBJS=''
LIBS=''
LINKALL=''
LLVMCC1=''
LLVMCC1PLUS=''
LLVMCC_DISABLEOPT_FLAGS=''
LLVMCC_EMITIR_FLAG=''
LLVMCC_OPTION=''
LLVMGCC=''
LLVMGCCCOMMAND=''
LLVMGCCDIR=''
LLVMGCC_DRAGONEGG=''
LLVMGCC_LANGS=''
LLVMGXX=''
LLVMGXXCOMMAND=''
LLVM_BINDIR=''
LLVM_CONFIGTIME=''
LLVM_COPYRIGHT='Copyright (c) 2003-2010 University of Illinois at Urbana-Champaign.'
LLVM_CROSS_COMPILING=''
LLVM_DATADIR=''
LLVM_DOCSDIR=''
LLVM_ENUM_ASM_PARSERS=''
LLVM_ENUM_ASM_PRINTERS=''
LLVM_ENUM_DISASSEMBLERS=''
LLVM_ENUM_TARGETS=''
LLVM_ETCDIR=''
LLVM_HAS_POLLY=''
LLVM_INCLUDEDIR=''
LLVM_INFODIR=''
LLVM_LIBDIR=''
LLVM_MANDIR=''
LLVM_ON_UNIX=''
LLVM_ON_WIN32=''
LLVM_PREFIX=''
LN_S=''
LTLIBOBJS=''
MKDIR=''
MMAP_FILE=''
MV=''
NEATO=''
NM=''
NOLINKALL=''
NO_MISSING_FIELD_INITIALIZERS=''
NO_VARIADIC_MACROS=''
OBJEXT=''
OCAMLC=''
OCAMLDEP=''
OCAMLDOC=''
OCAMLOPT=''
OCAML_LIBDIR=''
OPTIMIZE_OPTION=''
OS='Windows_NT'
PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu'
PACKAGE_NAME='llvm'
PACKAGE_STRING='llvm 3.0svn'
PACKAGE_TARNAME='-llvm-'
PACKAGE_VERSION='3.0svn'
PATH_SEPARATOR=':'
PDFROFF=''
PERL=''
POD2HTML=''
POD2MAN=''
RANLIB=''
RDYNAMIC=''
RM=''
RPATH=''
RUNTEST=''
SED=''
SHELL='/bin/sh'
SHLIBEXT=''
SHLIBPATH_VAR=''
TAR=''
TARGETS_TO_BUILD=''
TARGET_HAS_JIT=''
TARGET_OS=''
TCLSH=''
TWOPI=''
USE_OPROFILE=''
USE_UDIS86=''
XDOT_PY=''
ZIP=''
ac_ct_CC=''
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
ifGNUmake=''
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
subdirs=''
sysconfdir='${prefix}/etc'
target=''
target_alias=''
target_cpu=''
target_os=''
target_vendor=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define PACKAGE_NAME "llvm"
#define PACKAGE_TARNAME "-llvm-"
#define PACKAGE_VERSION "3.0svn"
#define PACKAGE_STRING "llvm 3.0svn"
#define PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu"

configure: exit 1"

Hi,
Have you previously built in the src directory? I believe I saw this error before when there are configure files like config.log in the src directory and you try to build in another directory without cleaning out the configure files in src.

–John

Edward Diener <eldlistmailingz@tropicsoft.com>
writes:

I am trying to build clang with MingW and MSYS. I have followed the
instructions on the Clang "Getting Started" page. When I execute:

../llvm/configure

I receive:

$ ../llvm/configure
configure: error: Already configured in ../llvm

Huh ?

There are no files in the 'build' directory except for a config.log
which says:

"This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by llvm configure 3.0svn, which was
generated by GNU Autoconf 2.60. Invocation command line was

   $ ../llvm/configure

The error is emitted after testing for the presence on the source tree
of the file

include/llvm/Config/config.h

That file is generated by the configure script of by cmake.

Are you using the same sources you previously used for building with VS
in-source? If yes, you must start from a clean source directory. Some
version control tools have commands for removing all unversioned files,
but I don't know about svn.

Edward Diener<eldlistmailingz@tropicsoft.com>
writes:

I am trying to build clang with MingW and MSYS. I have followed the
instructions on the Clang "Getting Started" page. When I execute:

../llvm/configure

I receive:

$ ../llvm/configure
configure: error: Already configured in ../llvm

Huh ?

There are no files in the 'build' directory except for a config.log
which says:

"This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by llvm configure 3.0svn, which was
generated by GNU Autoconf 2.60. Invocation command line was

    $ ../llvm/configure

The error is emitted after testing for the presence on the source tree
of the file

include/llvm/Config/config.h

That file is generated by the configure script of by cmake.

Are you using the same sources you previously used for building with VS
in-source?'

Yes.

If yes, you must start from a clean source directory. Some
version control tools have commands for removing all unversioned files,
but I don't know about svn.

Wow, this is a wonderful build system, that can not even build clang for two different compilers without conflict. Is this CMake or just 'Nix configure ? OK, it is useless to complain about such things but this is very poor. Maybe LLVM and Clang should consider something better.

There must be some way of building a version of clang using MingW without wiping out the clang using VC++ 10 I built. I guess I will just save the 'bin' directory somehwere, wipe out my source tree, get everything from SVN again and try MingW.

Edward Diener <eldlistmailingz@tropicsoft.com>
writes:

The error is emitted after testing for the presence on the source tree
of the file

include/llvm/Config/config.h

That file is generated by the configure script of by cmake.

Are you using the same sources you previously used for building with VS
in-source?'

Yes.

If yes, you must start from a clean source directory. Some
version control tools have commands for removing all unversioned files,
but I don't know about svn.

Wow, this is a wonderful build system, that can not even build clang for
two different compilers without conflict. Is this CMake or just 'Nix
configure ? OK, it is useless to complain about such things but this is
very poor. Maybe LLVM and Clang should consider something better.

Please don't be so fast at reaching to conclusions. What you observed is
something perfectly reasonable. First, you used cmake for building
in-source. This creates several files mixed with the original source
files (in-source means exactly that and the configure script does the
same). Then you invoked the configure script from another
directory. That error message you got is preventing you from building on
a conflicting state, as the generated config.h and other files which are
mixed with the source code may be inadequate for the configuration of
your new build.

If you plan to build the same source code with different settings,
always do out-of-source builds.

[snip]

OK, you are right and I should have realized that I should build outside the llvm source tree.

Still it seems a build system should be able to build something from more than one setup without conflict. In Boost I can build any given libraries with different compilers never having to worry about where the final result end up or from where I invoke the build system.

Edward Diener <eldlistmailingz@tropicsoft.com>
writes:

[snip]

Still it seems a build system should be able to build something from
more than one setup without conflict. In Boost I can build any given
libraries with different compilers never having to worry about where the
final result end up or from where I invoke the build system.

That's because the boost build system always does an out-of-source
build, regardless from where you invoke the tool. And, IIRC, building
boost doesn't need configuration-dependent files generated on-the-fly.

The LLVM CMake build actually forbids in-source build, except for the VS
IDE. (In-source builds for other generators are not allowed because the
hand-made makefiles distributed with LLVM would be overwritten)