[Windows 환경] MSYS2, Clang64 용 OSRM 빌드 & 설치

2025. 1. 8. 09:01프로그래밍

728x90

 

 

[Windows 환경] MSYS2, MinGW64 용 OSRM 빌드하기

저번 글에서는 Clang64 환경에서 OSRM을 디버그 빌드 하였습니다. 모든 것이 처음이라 시행착오를 겪었는데요.이번에는 새로운 마음으로 다시 Mingw64 환경에서 다시 빌드 해보기로 했습니다.  

tobee.tistory.com

디버그 모드 고 릴리즈 모드로 빌드 하는 것을 해보겠습니다.

 

1. 필수 라이브러리 설치

pacman -S mingw-w64-clang-x86_64-boost
pacman -S mingw-w64-clang-x86_64-tbb
pacman -S mingw-w64-clang-x86_64-lua

 

2. cmake 옵션 

rm -Rf * 
cmake -G "MSYS Makefiles" \
  -DCMAKE_CXX_FLAGS="-fno-lto -Wmisleading-indentation -DTOBEE" \
  -DCMAKE_EXE_LINKER_FLAGS="-Wl,--subsystem,console -Wl,-e,mainCRTStartup -lws2_32" \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_SYSTEM_NAME=Windows \
  -DBOOST_INCLUDEDIR=/clang64/include/boost \
  -DBOOST_LIBRARYDIR=/clang64/lib \
  -DTBB_DIR=/clang64/lib/cmake/TBB \
  -DLUA_INCLUDE_DIR=/clang64/include \
  -DLUA_LIBRARIES=/clang64/lib \
  -DCMAKE_INSTALL_PREFIX=/C/DEV/GIS/OSRM/Backend_Exec/Release \
  ..

 

3. 빌드 및 설치

make -j5
make install

 

4. 변경한 소스들

isatty.hpp
0.00MB
routed.cpp
0.01MB
shared_memory.hpp
0.01MB
sol.hpp
0.93MB
microtar.c
0.01MB
tar.hpp
0.01MB

 

5. OSRM 데이터 빌드

 

다운로드:

https://tiles.osm.kr/download/

 

Index of /download/

 

tiles.osm.kr

 

 

Chat gpt 교수님 왈:

CH 환경

osrm-extract -p /path/to/profile.lua /path/to/map.osm.pbf
osrm-contract /path/to/map.osrm

 

예:

@ECHO osrm-extract.exe -p %OSRM_SRC%\profiles\car.lua %OSRM_HOME%\osrm_data\raw_south_korea\south-korea-latest.osm.pbf
@ECHO osrm-extract.exe -p %OSRM_SRC%\profiles\car.lua %OSRM_HOME%\osrm_data\raw_seoul\seoul-non-military.osm.pbf
@ECHO osrm-contract.exe %OSRM_HOME%\osrm_data\raw_seoul\seoul-non-military.osm.pbf
@ECHO osrm-contract.exe %OSRM_HOME%\osrm_data\raw_south_korea\south-korea-latest.osm
@ECHO osrm-extract.exe -p %OSRM_SRC%\profiles\car.lua %OSRM_HOME%\osrm_data\raw_south_korea\south-korea-latest-non-military.osm.pbf
@ECHO osrm-extract.exe -p %OSRM_SRC%\profiles\car.lua %OSRM_HOME%\osrm_data\raw_south_korea\south-korea-latest.osm.pbf

 

MLD 환경

# 1. 데이터 추출
osrm-extract --algorithm mld -p car.lua map.osm.pbf

# 2. 데이터 파티셔닝
osrm-partition map.osrm

# 3. 데이터 맞춤화
osrm-customize map.osrm

# 4. OSRM 서버 실행
osrm-routed --algorithm mld map.osrm

 

배치파일 몇개

그냥 내 입맛대로 만들어 보았습니다.

1.init_release_dir.bat
0.00MB
2.cpy_dlls_to_release.bat
0.00MB
3.cmd_osrm_data_gen.bat
0.00MB
run_backend_dbg_srv.bat
0.00MB
run_backend_real_srv.bat
0.00MB

 

 

오류

1.

stack index 3, expected number, received number: not a numeric type that fits exactly an integer (number maybe has significant decimals) (bad argument into 'void(unsigned char)')
stack traceback:
        [C]: in metamethod 'newindex'
        C:/DEV/GIS/OSRM/osrm-backend/profiles/lib/guidance.lua:112: in function 'lib/guidance.set_classification'
        C:/DEV/GIS/OSRM/osrm-backend/profiles/lib/way_handlers.lua:108: in function 'lib/way_handlers.classification'
        C:/DEV/GIS/OSRM/osrm-backend/profiles/lib/way_handlers.lua:711: in function 'lib/way_handlers.run'
        C:\DEV\GIS\OSRM\\osrm-backend\profiles\car.lua:465: in function 'process_way'
[2024-11-29T17:40:19.613363] [error] [exception] Lua error (see stderr for traceback)

 

guidance.lua
0.01MB

 

참고사이트

https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM

 

Building OSRM

Open Source Routing Machine - C++ backend. Contribute to Project-OSRM/osrm-backend development by creating an account on GitHub.

github.com

 

728x90