-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Windows Compilation
To start compiling we need following software installed:
- Microsoft compiler and libraries:
- For latest version compilation you need Visual Studio 2013 or VS 2013 Express for Desktop
- http://www.microsoft.com/en-US/download/details.aspx?id=40787
- Run its Native x64 Command Prompt or x64 cross tools for Express. Older unsopported variants:
- Windows SDK 7.1 : http://www.microsoft.com/en-us/download/details.aspx?id=8279
- Git for Windows:
- http://code.google.com/p/msysgit/downloads/list?q=full+installer+official+git (also includes msys linux-like command prompt) (check "run Git from Windows command line" when installing)
- CMake -http://www.cmake.org/cmake/resources/software.html (check "ADD TO SYSTEM PATH" when installing)
- I recommend Far Manager to simplify life under Windows Command Line.
All command-line compilation should be done from VS2013 64 bit command prompt (in Start menu)
Choose a folder for compiled dependencies (no standard paths for that in Windows), i.e. "d:\libs" and place the needed sources somehere else.
- Unpack somewhere zlib, bz2 and libxml sources (no stable repositories),
- Bat-file tested for the following sources:
- Run build_base.bat or compile each library manually.
- Compile Boost.
- Download and & unpack Boost 1.55: http://sourceforge.net/projects/boost/files/boost/1.55.0/
- Use build_boost.bat or run the following from the command prompt:
- Run bootstrap.bat from SDK command prompt.
-
bjam toolset=msvc-12.0 variant=release address-model=64 threading=multi link=static runtime-link=shared --prefix=d:\libs\boost -sBZIP2_SOURCE="d:\build\bzip2-1.0.6" -sZLIB_SOURCE="d:\build\zlib-1.2.8" install
(for 64-bit static release boost, to compile all variants just omit variant=release link=static threading=multi, for VS2012 use msvc-11.0) - On VS2013 you may need to fix incompatibility https://svn.boost.org/trac/boost/ticket/9332 ,
replace file
has_member_function_callable_with.hpp
with the given one.
- Compile protobuf, osm-binary and Lua+LuaBind (did not try LuaJit)
- Run build_other.bat (or follow thesame procedure as its contents - clone, cmake with flags, nmake install)
- Build stxxl
- Run build_stxxl.bat
- some errors may follow, in that case patch
cmakelists.txt
to exclude problematic.cpp
(recursive template typedefs- error), see stxxl_win.patch (seem to work without it on VS2013 and latest stxxl)
- Compile OSRM :)
- See build_osrm.bat (change the paths to actual ones).
- Boost-finding errors are often, be sure to compile boost with the same bitness thatnt OSRM and with the same verion of compiler
= Notes =
- You can compile some of the cmake-based projects under Visual Studio, replacing generator
-G "NMake Makefiles"
with-G "Visual Studio 12 Win64"
(VS2013) or-G "Visual Studio 11 Win64"
(VS2012). - It is also convenient to use QtCreator IDE (it supports cmake), I was even able to debug running OSRM.
- Necessary DLLs from
libs\bin
should be available in system PATH or current folder to run OSRM. - For testing you need to install Ruby:\
http://rubyinstaller.org/news/2013/11/24/rubyinstaller-1-9-3-p484-and-2-0-0-p353-released/
(then
gem install bundle
,bundle install
) - To test, you need to install Java and place Osmosis somewhere in system path http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.zip
- Batch files and source code patches are available here.
- Support files are available here
I think this page is obsolete. I add few commet since I tried to compile OSMR recently using Codeblocks 20.03 on Windows 10. What I found was that
Several extra libraries ave to be installed like BZip2, lua. I was using MSYS2 so I did, pacman -S mingw-w64-x86_64-bzip2 pacman -S mingw-w64-x86_64-lua pacman -S mingw-w64-x86_64-zlib
instal Intell tbb https://github.com/oneapi-src/oneTBB/releases Extract it to a folder (e.g., C:\tbb).
Ensure to add TBB Path to CMake Command and that the bin folder of MinGW or MSYS2 (e.g., C:\msys64\mingw64\bin) is added to your system PATH environment variable.
Then in osrm-backend\build run
cmake -G "CodeBlocks - MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release -DTBB_INCLUDE_DIR="C:/tbb/include" -DTBB_LIBRARY="C:/tbb/lib/intel64/gcc4.8/libtbb.so"
cmake -G "CodeBlocks - MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fno-lto -mconsole" -DCMAKE_EXE_LINKER_FLAGS="-Wl,-e,mainCRTStartup"
It may be enough to compile.
However for some compilation problems I add to do
- remove "-Werror # Treat all warnings like error" in a CMakeLists.txt file
- add in shared_memory.hcp in line 208: (void)lock_file; // This explicitly marks lock_file as used to avoid warning of unused variable
- to avoid an Link Time Optimization (LTO) error run cmake -G "CodeBlocks - MinGW Makefiles" .. -DCMAKE_BUILD_TYPE=Release -DIPO=OFF
- put OFF in option(ENABLE_LTO "Use Link Time Optimisation" OFF) and I add set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF) in Cmake
I finally gave up because of Windows console incompatibility (Winmain not found) without knowing the reason even after having, In codebleocks Project properties, Built target, type put Console application