[LLVMdev] Using non-system compiler to build llvm and llvm-gcc front end

Scott Ricketts sricketts at maxentric.com
Wed May 6 12:22:24 PDT 2009


On Tue, May 5, 2009 at 11:33 PM, Duncan Sands <baldrick at free.fr> wrote:
> Hi Scott,
>
>> On Tue, May 5, 2009 at 12:26 PM, Duncan Sands <baldrick at free.fr> wrote:
>> > this is indeed a miscompilation by your system compiler.  However so many
>> > compilers miscompiled this that a workaround was committed to svn.  So you
>> > may want to check out llvm and llvm-gcc from svn.  Alternatively, maybe
>> > the patch applies to llvm 2.5 too.  I've attached it.
>>
>> I will try the latest from svn... but quick follow up question: If it
>> looks like a miscompilation by my system compiler (gcc 4.1.2), why
>> wasn't gcc-4.2.4 used? Did I make a mistake in configuration? Maybe I
>> am misunderstanding the build process.
>
> some versions of gcc 4.2 also miscompile this on 64 bit platforms...
> By the way, I attached the wrong patch.  Try this new one instead!
>
> Ciao,
>
> Duncan.
>

Thanks, I am making some progress. The latest from svn (for llvm and
llvm-gcc) built successfully. I built everything without adjusting the
PATH, so I guess I used gcc 4.1.2.

However, I then went back to attempt a build with ENABLE_OPTIMIZED=1
(this is just a test installation, once I get things working I will be
installing on another machine with the same OS). The optimized build
of llvm failed:

make[1]: Entering directory `/pkg/build/llvm-svn2/llvm-obj/lib/VMCore'
llvm[1]: Building Intrinsics.gen.tmp from Intrinsics.td
llvm[1]: Compiling AsmWriter.cpp for Release build
llvm[1]: Compiling Attributes.cpp for Release build
llvm[1]: Compiling AutoUpgrade.cpp for Release build
llvm[1]: Compiling BasicBlock.cpp for Release build
llvm[1]: Compiling ConstantFold.cpp for Release build
llvm[1]: Compiling Constants.cpp for Release build
llvm[1]: Compiling Core.cpp for Release build
llvm[1]: Compiling Dominators.cpp for Release build
llvm[1]: Compiling Function.cpp for Release build
g++: Internal error: Segmentation fault (program cc1plus)

So then I did make clean. No big deal, I can live without the
optimized build. But originally I just built with "make tools-only"
because I had not yet built llvm-gcc. But now I have a built version
of llvm-gcc, so I re-configured with:

../llvm/configure --prefix=/pkg/bin/llvm
--with-llvmgccdir=/pkg/build/llvm-svn2/install/

and then did "make" in the llvm-obj directory. But this build failed:

make[2]: Entering directory `/pkg/build/llvm-svn2/llvm-obj/tools/bugpoint'
llvm[2]: Compiling BugDriver.cpp for Debug build
llvm[2]: Compiling CrashDebugger.cpp for Debug build
llvm[2]: Compiling ExecutionDriver.cpp for Debug build
llvm[2]: Compiling ExtractFunction.cpp for Debug build
llvm[2]: Compiling FindBugs.cpp for Debug build
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc:
In member function ‘std::basic_ostream<_CharT, _Traits>&
std::basic_ostream<_CharT, _Traits>::operator<<(double)’:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/ostream.tcc:374:
internal compiler error: Segmentation fault

Now I am thoroughly confused. Can someone check my installation
process? Here is what I think I am supposed to do:

1) configure llvm without pointing to llvm-gcc, "make tools-only"
2) configure llvm-gcc pointing to the llvm build from step (1)
3) re-configure llvm to point to llvm-gcc from step (2), "make"

FYI, I tried the first patch Duncan sent (applied to llvm-2.5), which
did not fix the problem. I have not yet tried the second patch. I am
assuming that checking out the latest from svn is at least as good?

Scott




More information about the llvm-dev mailing list