[cfe-dev] clang finds errors in its own header files

Mehdi Amini via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 23 18:15:10 PST 2016


This is libLLVMDemangle.a

You should be able to find these dependency yourself by using nm on the various lib.

But if you’re trying to interact with LLVM, you should try to use llvm-config to get the right flags: http://llvm.org/docs/CommandGuide/llvm-config.html

— 
Mehdi


> On Dec 23, 2016, at 6:04 PM, paul via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> 
> My latest compile result:
> 
> Undefined symbols for architecture x86_64:
>   "llvm::itaniumDemangle(char const*, char*, unsigned long*, int*)", referenced from:
>       llvm::sys::PrintStackTrace(llvm::raw_ostream&) in libLLVMSupport.a(Signals.cpp.o)
>   "_del_curterm", referenced from:
>       llvm::sys::Process::FileDescriptorHasColors(int) in libLLVMSupport.a(Process.cpp.o)
>   "_set_curterm", referenced from:
>       llvm::sys::Process::FileDescriptorHasColors(int) in libLLVMSupport.a(Process.cpp.o)
>   "_setupterm", referenced from:
>       llvm::sys::Process::FileDescriptorHasColors(int) in libLLVMSupport.a(Process.cpp.o)
>   "_tigetnum", referenced from:
>       llvm::sys::Process::FileDescriptorHasColors(int) in libLLVMSupport.a(Process.cpp.o)
> ld: symbol(s) not found for architecture x86_64
> 
> Thanks for all the help
> 
> Paul
> 
> 
> 
> On 2016-12-23 9:43 PM, Mehdi Amini wrote:
>> Remove the .a
>> 
>> (And keep discussions on the mailing list).
>> 
>>>> Mehdi
>> 
>>> On Dec 23, 2016, at 5:14 PM, icloud <pesurette at icloud.com <mailto:pesurette at icloud.com>> wrote:
>>> 
>>> This is the complete command line for ld:
>>> 
>>> "/usr/bin/ld" -demangle -lto_library /usr/local/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -o test -L/usr/local/lib -lc++ -lLLVMSupport.a /var/folders/nz/0n84ymfx40z5jr0mk9b58q240000gn/T/main-72e08e.o -lSystem /usr/local/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a
>>> ld: library not found for -lLLVMSupport.a
>>> 
>>> The library is in usr/local/lib. I have even added -L/usr/local/lib to the command line but the error persists.
>>> 
>>> Thanks for your efforts
>>> 
>>> Paul
>>> 
>>> 
>>> 
>>> On 2016-12-23 9:05 PM, Mehdi Amini wrote:
>>>> What does this print:  nm libLLVMSupport.a | grep ABIBreaking
>>>> 
>>>>>>>> Mehdi
>>>> 
>>>>> On Dec 23, 2016, at 5:03 PM, icloud <pesurette at icloud.com <mailto:pesurette at icloud.com>> wrote:
>>>>> 
>>>>> Thanks Mehdi,
>>>>> 
>>>>> This gets me much closer to success :)
>>>>> 
>>>>> However I am still getting 1 unresolved symbol: llvm::DisableABIBreakingChecks
>>>>> 
>>>>> Any further thoughts?
>>>>> 
>>>>> 
>>>>> Thanks again for your help
>>>>> 
>>>>> Paul
>>>>> 
>>>>> 
>>>>> On 2016-12-23 8:44 PM, Mehdi Amini wrote:
>>>>>> You need to link to libLLVMSupport.a.
>>>>>> 
>>>>>>>>>>>> Mehdi
>>>>>> 
>>>>>>> On Dec 23, 2016, at 2:16 PM, icloud via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>>>>>>> 
>>>>>>> Thanks Nathan.
>>>>>>> 
>>>>>>> After adding -stdlib=libc++ I get:
>>>>>>> 
>>>>>>> Pauls-iMac:build paul$ clang-4.0 -std=c++11 -stdlib=libc++ -v ../src/main.cpp
>>>>>>> clang version 4.0.0 (https://github.com/llvm-mirror/clang.git <https://github.com/llvm-mirror/clang.git> d018ab0a692bb12b9b88a24555354d81cdb779dc) (https://github.com/llvm-mirror/llvm.git <https://github.com/llvm-mirror/llvm.git> 4b0e4b53984a098911fd68282e1b6e87e4c77f48)
>>>>>>> Target: x86_64-apple-darwin16.1.0
>>>>>>> Thread model: posix
>>>>>>> InstalledDir: /usr/local/bin
>>>>>>> "/usr/local/bin/clang-4.0" -cc1 -triple x86_64-apple-macosx10.12.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu penryn -target-linker-version 274.1 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /usr/local/bin/../lib/clang/4.0.0 -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/paul/Temp/test/build -ferror-limit 19 -fmessage-length 187 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.12.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/nz/0n84ymfx40z5jr0mk9b58q240000gn/T/main-315802.o -x c++ ../src/main.cpp
>>>>>>> clang -cc1 version 4.0.0 based upon LLVM 4.0.0svn default target x86_64-apple-darwin16.1.0
>>>>>>> ignoring nonexistent directory "/usr/include/c++/v1"
>>>>>>> #include "..." search starts here:
>>>>>>> #include <...> search starts here:
>>>>>>> /usr/local/bin/../include/c++/v1
>>>>>>> /usr/local/include
>>>>>>> /usr/local/bin/../lib/clang/4.0.0/include
>>>>>>> /usr/include
>>>>>>> /System/Library/Frameworks (framework directory)
>>>>>>> /Library/Frameworks (framework directory)
>>>>>>> End of search list.
>>>>>>> "/usr/bin/ld" -demangle -lto_library /usr/local/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -macosx_version_min 10.12.0 -o a.out /var/folders/nz/0n84ymfx40z5jr0mk9b58q240000gn/T/main-315802.o -lSystem /usr/local/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a
>>>>>>> Undefined symbols for architecture x86_64:
>>>>>>>  "llvm::DisableABIBreakingChecks", referenced from:
>>>>>>>      llvm::VerifyDisableABIBreakingChecks in main-315802.o
>>>>>>> ld: symbol(s) not found for architecture x86_64
>>>>>>> clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
>>>>>>> 
>>>>>>> 
>>>>>>> Thanks again
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> On 2016-12-23 6:10 PM, Nathan Froyd wrote:
>>>>>>>> You may want to try adding -stdlib=libc++ to your command line.
>>>>>>>> 
>>>>>>>> -Nathan
>>>>>>>> 
>>>>>>>> On Fri, Dec 23, 2016 at 4:57 PM, paul via cfe-dev
>>>>>>>> <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>> wrote:
>>>>>>>>> Hi James,
>>>>>>>>> 
>>>>>>>>> Thanks,
>>>>>>>>> 
>>>>>>>>> I do include the -std=c++11 as a habit.
>>>>>>>>> 
>>>>>>>>> I have been trying all afternoon to get this to work.
>>>>>>>>> 
>>>>>>>>> I am wondering now if there is a step missing which describes the target OS?
>>>>>>>>> Xcode links to a number of SDK's when producing OS X Bundles ( test.app ).
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 2016-12-23 5:43 PM, James Dennett wrote:
>>>>>>>>> 
>>>>>>>>> On Fri, Dec 23, 2016 at 1:40 PM, icloud via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>>
>>>>>>>>> wrote:
>>>>>>>>>> Hi Don,
>>>>>>>>>> 
>>>>>>>>>> I removed the extra "-I" directives but I still get the same result.
>>>>>>>>> This looks somewhat different to me.
>>>>>>>>> 
>>>>>>>>>> In file included from /usr/local/include/llvm/ADT/APInt.h:20:
>>>>>>>>>> /usr/local/include/llvm/Support/MathExtras.h:248:1: error: unknown type
>>>>>>>>>> name 'constexpr'
>>>>>>>>>> constexpr inline uint32_t Hi_32(uint64_t Value) {
>>>>>>>>> You need to specify -std=c++11 (or later) as a compiler option to get
>>>>>>>>> `constexpr` support.  You probably want to do that anyway.
>>>>>>>>> 
>>>>>>>>> -- James
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> --
>>>>>>>>> 
>>>>>>>>> Paul
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> _______________________________________________
>>>>>>>>> cfe-dev mailing list
>>>>>>>>> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>>>>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>>>>>>>>> 
>>>>>>> -- 
>>>>>>> 
>>>>>>> Paul
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> cfe-dev mailing list
>>>>>>> cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>
>>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>>>>> -- 
>>>>> 
>>>>> Paul
>>>>> 
>>> 
>>> -- 
>>> 
>>> Paul
>> 
> 
> -- 
> 
> Paul
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161223/a5a897c5/attachment.html>


More information about the cfe-dev mailing list