Óscar Fuentes
2009-Dec-11 22:32 UTC
[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
"Michael Ness" <mike at liquido2.com> writes: [snip]> 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".You are working with an assembler file. Why? 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.> 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.Was the assembler file generated by the same g++ you are using for linking it and, previously, for building LLVM?> Both attempts failed to link, citing llvm::Type::Int32Ty as unresolved > among other things. Isn't llvm::Type in Core?Yes.> I appears I'm closer using the llvm-gcc build, but still unable to > link everything correctly. Any other ideas?As the LLVM tools builds file, I think that the problem is in how you handle the build of your project. Or you are hitting a problem with MinGW's binutils. 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? -- Óscar
Anton Korobeynikov
2009-Dec-11 23:05 UTC
[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
Hello, Everyone> 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?One side note: ignore all "stdcall fixup" stuff - this is bug in the backend I'm planning to fix for 2.7 -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University.
Michael Ness
2009-Dec-12 03:31 UTC
[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
-------------------------------------------------- From: "Óscar Fuentes" <ofv at wanadoo.es> Sent: Friday, December 11, 2009 4:32 PM To: <llvmdev at cs.uiuc.edu> Subject: Re: [LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows> > 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> 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. I have tried configure&make to build LLVM, but the build process fails. This is why I moved to CMake. --Mike
Óscar Fuentes
2009-Dec-12 08:31 UTC
[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
"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 > -lLLVMSystemOkay, 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