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

Mehdi Amini via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 23 16:44:17 PST 2016


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> 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 d018ab0a692bb12b9b88a24555354d81cdb779dc) (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> 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>
>>> 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
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>> 
> 
> -- 
> 
> Paul
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list