Re: Errors linking against libLLVMCore
Re: Errors linking against libLLVMCore
- Subject: Re: Errors linking against libLLVMCore
- From: Rick Mann <email@hidden>
- Date: Wed, 26 Dec 2012 19:27:50 -0800
On Dec 26, 2012, at 9:17 , Glenn L. Austin <email@hidden> wrote:
> The compiler will automatically create the proper template instantiation of the specified STL class at compile-time, and if it can't do that it will simply create an external reference that needs to be resolved later (like other "normal" symbols).
>
> The problem is that, with STL, those symbols don't exist in a library until you've instantiated them at least once. Since the compiler does that for you when STL classes are defined, and those instantiations are generally local to the module (file) that is being compiled, they don't exist in any library file.
>
> If you use STL, think of C++ templates as just instructions to the compiler to write code for you (which, essentially, it is doing) with the specified types defined when needed. A template class doesn't actually exist until all of the types are defined for the usage, and then the compiler does the work of writing that code for you for that module. If the compiler doesn't have all of the instructions for writing that code -- such as when you use stringfwd instead of string -- then the compiler will fall back to its default behavior of assuming that the code will be elsewhere, and you'll get linker errors.
Well, that sure sounds like it would make using a library that depended on STL very difficult.
I think this is down to some differences in how clang is invoked for compilation and linking. The example I'm basing my usage off is is the Kaleidoscope Tutorial part 3. Note the build invocation, a single call to clang++:
http://llvm.org/docs/tutorial/LangImpl3.html#full-code-listing
I've posted some of the differences:
http://pastebin.com/n9nCat15
Using -### to see flags to -cc1:
http://pastebin.com/kufBknaw
Still don't know what's causing it.
--
Rick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden