I'm using some LLVM static libs and boost::program_options in my test app. The problem is that source code that uses LLVM libs should be compiled with -fno-rtti (llvm-config -cxxflags return it in output
$ ./llvm-config --cxxflags
-I/Users/user/Documents/dev/src/llvm/installed_local/include -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fvisibility-inlines-hidden -fno-exceptions -fno-rtti -fno-common -Woverloaded-virtual -Wcast-qual
) but boost::program_options requires RTTI via boost::any:
/softdev/boost-1.56/include/boost/any.hpp:149:48: error: cannot use typeid with -fno-rtti
return content ? content->type() : typeid(void);
Compile cmd for my app:
clang++ `${LLVM_BIN}/llvm-config --cxxflags` -I${LLVM_INCLUDE} -I${CLANG_INCLUDE} -I/softdev/boost-1.56/include -c ./lib_linker.cpp -o ./lib_linker_x86_64.o
What should i do in order to compile my app?
PS. The same problem with exceptions - LLVM turns off exceptions with -fno-exceptions but program_options requires them:
/softdev/boost-1.56/include/boost/program_options/value_semantic.hpp:355:20: error: cannot use typeid with -fno-rtti
return typeid(T);
-fexceptionto compile your own project at all, simply remove/replace-fno-exceptionwill be enough; a library is compiled w/o exception has no influence on your client code. for rtti, i guess most of the time you still don't use rtti for llvm Objects. You might need some scripts to handle cxxflags string manipulation.