[cfe-dev] libcxx install location?

Jean-Daniel Dupas devlists at shadowlab.org
Sat Feb 5 07:09:36 PST 2011


Le 5 févr. 2011 à 15:05, Larry Evans a écrit :

> On 02/05/11 07:52, Jean-Daniel Dupas wrote:
>> 
>> Le 5 févr. 2011 à 14:26, Larry Evans a écrit :
> [snip]
>>> Am I missing something?
>> 
>> I don't have access to my linux machine right now, so I cannot test, but I think you can link on libstdc++ to get the missing symbols (just adding -lstdc++ to the linker flags should be enough).
>> 
>> It should not conflict with libc++ symbols as libc++ uses inline namespace, and so mangle the standard symbols differently than the libstdc++.
>> 
>> This is what we use to do on OS X before we got a separate libc++abi library.
>> 
>> -- Jean-Daniel
> 
> Thanks Jean; however, I'm getting the same error:

OK. In fact, you have to add this flag to the libc++ LDFLAGS (in buildit script).
Make sure to also add -std=c++0x  to the cflags to enable latest clang enhancements.

    EXTRA_FLAGS="-std=c++0x"
    LDSHARED_FLAGS="-o libc++.so.1.0 \
        -shared -nodefaultlibs -Wl,-soname,libc++.so.1 \
        -lpthread -lrt -lc -lstdc++"


As the library soname is libc++.so.1, you have to create a /usr/lib/libc++.so.1 symlink that point to the library. Else you will get a "library not found" runtime error.

After theses changes, I was able to compile a simple hello world program.

--------- hello.cpp
#include <iostream>

int main (int argc, char * const argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    return 0;
}
------------------------

Unfortunalty, this simple code does not run properly. It prints "Hello World", and then a lot of garbage (and sometimes segfault too).

But this may be a good base to start hacking on libc++.


-- Jean-Daniel




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


More information about the cfe-dev mailing list