[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
Óscar Fuentes
ofv at wanadoo.es
Sat Dec 12 00:31:34 PST 2009
"Michael Ness" <mike at liquido2.com> writes:
>> You are working with an assembler file. Why?
>
> Here is the build process I'm using for my project: I have a program
> written in LLVM assembly that is converted to bit code using llvm-as. I
> have anther file written in C that is compiled to bit code using
> llvm-gcc --emit-llvm. These two bit code files are then linked with
> llvm-link and the resulting bit code is assembled with llc to yield the
> assembly file I'm using.
>
>> You don't need to enumerate the base libraries. Something like
>>
>> llvm-config --ldflags --libs x86
>>
>> should suffice. In the next message, please show the output of that
>> command. Maybe the `--ldflags' is adding stuff to the command line that
>> causes the problem. Try removing it.
>
> $ llvm-config --ldflags --libs x86
> -L/home/Michael/llvm-2.6/lib -limagehlp -lpsapi -lLLVMX86AsmParser -lLLVMX86AsmPrinter
> -lLLVMX86CodeGen
> -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils
> -lLLVMipa
> -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMX86Info -lLLVMSupport
> -lLLVMSystem
Okay, try this command (after joining all the lines together):
llvm-g++ out.s -o out.exe -L/home/Michael/llvm-2.6/lib
-lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen
-lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts
-lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC
-lLLVMCore -lLLVMX86Info -lLLVMSupport -lLLVMSystem -lLLVMX86AsmParser
-lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter
-lLLVMCodeGen -lLLVMScalarOpts -lLLVMTransformUtils -lLLVMipa
-lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMX86Info
-lLLVMSupport -lLLVMSystem -limagehlp -lpsapi
Yes, the LLVM libraries are listed twice. And the system libraries are
moved to the end (this is required for avoiding an undefined reference).
>> Was the assembler file generated by the same g++ you are using for
>> linking it and, previously, for building LLVM?
>
> No, the assembler file was generated by llvm-as. I did use the same
> llvm-g++ to compile the C source file to bit code though.
>
>> Have you access to other toolset for building your project (VC++, g++ on
>> Linux, etc.)? Have you tried using LLVM libraries created with
>> configure&make, as Anton suggested?
>
> I do have access to VC++ and Linux g++ and will attempt to build using these
> tools.
Using VC++ with llvm-gcc may be tricky, but doable. Try Linux first.
--
Óscar
More information about the llvm-dev
mailing list