<div dir="ltr"><div><div><div><div>Hi Jonathan,<br><br></div>After some try-and-error, now I can compile the libcxxabi from [1].  I need some patch [2] to build it properly, and here's [3] my build script.<br><br></div>
However, I feel that there are still several works to be done if we wish to use [1].  From my test result, it seems that 24 tests (out of 32 tests) are failing, and it seems that some changes cause some regression on x86_64.<br>
<br></div>IMO, maybe we can focus on my patch first?  Although, it still relies on the unwinding facilities from libgcc, I feel that we can replace them step-by-step.  And fortunately, it seems that most of your work are focusing on the language-independent unwinding library which is orthogonal to my changes.  Once the language-independent unwinding library is complete, we can ifdef (or remove) the function call to libgcc.  Does this plan sound reasonable?  Thanks.<br>
<br></div>Sincerely,<br>Logan<br><br>[1] <a href="https://github.com/awong-dev/ndk/tree/use-libc++abi/sources/cxx-stl/llvm-libc++abi/libcxxabi">https://github.com/awong-dev/ndk/tree/use-libc++abi/sources/cxx-stl/llvm-libc++abi/libcxxabi</a><br>
[2] <a href="https://github.com/loganchien/libcxxabi/commits/awong-dev-ndk">https://github.com/loganchien/libcxxabi/commits/awong-dev-ndk</a><br>[3] <a href="https://github.com/loganchien/libcxx-scripts/commits/awong-dev-ndk">https://github.com/loganchien/libcxx-scripts/commits/awong-dev-ndk</a><br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 17, 2014 at 1:05 AM, Jonathan Roelofs <span dir="ltr"><<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Logan,<br>
<br>
I've been building it for bare-metal ARM using clang (with patches that haven't been upstreamed yet), but the process should be similar for an arm-linux-gnu target, assuming you want to make a static library out of it:<br>

<br>
Compile all the *.cpp files with:<br>
clang++ -target $TRIPLE --sysroot=/path/to/your/<u></u>targets/sysroot -funwind-tables -std=c++11 -stdlib=libc++ -fstrict-aliasing -Wstrict-aliasing=2 -Wsign-conversion -Wshadow -Wconversion -Wunused-variable -Wmissing-field-initializers -Wchar-subscripts -Wmismatched-tags -Wmissing-braces -Wshorten-64-to-32 -Wsign-compare -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wnewline-eof<br>

<br>
And similarly, all the *.c files with:<br>
clang -target $TRIPLE --sysroot=/path/to/your/<u></u>targets/sysroot -funwind-tables -std=c11 -fstrict-aliasing -Wstrict-aliasing=2 -Wsign-conversion -Wshadow -Wconversion -Wunused-variable -Wmissing-field-initializers -Wchar-subscripts -Wmismatched-tags -Wmissing-braces -Wshorten-64-to-32 -Wsign-compare -Wstrict-aliasing=2 -Wstrict-overflow=4 -Wunused-parameter -Wnewline-eof<br>

<br>
On bare-metal, I also build the unwinder's *.c,*.cpp, and *.S files, but on linux you'll want to skip that step.<br>
<br>
Finally, archive all the *.o files into a static libarary with ar, and ranlib. At link time, you'll need to pull in -lgcc_s (which is for the unwinder).<br>
<br>
I can share my modifications to the buildit & testit scripts if you think they would be useful to you.<br>
<br>
<br>
As for __USING_SJLJ_EXCEPTIONS__, I checked and it is indeed a compiler builtin for both clang and gcc. __ARM_EABI_UNWINDER__ does not seem to be, and I don't see anything nearby to where I found the SJLJ one that would indicate what we want.  I think the right thing to check for here is:<br>

  #if __arm__ && !defined(__USING_SJLJ_<u></u>EXCEPTIONS__)<br>
<br>
<br>
Cheers,<br>
Jon<div class=""><br>
<br>
On 4/16/14, 5:11 AM, Logan Chien wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
Hi all,<br>
<br>
Sorry for the typo.<br>
<br>
I was trying to build and test libc++abi from [1] but failed.  I have tried to<br>
build the library by compiling all the *.cpp and *.c, but it seems not working.<br>
May you provide some instructions to build it?<br>
<br>
BTW, I agree with Jonathan.  It seems that __ARM_EABI_UNWINDER__ is not<br>
pre-defined.<br>
I am not sure for __USING_SJLJ_EXCEPTIONS__ at the moment.  I will check out ASAP.<br>
<br>
Logan<br>
<br>
[1]:<br>
<a href="https://github.com/awong-dev/ndk/tree/use-libc%2B%2Babi/sources/cxx-stl/llvm-libc%2B%2Babi/libcxxabi" target="_blank">https://github.com/awong-dev/<u></u>ndk/tree/use-libc%2B%2Babi/<u></u>sources/cxx-stl/llvm-libc%2B%<u></u>2Babi/libcxxabi</a><br>

[2] <a href="http://www.sourceware.org/ml/libc-alpha/2004-02/msg00138.html" target="_blank">http://www.sourceware.org/ml/<u></u>libc-alpha/2004-02/msg00138.<u></u>html</a><br>
<br>
<br>
On Wed, Apr 16, 2014 at 7:58 PM, Logan Chien <<a href="mailto:tzuhsiang.chien@gmail.com" target="_blank">tzuhsiang.chien@gmail.com</a><br></div><div class="">
<mailto:<a href="mailto:tzuhsiang.chien@gmail.com" target="_blank">tzuhsiang.chien@gmail.<u></u>com</a>>> wrote:<br>
<br>
    Hi Jonathan and Nick,<br>
<br>
    I was trying to build libc++abi from repository but failed.  May you provide<br>
    some instruction to cross compile libc++abi for ARM Linux?  Thanks.<br>
<br>
    Logan<br>
<br>
<br>
    On Tue, Apr 15, 2014 at 5:23 AM, Jonathan Roelofs <<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a><br></div>
    <mailto:<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.<u></u>com</a>>> wrote:<br>
<br>
</blockquote><div class="HOEnZb"><div class="h5">
<br>
-- <br>
Jon Roelofs<br>
<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a><br>
CodeSourcery / Mentor Embedded<br>
</div></div></blockquote></div><br></div>