Clang now builds world and kernel, on i386 and amd64

Bartosz Stec admin at kkip.pl
Fri Sep 24 11:24:33 UTC 2010


  W dniu 2010-09-23 16:45, Dimitry Andric pisze:
> On 2010-09-23 13:24, Bartosz Stec wrote:
>>> I cannot reproduce this here, running the exact command printed above.
>>> What is the output of "/usr/bin/clang++ -v" ?
>> # /usr/bin/clang++ -v
>> FreeBSD clang version 2.8 (branches/release_28 114020) 20100917
>> Target: i386-undermydesk-freebsd9.0
>> Thread model: posix
>
> Right, that seems okay enough.  Any other information you can give to
> help reproduce this issue would be nice.  For example, do you have any
> special stuff in src.conf or make.conf?  Do you have more than one
> "clang++" in your PATH, maybe an old port version?

So I've started from scratch:

1. rm -Rf /usr/src/*
2. portinstall subversion-freebsd
3. checkout fresh sources
4. disabled clang debugging in/src/lib/clang/clang.build.mk for speed 
measuring
5. rebuild and reinstall world & kernel via GCC (without src.conf)
6. after new world is alive rebuild and reinstall world & kernel via 
CLANG (with src.conf, and no problem with this part)
7. Another buildworld try and here's the bug again (output seems to be 
different only because of disables debugging):

    ===> lib/clang/libllvmsupport (obj,depend,all,install)
    /usr/obj/usr/src/tmp/usr/src/lib/clang/libllvmsupport created for
    /usr/src/lib/clang/libllvmsupport
    rm -f .depend
    CC='clang' mkdep -f .depend -a   
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I.
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include
    -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS
    -D__STDC_CONSTANT_MACROS -DNDEBUG
    -DLLVM_HOSTTRIPLE=\"i386-undermydesk-freebsd9.0\"
    -I/usr/obj/usr/src/tmp/legacy/usr/include
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regcomp.c
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regerror.c
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regexec.c
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regfree.c
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/regstrlcpy.c
    CC='clang' mkdep -f .depend -a   
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I.
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include
    -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS
    -D__STDC_CONSTANT_MACROS -DNDEBUG
    -DLLVM_HOSTTRIPLE=\"i386-undermydesk-freebsd9.0\"
    -I/usr/obj/usr/src/tmp/legacy/usr/include   
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APInt.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APSInt.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Allocator.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/CommandLine.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ConstantRange.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/CrashRecoveryContext.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/DAGDeltaAlgorithm.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Debug.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/DeltaAlgorithm.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Dwarf.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ErrorHandling.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/FoldingSet.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/FormattedStream.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/GraphWriter.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/ManagedStatic.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/MemoryBuffer.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/PluginLoader.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/PrettyStackTrace.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Regex.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/SmallPtrSet.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/SmallVector.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/SourceMgr.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Statistic.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringExtras.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringMap.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringPool.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/StringRef.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/TargetRegistry.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Timer.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Triple.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/Twine.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/circular_raw_ostream.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_os_ostream.cpp
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/raw_ostream.cpp
    clang++ -O2 -pipe
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/include
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/tools/clang/include
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support -I.
    -I/usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/../../lib/clang/include
    -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS
    -D__STDC_CONSTANT_MACROS -DNDEBUG
    -DLLVM_HOSTTRIPLE=\"i386-undermydesk-freebsd9.0\" -fno-exceptions
    -I/usr/obj/usr/src/tmp/legacy/usr/include -c
    /usr/src/lib/clang/libllvmsupport/../../../contrib/llvm/lib/Support/APFloat.cpp
    fatal error: error in backend: Ran out of registers during register
    allocation!
    *** Error code 1

Interesting, because it seems that only clang builded by clang has a 
problem to build clang, while clang builded by gcc has not ;)
I've never had clang port installed so problem must be somewhere elsewhere.

src.conf:

    .if !defined(CC) || ${CC} == "cc"
    CC=clang
    .endif
    .if !defined(CXX) || ${CXX} == "c++"
    CXX=clang++
    .endif
    # Don't die on warnings
    NO_WERROR=
    WERROR=

make.conf (note that NOCCACHE was defined in environment during all 
builds so ccache wasn't used):

    CPUTYPE=athlon-xp

    # default build settings for ports collection
    .if ${.CURDIR:M*/ports/*} && !defined(NOCCACHE)
    CFLAGS=-O2 -pipe
    .endif

    # default build settings for base system
    .if ${.CURDIR:M*/usr/src/*} || ${.CURDIR:M*/usr/obj/*}

    CFLAGS=-O2 -pipe
    COPTFLAGS=-O2 -pipe

    .if !defined(NOCCACHE)
    CC:=${CC:C,^cc,/usr/local/libexec/ccache/world-cc,1}
    CXX:=${CXX:C,^c\+\+,/usr/local/libexec/ccache/world-c++,1}
    .endif
    .endif

    # added by use.perl 2010-08-10 10:21:21
    PERL_VERSION=5.10.1

#echo $PATH
/usr/local/libexec/ccache:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin

>
> Also, can you please post the output of the commands:
>
> whereis clang

#whereis clang
clang: /usr/bin/clang /usr/src/usr.bin/clang



    #clang++ -v -O2 -save-temps -I/usr/src/contrib/llvm/include
    -I/usr/src/contrib/llvm/tools/clang/include
    -I/usr/src/contrib/llvm/lib/Support -I. -I/usr/src/lib/clang/include
    -DLLVM_ON_UNIX -DLLVM_ON_FREEBSD -D__STDC_LIMIT_MACROS
    -D__STDC_CONSTANT_MACROS -DNDEBUG
    -DLLVM_HOSTTRIPLE=\"i386-undermydesk-freebsd9.0\" -fno-exceptions
    -I/usr/obj/usr/src/tmp/legacy/usr/include -c
    /usr/src/contrib/llvm/lib/Support/APFloat.cpp
    FreeBSD clang version 2.8 (branches/release_28 114020) 20100917
    Target: i386-undermydesk-freebsd9.0
    Thread model: posix
      "/usr/bin/clang++" -cc1 -triple i386-undermydesk-freebsd9.0 -E
    -disable-free -disable-llvm-verifier -main-file-name APFloat.cpp
    -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
    -target-cpu i486 -v -resource-dir /usr/lib/clang/2.8 -D LLVM_ON_UNIX
    -D LLVM_ON_FREEBSD -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS
    -D NDEBUG -D LLVM_HOSTTRIPLE="i386-undermydesk-freebsd9.0" -I
    /usr/src/contrib/llvm/include -I
    /usr/src/contrib/llvm/tools/clang/include -I
    /usr/src/contrib/llvm/lib/Support -I . -I /usr/src/lib/clang/include
    -I /usr/obj/usr/src/tmp/legacy/usr/include -O2 -ferror-limit 19
    -fmessage-length 116 -fgnu-runtime -fdiagnostics-show-option
    -fcolor-diagnostics -o APFloat.ii -x c++
    /usr/src/contrib/llvm/lib/Support/APFloat.cpp
    clang -cc1 version 2.8 based upon llvm 2.8svn hosted on
    i386-undermydesk-freebsd9.0
    ignoring nonexistent directory "/usr/include/c++/4.2/backward/backward"
    ignoring nonexistent directory "/usr/lib/clang/2.8/include"
    ignoring duplicate directory "/usr/include/c++/4.2"
    ignoring duplicate directory "/usr/include/c++/4.2/backward"
    ignoring duplicate directory "/usr/include/c++/4.2/backward"
    #include "..." search starts here:
    #include <...> search starts here:
      /usr/src/contrib/llvm/include
      /usr/src/contrib/llvm/tools/clang/include
      /usr/src/contrib/llvm/lib/Support
      .
      /usr/src/lib/clang/include
      /usr/obj/usr/src/tmp/legacy/usr/include
      /usr/include/c++/4.2
      /usr/include/c++/4.2/backward
      /usr/include/clang/2.8
      /usr/include
    End of search list.
      "/usr/bin/clang++" -cc1 -triple i386-undermydesk-freebsd9.0 -S
    -disable-free -disable-llvm-verifier -main-file-name APFloat.cpp
    -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases
    -target-cpu i486 -v -resource-dir /usr/lib/clang/2.8 -O2
    -ferror-limit 19 -fmessage-length 116 -fgnu-runtime
    -fdiagnostics-show-option -fcolor-diagnostics -o APFloat.s -x
    c++-cpp-output APFloat.ii
    clang -cc1 version 2.8 based upon llvm 2.8svn hosted on
    i386-undermydesk-freebsd9.0
    ignoring nonexistent directory "/usr/include/c++/4.2/backward/backward"
    ignoring nonexistent directory "/usr/lib/clang/2.8/include"
    ignoring duplicate directory "/usr/include/c++/4.2"
    ignoring duplicate directory "/usr/include/c++/4.2/backward"
    ignoring duplicate directory "/usr/include/c++/4.2/backward"
    #include "..." search starts here:
    #include <...> search starts here:
      /usr/include/c++/4.2
      /usr/include/c++/4.2/backward
      /usr/include/clang/2.8
      /usr/include
    End of search list.
    fatal error: error in backend: Ran out of registers during register
    allocation!



>
> and the resulting APFloat.ii, APFloat.s (if clang manages to produce
> it)?
>

APFloat.s was created and it's empty.
Here you can grab the other: http://ncpnc.obsysa.net/tmp/APFloat.ii.bz2

-- 
Bartosz Stec




More information about the freebsd-current mailing list