Clang build (with profiling enabled) fails on FreeBSD

I attempted to build clang with profiling enabled, and it won't
compile. I was able to compile the Debug and Release versions without
problems, but problems arise whenever I try to add profiling.

Here's what I attempted to do:

    $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
    $ cd llvm/tools
    $ svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
    $ cd ..
    $ ./configure --enable-optimized --enable-profiling
    $ gmake

It was building for a while, but eventually saw the following output:

    llvm[2]: Linking Release+Profile executable not
    llvm[2]: ======= Finished Linking Release+Profile Executable not
    gmake[2]: Leaving directory `/usr/home/jay/progs/llvm/utils/not'
    gmake[2]: Entering directory `/usr/home/jay/progs/llvm/utils/unittest'
    gmake[3]: Entering directory
`/usr/home/jay/progs/llvm/utils/unittest/googletest'
    gmake[3]: Nothing to be done for `all'.
    gmake[3]: Leaving directory
`/usr/home/jay/progs/llvm/utils/unittest/googletest'
    gmake[3]: Entering directory
`/usr/home/jay/progs/llvm/utils/unittest/UnitTestMain'
    gmake[3]: Nothing to be done for `all'.
    gmake[3]: Leaving directory
`/usr/home/jay/progs/llvm/utils/unittest/UnitTestMain'
    gmake[2]: Leaving directory `/usr/home/jay/progs/llvm/utils/unittest'
    gmake[1]: Leaving directory `/usr/home/jay/progs/llvm/utils'
    gmake[1]: Entering directory `/usr/home/jay/progs/llvm/lib/VMCore'
    llvm[1]: Building Intrinsics.gen.tmp from Intrinsics.td
    gmake[1]: ***
[/usr/home/jay/progs/llvm/lib/VMCore/Release+Profile/Intrinsics.gen.tmp]
Segmentation fault: 11 (core dumped)
    gmake[1]: Leaving directory `/usr/home/jay/progs/llvm/lib/VMCore'
    gmake: *** [all] Error 1

I'm running FreeBSD 7.0 on a PC with 128 Mb of RAM. More details:

    $ uname -a
    FreeBSD dell.petio.org 7.0-RELEASE FreeBSD 7.0-RELEASE #2: Tue Dec
23 01:38:59 EST 2008 root@dell.petio.org:/usr/obj/usr/src/sys/DELL
i386

    $ cc -v
    Using built-in specs.
    Target: i386-undermydesk-freebsd
    Configured with: FreeBSD/i386 system compiler
    Thread model: posix
    gcc version 4.2.1 20070719 [FreeBSD]

Sorry, I had to redo it a few times to get the correct output again.
I've uploaded the full output of gmake to:
http://petio.org/temp/clangoutput

So, looks like it's failing on the tblgen command:

    /usr/home/jay/progs/llvm/Release+Profile/bin/tblgen -I
/usr/home/jay/progs/llvm/lib/VMCore -I
/usr/home/jay/progs/llvm/include -I /usr/home/jay/progs/llvm/include
-I /usr/home/jay/progs/llvm/lib/Target
/usr/home/jay/progs/llvm/include/llvm/Intrinsics.td -o
/usr/home/jay/progs/llvm/lib/VMCore/Release+Profile/Intrinsics.gen.tmp
-gen-intrinsic

Here's a trussed output for this command:

    http://petio.org/temp/tblgen_bad

Interestingly, if I try to use a different tblgen (one compiled
without profiling enabled), it doesn't crash:

    http://petio.org/temp/tblgen_good

Any thoughts?

Any thoughts?

Looks like your gcc is broken. Consider upgrading / downgrading

It looks like exactly the same GCC that I've been using on FreeBSD 7.x / 8.0 to build clang, and it works for me, although I've not tried a profiling build. Jay, does it work without profiling for you?

David

Jay Sullivan wrote:-

I'm running FreeBSD 7.0 on a PC with 128 Mb of RAM. More details:

I think you're optimistic. Clang in release-asserts mode only just
builds on a 512MB machine of mine; the whole machine is in swap
when linking, and it takes 30mins to 1hr just to link the various
binaries.

Neil.

Hey, now, there's got to be some value in testing the build in a low
RAM environment. It is swapping a little bit, but not thrashing! And
yes, 30mins to 1hr is accurate. You mean it's not supposed to take
that long?? :slight_smile: