Óscar Fuentes
2009-Dec-10 04:02 UTC
[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
"Michael Ness" <mike at liquido2.com> writes:> I decided to forget 2.5 and move on to 2.6 which built fine with CMake. > However, I continue to have problems with llvm-config when using the > following command: > > $ llvm-g++ out.s -o out `llvm-config --ldflags --libs core support system > x86` > > I consistently get undefined reference errors that are from libraries that > should've been linked already. The errors change depending on the order of > the components. There is obviously dependency issues--references to libs > that have already been linked. How do I resolve these dependency problems?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.> Also, I'm unable to use "llvm-config --libs all" because I receive the > error: "llvm-config: unknown component name: pic16codegen" > llvm-config --components doesn't list pic16codegen, so I'm confused why > it's included with --libs all.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). -- Óscar
Michael Ness
2009-Dec-11 21:37 UTC
[LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
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>
Ó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
Maybe Matching Threads
- [LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
- [LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
- [LLVMdev] Discrepancies between bin/llvm-config --libs and LLVM_LINK_COMPONENTS in CMake.
- [LLVMdev] Rebuilding LLVM libraries with LLVM-GCC on Windows
- [LLVMdev] Using LLVM components