Llvm_clang doesn't find standard headers by default

Out of the box, Haiku nightly’s llvm_clang package appears to be unaware of the locations of the standard C/C++ headers, such as iostream and bits/c++config.h, causing clang++ builds to fail.


#include <iostream>
using std::cout;

int main() {
  cout << "Hello World!\n";
  return 0;


$ clang++ -o hello hello.cpp 
hello.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
1 error generated.

As a workaround, I am manually adding the include paths:

$ clang++ -o hello -I /boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/include/c++ -I /boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/5.4.0/include/c++/x86_64-unknown-haiku hello.cpp 
$ ./hello 
Hello World!


In Haiku nightly x86, the llvm_x86_clang package fails to inform its clang++ binary of yet another location, for things like float.h in /boot/system/lib/x86/clang/5.0.0/include. :stuck_out_tongue:

Yes, I recall complaining about this to whoever maintained the clang package some years ago, and apparently they never fixed it…

1 Like

If anyone stumbles upon this thread, since at least R1Beta2 you want to install gcc_syslibs_devel