I'm running FreeBSD 9.2-RELEASE, installed the devel/libc++ port and tried to compile the following program
using
Note: I had to specify the include and library search paths because this is where devel/libc++ was installed, whereas clang searches the /usr/include/c++/v1 and /usr/lib by default.
I get the following link errors:
I found this 2-year old question with a similar problem, albeit unrelated to FreeBSD. It mentions libc++abi library, which I couldn't find in the ports.
Is it possible to use clang with libc++? How?
Thanks.
Code:
#include <type_traits>
int main() {
try { throw 0; } catch(int) {}
}
clang++ -stdlib=libc++ -I /usr/local/include/c++/v1 -L /usr/local/lib test.cpp
.Note: I had to specify the include and library search paths because this is where devel/libc++ was installed, whereas clang searches the /usr/include/c++/v1 and /usr/lib by default.
I get the following link errors:
Code:
/tmp/test-oHEkZb.o: In function `main':
test.cpp:(.text+0xe): undefined reference to `__cxa_allocate_exception'
test.cpp:(.text+0x1b): undefined reference to `typeinfo for int'
test.cpp:(.text+0x23): undefined reference to `__cxa_throw'
test.cpp:(.text+0x4a): undefined reference to `__cxa_begin_catch'
test.cpp:(.text+0x54): undefined reference to `__cxa_end_catch'
[...]
I found this 2-year old question with a similar problem, albeit unrelated to FreeBSD. It mentions libc++abi library, which I couldn't find in the ports.
Is it possible to use clang with libc++? How?
Thanks.