Configure error on Solaris 10

Hello,
I get the following error while trying to configure an llvm build on Solaris 10-SPARC:

CMake Error at projects/libcxx/CMakeLists.txt:268 (message):
C++11 is required but the compiler does not support -std=c++11

However, the error is about a missing header file (llvm/Support/Solaris.h) as reported in build/CMakeFiles/CMakeError.log:

Performing C++ SOURCE FILE Test LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG failed with the following output:
Change Dir: /export/home/netrac_fam/gtk3/src/bllvm/build/CMakeFiles/CMakeTmp
Run Build Command:“/usr/sfw/bin/gmake” “cmTC_67861/fast”
/usr/sfw/bin/gmake -f CMakeFiles/cmTC_67861.dir/build.make CMakeFiles/cmTC_67861.dir/build
gmake[1]: Entering directory /export/home/netrac_fam/gtk3/src/bllvm/build/CMakeFiles/CMakeTmp' Building CXX object CMakeFiles/cmTC_67861.dir/src.cxx.o /export/home/netrac_fam/gtk3/bin/g++ -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strin gs -Wcast-qual -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -std=c++11 -fdata-sections -include llvm/Support/Solaris.h -DLIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG -s td=c++11 -o CMakeFiles/cmTC_67861.dir/src.cxx.o -c /export/home/netrac_fam/gtk3/src/bllvm/build/CMakeFiles/CMakeT mp/src.cxx cc1plus: fatal error: llvm/Support/Solaris.h: No such file or directory compilation terminated. gmake[1]: *** [CMakeFiles/cmTC_67861.dir/src.cxx.o] Error 1 gmake[1]: Leaving directory /export/home/netrac_fam/gtk3/src/bllvm/build/CMakeFiles/CMakeTmp’
gmake: *** [cmTC_67861/fast] Error 2
Source file was:
int main() { return 0; }

What would be the proper way to add an include path, something like “-I/src” so that g++ can find llvm/Solaris.h whose full path would be /src/llvm/Solaris.h?

Thanks,
Oscar.

I am not sure that clang/llvm will build out-of-the-box on Solaris 10.
At least not without some major interventions.

Which version of GCC is this?

Solaris 11 shouldn't be that much work, if any, except for that the OP
mentioned SPARC. Even if using a gcc which supports c++11, libc++ may be an
obstacle because it needs some stuff (libc/system headers) which wasn't
added until Solaris 11. (I can look in my notes for exactly what if needed)

The OP explicitly stated Solaris 10. Not Solaris 11, or any other
version of Solaris.

As per my email - I was indirectly letting him know that Solaris 10 likely
doesn't have everything he needs. (Was my email really that unclear?) There
are potential "hacks" which may not be too much work and "acceptable"
work-around. (I'd need to double check) Like can he live with hard coded C
LOCALES..

I'm adding Eric on cc - he'll know how much libc++ stuff is tied to system
specifics for c++11.

I have no idea if it would be feasible (ABI compat), but there's the other
option to leverage the gcc STL like is done on x86 Linux.

Hi Stefan,

Yes, it does not build out of the box on Solaris 10.

It’s GCC 5.4.0. I made it past cmake with this command line:

LD_LIBRARY_PATH=/export/home/netrac_fam/gtk3/lib:$LD_LIBRARY_PATH cmake -G ‘Unix Makefiles’ -DCMAKE_INSTALL_PREFIX=/export/home/netrac_fam/gtk3 -DCMAKE_CXX_COMPILER=/export/home/netrac_fam/gtk3/bin/g++ -DCMAKE_C_COMPILER=/export/home/netrac_fam/gtk3/bin/gcc -DCMAKE_C_FLAGS=‘-mcpu=v9 -I/export/home/netrac_fam/gtk3/include’ -DCMAKE_CXX_FLAGS=‘-mcpu=v9 -I/export/home/netrac_fam/gtk3/include -I/export/home/netrac_fam/gtk3/src/llvm/include’ -DCMAKE_EXE_LINKER_FLAGS=‘-L/export/home/netrac_fam/gtk3/lib -R/export/home/netrac_fam/gtk3/lib’ /export/home/netrac_fam/gtk3/src/llvm

Then, I did a quick and dirty replacement because of incompatible ld flags:

find ./ -name link.txt -exec perl -pi -e ‘s/-Wl,-z -Wl,discard-unused=sections/-Wl,-z,ignore/g’ {} ;

Now, gmake gets stuck with this error (missing xlocale.h):

[ 13%] Linking CXX executable …/…/bin/not
gmake[2]: *** [projects/libcxx/lib/CMakeFiles/cxx.dir/__/src/support/solaris/xlocale.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs…
[ 13%] Built target obj.clang-tblgen
[ 13%] Linking CXX static library …/libLLVMMC.a
In file included from /export/home/netrac_fam/gtk3/src/llvm/projects/libcxx/include/ios:216:0,
from /export/home/netrac_fam/gtk3/src/llvm/projects/libcxx/include/ostream:138,
from /export/home/netrac_fam/gtk3/src/llvm/projects/libcxx/include/__std_stream:15,
from /export/home/netrac_fam/gtk3/src/llvm/projects/libcxx/src/iostream.cpp:10:
/export/home/netrac_fam/gtk3/src/llvm/projects/libcxx/include/__locale:33:22: fatal error: xlocale.h: No such file or directory

g++ is able to find the xlocale.h under projects/libcxx/projects/include, but it seems that another xlocale.h is required as well (maybe one that ships with Solaris 11?)

Thanks,
Oscar.