Rodney M. Bates
2014-Dec-17 03:15 UTC
[LLVMdev] How to figure out what #includes are needed?
This is partly an llvm question, and maybe partly C++. I am trying to make calls on code in the llvm infrastructure.(3.4.2) I appear to be missing some include files, but don't know how to track them down. I get compile errors on existing llvm header files, like the following two examples: -------------------------------------------------------------------------------- In file included from LLVMDIBuilder.cpp:16: In file included from /usr/local/include/llvm/Support/CBindingWrapping.h:17: In file included from /usr/local/include/llvm/Support/Casting.h:18: In file included from /usr/local/include/llvm/Support/type_traits.h:22: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:70: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_pair.h:59: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:185:5: error: conflicting types for 'swap' swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:166:5: note: previous definition is here swap(_Tp& __a, _Tp& __b) -------------------------------------------------------------------------------- In file included from LLVMDIBuilder.cpp:16: In file included from /usr/local/include/llvm/Support/CBindingWrapping.h:17: In file included from /usr/local/include/llvm/Support/Casting.h:18: /usr/local/include/llvm/Support/type_traits.h:48:33: error: functions that differ only in their return type cannot be overloaded template<typename T> double is_class_helper(...); ^ /usr/local/include/llvm/Support/type_traits.h:47:31: note: previous declaration is here template<typename T> char is_class_helper(void(T::*)()); ^ -------------------------------------------------------------------------------- Obviously, these files compile when included by the normal llvm build process. I have gotten many previous similar errors to go away by rote copying in of all the #include lines in the full code listing in the new Kaleidoscope Chapter 8 example and all those in core.cpp, but many more remain. I would have expected missing declarations from missing include files to give error messages like "undeclared identifier", but the effect seems to be to make types that look different be the same, and vice versa (but apparently not different enough to be legal overloads?). My command line is: clang++ -g LLVMDIBuilder.cpp `llvm-config --cxxflags --libs all` $lvm-config --cxxflags --libs all -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual -lLLVMInstrumentation -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfo -lLLVMOption -lLLVMLTO -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter -lLLVMBitReader -lLLVMTableGen -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler -lLLV MAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInterpreter -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport How do I figure out what to include to fix these? -- Rodney Bates rodney.m.bates at acm.org
Rodney M. Bates
2014-Dec-18 01:11 UTC
[LLVMdev] Fwd: How to figure out what #includes are needed?
-------- Original Message -------- Subject: How to figure out what #includes are needed? Date: Tue, 16 Dec 2014 21:15:25 -0600 From: Rodney M. Bates <rodney_bates at lcwb.coop> Reply-To: rodney.m.bates at acm.org To: llvmdev at cs.uiuc.edu This is partly an llvm question, and maybe partly C++. I am trying to make calls on code in the llvm infrastructure.(3.4.2) I appear to be missing some include files, but don't know how to track them down. I get compile errors on existing llvm header files, like the following two examples: -------------------------------------------------------------------------------- In file included from LLVMDIBuilder.cpp:16: In file included from /usr/local/include/llvm/Support/CBindingWrapping.h:17: In file included from /usr/local/include/llvm/Support/Casting.h:18: In file included from /usr/local/include/llvm/Support/type_traits.h:22: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:70: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_pair.h:59: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:185:5: error: conflicting types for 'swap' swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:166:5: note: previous definition is here swap(_Tp& __a, _Tp& __b) -------------------------------------------------------------------------------- In file included from LLVMDIBuilder.cpp:16: In file included from /usr/local/include/llvm/Support/CBindingWrapping.h:17: In file included from /usr/local/include/llvm/Support/Casting.h:18: /usr/local/include/llvm/Support/type_traits.h:48:33: error: functions that differ only in their return type cannot be overloaded template<typename T> double is_class_helper(...); ^ /usr/local/include/llvm/Support/type_traits.h:47:31: note: previous declaration is here template<typename T> char is_class_helper(void(T::*)()); ^ -------------------------------------------------------------------------------- Obviously, these files compile when included by the normal llvm build process. I have gotten many previous similar errors to go away by rote copying in of all the #include lines in the full code listing in the new Kaleidoscope Chapter 8 example and all those in core.cpp, but many more remain. I would have expected missing declarations from missing include files to give error messages like "undeclared identifier", but the effect appears to be to change the actual type denoted by a syntactic type construction. My command line is: clang++ -g LLVMDIBuilder.cpp `llvm-config --cxxflags --libs all` $lvm-config --cxxflags --libs all -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual -lLLVMInstrumentation -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfo -lLLVMOption -lLLVMLTO -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter -lLLVMBitReader -lLLVMTableGen -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler -lLLV MAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInterpreter -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport How do I figure out what to include to fix these? -- Rodney Bates rodney.m.bates at acm.org
Shouldn't -std=c++11 be there also? 2014-12-17 5:15 GMT+02:00 Rodney M. Bates <rodney_bates at lcwb.coop>:> This is partly an llvm question, and maybe partly C++. > > I am trying to make calls on code in the llvm infrastructure.(3.4.2) I > appear > to be missing some include files, but don't know how to track them down. > I get > compile errors on existing llvm header files, like the following two > examples: > ------------------------------------------------------------ > -------------------- > > In file included from LLVMDIBuilder.cpp:16: > In file included from /usr/local/include/llvm/ > Support/CBindingWrapping.h:17: > In file included from /usr/local/include/llvm/Support/Casting.h:18: > In file included from /usr/local/include/llvm/Support/type_traits.h:22: > In file included from /usr/lib/gcc/x86_64-linux-gnu/ > 4.8/../../../../include/c++/4.8/utility:70: > In file included from /usr/lib/gcc/x86_64-linux-gnu/ > 4.8/../../../../include/c++/4.8/bits/stl_pair.h:59: > /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:185:5: > error: conflicting types for 'swap' > swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) > ^ > /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:166:5: > note: previous definition is here > swap(_Tp& __a, _Tp& __b) > > ------------------------------------------------------------ > -------------------- > In file included from LLVMDIBuilder.cpp:16: > In file included from /usr/local/include/llvm/ > Support/CBindingWrapping.h:17: > In file included from /usr/local/include/llvm/Support/Casting.h:18: > /usr/local/include/llvm/Support/type_traits.h:48:33: error: functions > that differ only in their return type cannot be overloaded > template<typename T> double is_class_helper(...); > ^ > /usr/local/include/llvm/Support/type_traits.h:47:31: note: previous > declaration is here > template<typename T> char is_class_helper(void(T::*)()); > ^ > ------------------------------------------------------------ > -------------------- > > Obviously, these files compile when included by the normal llvm build > process. I have gotten many previous similar errors to go away by rote > copying > in of all the #include lines in the full code listing in the new > Kaleidoscope > Chapter 8 example and all those in core.cpp, but many more remain. > > I would have expected missing declarations from missing include files to > give error messages like "undeclared identifier", but the effect seems to > be to make types that look different be the same, and vice versa (but > apparently not different enough to be legal overloads?). > > My command line is: > > clang++ -g LLVMDIBuilder.cpp `llvm-config --cxxflags --libs all` > > $lvm-config --cxxflags --libs all > -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS > -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fvisibility-inlines-hidden > -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual > -lLLVMInstrumentation -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfo > -lLLVMOption -lLLVMLTO -lLLVMLinker -lLLVMipo -lLLVMVectorize > -lLLVMBitWriter -lLLVMBitReader -lLLVMTableGen -lLLVMR600CodeGen > -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter > -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser > -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter > -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc > -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo > -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo > -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info > -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen > -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter > -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc > -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen > -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter > -lLLVMAArch64Disassem! > bler -lLLV > MAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info > -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMPowerPCCodeGen > -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo > -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo > -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen > -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info > -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCDisassembler -lLLVMMCParser > -lLLVMInterpreter -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen -lLLVMObjCARCOpts > -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa > -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget > -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport > > How do I figure out what to include to fix these? > > > > -- > Rodney Bates > rodney.m.bates at acm.org > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141218/e49a78e4/attachment.html>
John Criswell
2014-Dec-18 15:23 UTC
[LLVMdev] How to figure out what #includes are needed?
On 12/16/14, 10:15 PM, Rodney M. Bates wrote:> This is partly an llvm question, and maybe partly C++. > > I am trying to make calls on code in the llvm infrastructure.(3.4.2) > I appear > to be missing some include files, but don't know how to track them > down. I get > compile errors on existing llvm header files, like the following two > examples:My recommendation is to look at the header files that define the classes and methods that you're using in LLVM. The easiest way to do this is to use doxygen. For example, if I'm using the Function class, I look at the doxygen page at: http://llvm.org/doxygen/classllvm_1_1Function.html That page tells me that the class definition is in Function.h. I look for Function.h and (in LLVM 3.2) it exists in: llvm/Function.h. As you write more LLVM code, it becomes easier to find header files as you'll get more accustomed to the source code. Regards, John Criswell> -------------------------------------------------------------------------------- > > > In file included from LLVMDIBuilder.cpp:16: > In file included from > /usr/local/include/llvm/Support/CBindingWrapping.h:17: > In file included from /usr/local/include/llvm/Support/Casting.h:18: > In file included from /usr/local/include/llvm/Support/type_traits.h:22: > In file included from > /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:70: > In file included from > /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_pair.h:59: > /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:185:5: > error: conflicting types for 'swap' > swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) > ^ > /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:166:5: > note: previous definition is here > swap(_Tp& __a, _Tp& __b) > > -------------------------------------------------------------------------------- > > In file included from LLVMDIBuilder.cpp:16: > In file included from > /usr/local/include/llvm/Support/CBindingWrapping.h:17: > In file included from /usr/local/include/llvm/Support/Casting.h:18: > /usr/local/include/llvm/Support/type_traits.h:48:33: error: functions > that differ only in their return type cannot be overloaded > template<typename T> double is_class_helper(...); > ^ > /usr/local/include/llvm/Support/type_traits.h:47:31: note: previous > declaration is here > template<typename T> char is_class_helper(void(T::*)()); > ^ > -------------------------------------------------------------------------------- > > > Obviously, these files compile when included by the normal llvm build > process. I have gotten many previous similar errors to go away by > rote copying > in of all the #include lines in the full code listing in the new > Kaleidoscope > Chapter 8 example and all those in core.cpp, but many more remain. > > I would have expected missing declarations from missing include files to > give error messages like "undeclared identifier", but the effect seems to > be to make types that look different be the same, and vice versa (but > apparently not different enough to be legal overloads?). > > My command line is: > > clang++ -g LLVMDIBuilder.cpp `llvm-config --cxxflags --libs all` > > $lvm-config --cxxflags --libs all > -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS > -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g > -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC > -Woverloaded-virtual -Wcast-qual > -lLLVMInstrumentation -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfo > -lLLVMOption -lLLVMLTO -lLLVMLinker -lLLVMipo -lLLVMVectorize > -lLLVMBitWriter -lLLVMBitReader -lLLVMTableGen -lLLVMR600CodeGen > -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter > -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser > -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter > -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc > -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo > -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo > -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info > -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen > -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter > -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser > -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter > -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser > -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassem! > bler -lLLV > MAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc > -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils > -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc > -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen > -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86Disassembler > -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG > -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter > -lLLVMX86Utils -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInterpreter > -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMScalarOpts > -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis > -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC > -lLLVMObject -lLLVMCore -lLLVMSupport > > How do I figure out what to include to fix these? > > >-- John Criswell Assistant Professor Department of Computer Science, University of Rochester http://www.cs.rochester.edu/u/criswell
Rodney M. Bates
2014-Dec-22 17:29 UTC
[LLVMdev] How to figure out what #includes are needed?
On 12/18/2014 06:57 AM, Yaron Keren wrote:> Shouldn't -std=c++11 be there also? > >Well, that introduces a new error: ----------------------------------------------------------------------------------------------------------------------- In file included from LLVMDIBuilder.cpp:19: In file included from /usr/local/include/llvm/Support/CBindingWrapping.h:17: In file included from /usr/local/include/llvm/Support/Casting.h:18: In file included from /usr/local/include/llvm/Support/type_traits.h:22: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:70: In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_pair.h:59: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:87:5: error: conflicting types for 'forward' forward(typename std::remove_reference<_Tp>::type&& __t) noexcept ^ /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:76:5: note: previous definition is here forward(typename std::remove_reference<_Tp>::type& __t) noexcept ^ ------------------------------------------------------------------------------------------------------------------------ and doesn't change the first of those I was already getting.> 2014-12-17 5:15 GMT+02:00 Rodney M. Bates <rodney_bates at lcwb.coop <mailto:rodney_bates at lcwb.coop>>: > > This is partly an llvm question, and maybe partly C++. > > I am trying to make calls on code in the llvm infrastructure.(3.4.2) I appear > to be missing some include files, but don't know how to track them down. I get > compile errors on existing llvm header files, like the following two examples: > ------------------------------__------------------------------__-------------------- > > In file included from LLVMDIBuilder.cpp:16: > In file included from /usr/local/include/llvm/__Support/CBindingWrapping.h:17: > In file included from /usr/local/include/llvm/__Support/Casting.h:18: > In file included from /usr/local/include/llvm/__Support/type_traits.h:22: > In file included from /usr/lib/gcc/x86_64-linux-gnu/__4.8/../../../../include/c++/4.__8/utility:70: > In file included from /usr/lib/gcc/x86_64-linux-gnu/__4.8/../../../../include/c++/4.__8/bits/stl_pair.h:59: > /usr/lib/gcc/x86_64-linux-gnu/__4.8/../../../../include/c++/4.__8/bits/move.h:185:5: error: conflicting types for 'swap' > swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) > ^ > /usr/lib/gcc/x86_64-linux-gnu/__4.8/../../../../include/c++/4.__8/bits/move.h:166:5: note: previous definition is here > swap(_Tp& __a, _Tp& __b) > > ------------------------------__------------------------------__-------------------- > In file included from LLVMDIBuilder.cpp:16: > In file included from /usr/local/include/llvm/__Support/CBindingWrapping.h:17: > In file included from /usr/local/include/llvm/__Support/Casting.h:18: > /usr/local/include/llvm/__Support/type_traits.h:48:33: error: functions that differ only in their return type cannot be overloaded > template<typename T> double is_class_helper(...); > ^ > /usr/local/include/llvm/__Support/type_traits.h:47:31: note: previous declaration is here > template<typename T> char is_class_helper(void(T::*)()); > ^ > ------------------------------__------------------------------__-------------------- > > Obviously, these files compile when included by the normal llvm build > process. I have gotten many previous similar errors to go away by rote copying > in of all the #include lines in the full code listing in the new Kaleidoscope > Chapter 8 example and all those in core.cpp, but many more remain. > > I would have expected missing declarations from missing include files to > give error messages like "undeclared identifier", but the effect seems to > be to make types that look different be the same, and vice versa (but > apparently not different enough to be legal overloads?). > > My command line is: > > clang++ -g LLVMDIBuilder.cpp `llvm-config --cxxflags --libs all` > > $lvm-config --cxxflags --libs all > -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual > -lLLVMInstrumentation -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfo -lLLVMOption -lLLVMLTO -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter -lLLVMBitReader -lLLVMTableGen -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassem! > bler -lLLV > MAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInterpreter -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport > > How do I figure out what to include to fix these? > > > > -- > Rodney Bates > rodney.m.bates at acm.org <mailto:rodney.m.bates at acm.org> > _________________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/__mailman/listinfo/llvmdev <http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >-- Rodney Bates rodney.m.bates at acm.org
Rodney M. Bates
2014-Dec-22 17:48 UTC
[LLVMdev] How to figure out what #includes are needed?
On 12/18/2014 09:23 AM, John Criswell wrote:> On 12/16/14, 10:15 PM, Rodney M. Bates wrote: >> This is partly an llvm question, and maybe partly C++. >> >> I am trying to make calls on code in the llvm infrastructure.(3.4.2) I appear >> to be missing some include files, but don't know how to track them down. I get >> compile errors on existing llvm header files, like the following two examples: > > My recommendation is to look at the header files that define the classes and methods that you're using in LLVM. The easiest way to do this is to use doxygen. > > For example, if I'm using the Function class, I look at the doxygen page at: > > http://llvm.org/doxygen/classllvm_1_1Function.html > > That page tells me that the class definition is in Function.h. I look for Function.h and (in LLVM 3.2) it exists in: > > llvm/Function.h. > > As you write more LLVM code, it becomes easier to find header files as you'll get more accustomed to the source code. > > Regards, > > John Criswell > >This process will help me in other situations, where I have a use of an undeclared identifier and need to find the relevant declaration. In this case, nothing is undeclared. Instead, something is wrong with the way the types are used. The only identifiers involved in the conflicting type signatures are _Tp and _Nm, both declared very nearby as typename template parameters. The only reason for my theory that missing include files are involved is that this entire transitive include path compiled without error when I built llvm. For example, CBindingWrapping is included by lib/IR/Core.cpp, and I have a Core.o in my build directory (and have linked an external project to it and executed calls on a couple of functions therein.) The problem code itself is in my locally installed c++ libraries, but again, it compiled before. I do not know enough C++ to figure out how these two functions could be legal overloads in one context and not in another. The last standard I had any familiarity with was 98.>> -------------------------------------------------------------------------------- >> >> In file included from LLVMDIBuilder.cpp:16: >> In file included from /usr/local/include/llvm/Support/CBindingWrapping.h:17: >> In file included from /usr/local/include/llvm/Support/Casting.h:18: >> In file included from /usr/local/include/llvm/Support/type_traits.h:22: >> In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/utility:70: >> In file included from /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_pair.h:59: >> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:185:5: error: conflicting types for 'swap' >> swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) >> ^ >> /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/move.h:166:5: note: previous definition is here >> swap(_Tp& __a, _Tp& __b) >> >> -------------------------------------------------------------------------------- >> In file included from LLVMDIBuilder.cpp:16: >> In file included from /usr/local/include/llvm/Support/CBindingWrapping.h:17: >> In file included from /usr/local/include/llvm/Support/Casting.h:18: >> /usr/local/include/llvm/Support/type_traits.h:48:33: error: functions that differ only in their return type cannot be overloaded >> template<typename T> double is_class_helper(...); >> ^ >> /usr/local/include/llvm/Support/type_traits.h:47:31: note: previous declaration is here >> template<typename T> char is_class_helper(void(T::*)()); >> ^ >> -------------------------------------------------------------------------------- >> >> Obviously, these files compile when included by the normal llvm build >> process. I have gotten many previous similar errors to go away by rote copying >> in of all the #include lines in the full code listing in the new Kaleidoscope >> Chapter 8 example and all those in core.cpp, but many more remain. >> >> I would have expected missing declarations from missing include files to >> give error messages like "undeclared identifier", but the effect seems to >> be to make types that look different be the same, and vice versa (but >> apparently not different enough to be legal overloads?). >> >> My command line is: >> >> clang++ -g LLVMDIBuilder.cpp `llvm-config --cxxflags --libs all` >> >> $lvm-config --cxxflags --libs all >> -I/usr/local/include -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual >> -lLLVMInstrumentation -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfo -lLLVMOption -lLLVMLTO -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter -lLLVMBitReader -lLLVMTableGen -lLLVMR600CodeGen -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMHexagonCodeGen -lLLVMHexagonAsmPrinter -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassem! >> bler -lLLV >> MAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCDisassembler -lLLVMMCParser -lLLVMInterpreter -lLLVMMCJIT -lLLVMJIT -lLLVMCodeGen -lLLVMObjCARCOpts -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMExecutionEngine -lLLVMTarget -lLLVMMC -lLLVMObject -lLLVMCore -lLLVMSupport >> >> How do I figure out what to include to fix these? >> >> >> > >-- Rodney Bates rodney.m.bates at acm.org