[cfe-dev] STL from libcxx looks for libc?

salvatore benedetto salvatore.benedetto at gmail.com
Sun Jul 22 23:59:14 PDT 2012


On Sun, Jul 22, 2012 at 11:09 PM, Howard Hinnant <hhinnant at apple.com> wrote:
> On Jul 22, 2012, at 5:01 PM, salvatore benedetto <salvatore.benedetto at gmail.com> wrote:
>
>> I'm developing on a bare-metal cortex-m3 in C++ for fun and profit.
>>
>> I recently decided to switch from GCC to clang.
>>
>> I managed to set-up clang for cross-compiling for thumb2 (thanks to the
>> guys on llvm-dev mailing list).
>>
>> Since I also needed to use the list container from STL, I installed libcxx.
>>
>> I thought that as long as I give my own allocator, I shouldn't get anything
>> else more the what I use.
>>
>> The compiler does find the library, but I get the following error
>>
>> In file included from /home/emitrax/bin/llvm/lib/c++/v1/list:177:
>> In file included from /home/emitrax/bin/llvm/lib/c++/v1/algorithm:596:
>> /home/emitrax/bin/llvm/lib/c++/v1/cstdlib:96:9: error: no member named
>> 'lldiv_t' in the global namespace
>> using ::lldiv_t;
>>
>> etc...
>>
>> I don't understand why it uses the cstdlib in the first place?
>>
>> The symbol is declared in stdlib.h (that's what I get from man lldiv_t).
>> Is there some header inclusion missing?
>
> <cstdlib> includes <stdlib.h>.
>
> I believe <algorithm> could change <cstdlib> to <cstddef> and be fine.  It needs size_t. I suspect I originally included <cstdlib> to use rand, but random_shuffle has since changed to use the technology in <random>.
>
> I'll put the switch from <cstdlib> to <cstddef> on my to-do list.  Should be easy, I just need to retest.

That seem to worked. Thanks.

I tried to run the tests under

llvm/projects/libcxx/test$ ./testit

but it couldn't find the libcxx when linking.

/usr/bin/ld: cannot find -lc++

that's another problem I need to fix. Currently I worked around
the header inclusion problem by using -I$(explicit_installation_path).

S.



More information about the cfe-dev mailing list