I don't suppose anyone knows what (or how to find out what) the actual command to compile Kaleidoscope is? I followed cmake/nmake down through maybe half a dozen levels before getting lost, so I tried to develop a compiler invocation from scratch. I got as far as cl /EHsc /I\d\llvm-2.6\include /I\llvm\include /wd4355 toy.cpp which successfully generated toy.obj and spat out 86 link time error messages -- as expected, it needs the libraries specified. cmakelists.txt says set(LLVM_LINK_COMPONENTS core jit interpreter native) so I made a guess at the .lib file corresponding to the first of these, and tried cl /EHsc /I\d\llvm-2.6\include /I\llvm\include /wd4355 toy.cpp \llvm\lib\llvmcore.lib in the hope that the number of link time error messages would go down... but it actually goes up to 395, and the earlier ones don't obviously have anything to do with llvm itself. Any ideas? The first few error messages are msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at XZ) already defined in toy.obj msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at ABV01@@Z) already defined in toy.obj msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(char const *)" (??0?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QAE at PBD@Z) already defined in toy.obj msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: char const * __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::c_str(void)const " (?c_str@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@QBEPBDXZ) already defined in toy.obj msvcprtd.lib(MSVCP90D.dll) : error LNK2005: "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits at D@std@@SAIPBD at Z) already defined in toy.obj
Russell Wallace <russell.wallace at gmail.com> writes:> I don't suppose anyone knows what (or how to find out what) the actual > command to compile Kaleidoscope is? I followed cmake/nmake down > through maybe half a dozen levels before getting lost, so I tried to > develop a compiler invocation from scratch. I got as far as > > cl /EHsc /I\d\llvm-2.6\include /I\llvm\include /wd4355 toy.cpp > > which successfully generated toy.obj and spat out 86 link time error > messages -- as expected, it needs the libraries specified. > cmakelists.txt says set(LLVM_LINK_COMPONENTS core jit interpreter > native) so I made a guess at the .lib file corresponding to the first > of these, and tried > > cl /EHsc /I\d\llvm-2.6\include /I\llvm\include /wd4355 toy.cpp > \llvm\lib\llvmcore.lib > > in the hope that the number of link time error messages would go > down... but it actually goes up to 395, and the earlier ones don't > obviously have anything to do with llvm itself. Any ideas? The first > few error messages areSadly, nmake can't be told to show the full command they execute for makefiles generated with cmake. Otherwise it would be obvious to know the involved steps for building a component. First of all, use /MDd (for debug builds) or /MD (for release builds) on the command line. The required LLVM libraries can be listed using the `llvm-config' script on Unix or MinGW. The dependencies are listed too in %LLVMSourceRoot%/cmake/modules/LLVMLibDeps.cmake bus as this is a bit inconvenient to read, here they are for you: -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMMCParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Info -lLLVMInterpreter -lLLVMJIT -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem Rename -lLIBRARYNAME to \llvm\lib\LIBRARYNAME.lib HTH.
Thanks! Three of the libraries are not found: LLVMX86Disassembler.lib LLVMMCParser.lib LLVMInstCombine.lib ... the third one of those sounds like it might be important, what does it do exactly? But specifying the rest of them with /MD completes the build with this message Creating library toy.lib and object toy.exp LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library And generates toy.exe; when I run this, and test it by typing 1+2; it crashes with no error message. Any idea what the problem might be? (Tried it again with /MDd, and the resulting toy.exe successfully evaluates 1+2, though crashes as before when I exit with ^Z.) On Sun, Jan 31, 2010 at 2:21 PM, Óscar Fuentes <ofv at wanadoo.es> wrote:> Russell Wallace <russell.wallace at gmail.com> writes: > >> I don't suppose anyone knows what (or how to find out what) the actual >> command to compile Kaleidoscope is? I followed cmake/nmake down >> through maybe half a dozen levels before getting lost, so I tried to >> develop a compiler invocation from scratch. I got as far as >> >> cl /EHsc /I\d\llvm-2.6\include /I\llvm\include /wd4355 toy.cpp >> >> which successfully generated toy.obj and spat out 86 link time error >> messages -- as expected, it needs the libraries specified. >> cmakelists.txt says set(LLVM_LINK_COMPONENTS core jit interpreter >> native) so I made a guess at the .lib file corresponding to the first >> of these, and tried >> >> cl /EHsc /I\d\llvm-2.6\include /I\llvm\include /wd4355 toy.cpp >> \llvm\lib\llvmcore.lib >> >> in the hope that the number of link time error messages would go >> down... but it actually goes up to 395, and the earlier ones don't >> obviously have anything to do with llvm itself. Any ideas? The first >> few error messages are > > Sadly, nmake can't be told to show the full command they execute for > makefiles generated with cmake. Otherwise it would be obvious to know > the involved steps for building a component. > > First of all, use /MDd (for debug builds) or /MD (for release builds) on > the command line. The required LLVM libraries can be listed using the > `llvm-config' script on Unix or MinGW. The dependencies are listed too > in > > %LLVMSourceRoot%/cmake/modules/LLVMLibDeps.cmake > > bus as this is a bit inconvenient to read, here they are for you: > > -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMMCParser > -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMSelectionDAG > -lLLVMAsmPrinter -lLLVMX86Info -lLLVMInterpreter -lLLVMJIT > -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine > -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC > -lLLVMCore -lLLVMSupport -lLLVMSystem > > Rename -lLIBRARYNAME to \llvm\lib\LIBRARYNAME.lib > > HTH. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >