[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows

Michael Ness mike at liquido2.com
Fri Dec 11 13:37:33 PST 2009


Ok, more recent developments follow.  I updated my MSYS and MinGW install to 
use binutils 2.20 and gcc 4.4.0.  With this I was able to build LLVM 2.6 
with the following CMake configuration:

cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PIC=NO -DLLVM_ENABLE_THREADS=NO 
 -G "MSYS Makefiles" ~/llvm-2.6-src

I also downloaded the llvm-gcc 4.2 binaries from llvm.org and used them to 
build an alternate llvm system using the following configuration:

cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PIC=NO -DLLVM_ENABLE_THREADS=NO 
 -DCMAKE_C_COMPILER=llvm-gcc -DCMAKE_CXX_COMPILER=llvm-g++ -G "MSYS 
Makefiles" ~/llvm-2.6-src

llvm-config seems to work better in both builds (at least listing more 
dependencies).  Using the gcc version:

$ llvm-config --libs x86
-lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter
-lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis 
 -lLLVMTarget -lLLVMMC
-lLLVMCore -lLLVMX86Info -lLLVMSupport -lLLVMSystem

and using the llvm-gcc version:

$ ~/llvm-2.6-gcc/bin/llvm-config --libs x86
-lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter
-lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis 
 -lLLVMTarget -lLLVMMC
-lLLVMCore -lLLVMX86Info -lLLVMSupport -lLLVMSystem

I then used both of these builds to attempt to assemble and link my project 
with llvm-g++:

$ llvm-g++ out.s -o out.exe `llvm-config --ldflags --libs x86 core system 
support`

gave me the errors found in the attached file "errors_gcc.txt".  And

$ llvm-g++ out.s -o out.exe `~/llvm-2.6-gcc/bin/llvm-config --ldflags --libs 
x86 core system support`

gave me the errors found in the attached file "errors_llvm-gcc.txt".

I found it interesting that the attempt to link with the LLVM libs built 
with gcc caused several "multiple definition" errors, whereas the attempt to 
link with the libs built by llvm-gcc cause no multiple definitions but many 
more stdcall-fixup warnings.

Both attempts failed to link, citing llvm::Type::Int32Ty as unresolved among 
other things.  Isn't llvm::Type in Core?

I appears I'm closer using the llvm-gcc build, but still unable to link 
everything correctly.  Any other ideas?

Thanks,

--Mike

> From: "Óscar Fuentes" <ofv at wanadoo.es>
> Sent: Wednesday, December 09, 2009 10:02 PM

> What's the output of
>
> llvm-config --libs x86
>
> Take a look at the $LLVM_BUILD_ROOT/bin/llvm-deps script and see if the
> library dependencies listed at the end looks normal, i.e. every library
> depends on other libraries, with Support and System on almost every
> dependency list.
>
> Maybe there is a bug on the generation of library dependencies. This may
> due to a faulty binutils or perl. Maybe there is a problem with the name
> of some components too, they changed names on the last months.
>
> What command line options do you pass to cmake? (variables, switches,
> etc).
 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: errors_gcc.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091211/93ca1248/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: errors_llvm-gcc.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091211/93ca1248/attachment-0001.txt>


More information about the llvm-dev mailing list