DennisOSRM/Project-OSRM — Issue #117: LLVM clang++ support
Author: DennisOSRM
Created: 2012-02-13 15:39:09+00:00
State: open
Labels: Feature Request

This is a meta ticket to work on building OSRM with clang++. It seems to work with llvm 2.9, but the generated binary seem to be about 5-10% slower compared to GCC 4.6.

# Things to investigate:
- LLVM 3.0
- clang++ specific optimization switches
- Get the static code analysis of LLVM to work on a daily build

```
scons --cxx=clang++
scons: Reading SConscript files ...
Using user supplied C++ Compiler: clang++
Checking for C header file omp.h... (cached) yes
Checking for C++ library bz2... yes
Checking for C++ library png... yes
Checking for C++ library pthread... yes
Checking for C++ library protobuf... yes
Checking for Protobuffer version >= 2.3.0... yes
Checking for C++ library stxxl... yes
Checking for C++ library xml2... yes
Checking for C++ library z... yes
Checking for C++ library zip... yes
Checking for Boost version >= 1.41... yes
Checking for C++ library boost_system... yes
Checking for C++ library boost_thread... yes
Checking for C++ library boost_regex... yes
Checking for C++ header file boost/array.hpp... yes
Checking for C++ header file boost/asio.hpp... yes
Checking for C++ header file boost/bind.hpp... yes
Checking for C++ header file boost/enable_shared_from_this.hpp... yes
Checking for C++ header file boost/foreach.hpp... yes
Checking for C++ header file boost/lexical_cast.hpp... yes
Checking for C++ header file boost/logic/tribool.hpp... yes
Checking for C++ header file boost/math/tr1.hpp... yes
Checking for C++ header file boost/noncopyable.hpp... yes
Checking for C++ header file boost/property_tree/ptree.hpp... yes
Checking for C++ header file boost/property_tree/ini_parser.hpp... yes
Checking for C++ header file boost/shared_ptr.hpp... yes
Checking for C++ header file boost/signals2/mutex.hpp... yes
Checking for C++ header file boost/thread.hpp... yes
Checking for C++ header file boost/tuple/tuple.hpp... yes
Checking for C++ header file boost/unordered_map.hpp... yes
scons: done reading SConscript files.
scons: Building targets ...
clang++ -o Contractor/EdgeBasedGraphFactory.o -c -O3 -DNDEBUG -march=native -fopenmp -lboost_regex -lboost_iostreams -lbz2 -lz -lprotobuf -I/usr/include -I/usr/include/include -I/usr/include/libxml2 Contractor/EdgeBasedGraphFactory.cpp
protoc -I=DataStructures/pbf-proto --cpp_out=DataStructures/pbf-proto DataStructures/pbf-proto/fileformat.proto
clang++ -o DataStructures/pbf-proto/fileformat.pb.o -c -O3 -DNDEBUG -march=native -fopenmp -lboost_regex -lboost_iostreams -lbz2 -lz -lprotobuf -I/usr/include -I/usr/include/include -I/usr/include/libxml2 DataStructures/pbf-proto/fileformat.pb.cc
protoc -I=DataStructures/pbf-proto --cpp_out=DataStructures/pbf-proto DataStructures/pbf-proto/osmformat.proto
clang++ -o DataStructures/pbf-proto/osmformat.pb.o -c -O3 -DNDEBUG -march=native -fopenmp -lboost_regex -lboost_iostreams -lbz2 -lz -lprotobuf -I/usr/include -I/usr/include/include -I/usr/include/libxml2 DataStructures/pbf-proto/osmformat.pb.cc
clang++ -o Descriptors/DescriptionFactory.o -c -DROUTED -I/usr/include -I/usr/include/include -I/usr/include/libxml2 Descriptors/DescriptionFactory.cpp
clang++ -o ThirdParty/PngImage.o -c -DROUTED -I/usr/include -I/usr/include/include -I/usr/include/libxml2 ThirdParty/PngImage.cc
clang++ -o Util/FileDownload.o -c -O3 -DNDEBUG -march=native -fopenmp -lboost_regex -lboost_iostreams -lbz2 -lz -lprotobuf -I/usr/include -I/usr/include/include -I/usr/include/libxml2 Util/FileDownload.cpp
clang++ -o Util/NASAGridSquare.o -c -O3 -DNDEBUG -march=native -fopenmp -lboost_regex -lboost_iostreams -lbz2 -lz -lprotobuf -I/usr/include -I/usr/include/include -I/usr/include/libxml2 Util/NASAGridSquare.cpp
clang++ -o createHierarchy.o -c -O3 -DNDEBUG -march=native -fopenmp -lboost_regex -lboost_iostreams -lbz2 -lz -lprotobuf -I/usr/include -I/usr/include/include -I/usr/include/libxml2 createHierarchy.cpp
clang++ -o extractor.o -c -O3 -DNDEBUG -march=native -fopenmp -lboost_regex -lboost_iostreams -lbz2 -lz -lprotobuf -I/usr/include -I/usr/include/include -I/usr/include/libxml2 extractor.cpp
clang++ -o osrm-extract -fopenmp -lboost_system extractor.o DataStructures/pbf-proto/fileformat.pb.o DataStructures/pbf-proto/osmformat.pb.o Util/FileDownload.o Util/NASAGridSquare.o -lbz2 -lpng -lpthread -lprotobuf -lstxxl -lxml2 -lz -lzip -lboost_system -lboost_thread -lboost_regex
clang++ -o osrm-prepare -fopenmp -lboost_system createHierarchy.o Contractor/EdgeBasedGraphFactory.o -lbz2 -lpng -lpthread -lprotobuf -lstxxl -lxml2 -lz -lzip -lboost_system -lboost_thread -lboost_regex
clang++ -o routed.o -c -DROUTED -I/usr/include -I/usr/include/include -I/usr/include/libxml2 routed.cpp
clang++ -o osrm-routed -fopenmp -lboost_system routed.o Descriptors/DescriptionFactory.o ThirdParty/PngImage.o -lbz2 -lpng -lpthread -lprotobuf -lstxxl -lxml2 -lz -lzip -lboost_system -lboost_thread -lboost_regex
scons: done building targets.
```