[llvm-dev] Cross compiling C++ program

Goran Mekić via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 2 16:28:46 PDT 2017


Hello,

As a newcomer to the libcxx implementation, I'll probably ask a silly question, but why following example can be compiled natively, but not cross compiled?

#include <cstdlib>
using ::atof;
int main() {
  return 0;
}

Native compile: clang++ -o example example.cpp
Cross compile: clang++ -fno-builtin -fno-exceptions -fcheck-new -nostdlib -ffreestanding -target arm-none-eabi -march=armv7-m -mcpu=cortex-m4 -Wall -Wshadow -Wundef -g -Os -fno-strict-aliasing -fomit-frame-pointer -mcpu=cortex-m4 -mthumb -mfloat-abi=soft -stdlib=libc++ -o example example.cpp

Error I get:
In file included from example.cpp:1:
In file included from /usr/include/c++/v1/cstdlib:85:
/usr/include/c++/v1/__config:938:4: error: "No thread API"
#  error "No thread API"
   ^
1 error generated.


Without -stdlib=libc++ I get this error:
example.cpp:1:10: fatal error: 'cstdlib' file not found
#include <cstdlib>
         ^~~~~~~~~
1 error generated.

My OS is FreeBSD 11.1 and Clang version is 4.0.0. What am I not understanding well enough and could you recommend reading something on the topic? Any help is welcome! Thank you!

Regards,
meka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170803/af89c86c/attachment.sig>


More information about the llvm-dev mailing list