TehGoat / rs_osrm

rust wrapper for osrm
MIT License
3 stars 7 forks source link

Ubuntu focal (20.04.2) build failure #4

Open gak opened 3 years ago

gak commented 3 years ago

Hi,

Thanks for this awesome crate. I'm having issues building this in Ubuntu in a Docker image. I'm not well versed in cmake so I'm having problems working out why. The relevant (I think) error is:

#14 108.8   CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
#14 108.8     Could NOT find LibOSRM (missing: LibOSRM_LIBRARY_DIRS LibOSRM_CXXFLAGS
#14 108.8     LibOSRM_LIBRARIES LibOSRM_DEPENDENT_LIBRARIES LibOSRM_INCLUDE_DIR)

Full error at: https://gist.github.com/gak/ee482b96e6358de2d9675b9d54fa5130

I see that there are built .a files, e.g. libosrm.a but the find_package(LibOSRM) call doesn't seem to find them.

I've made a reproducible repository: https://github.com/gak/rs_osrm_test

It's just a matter of having Docker installed and run make, and the error should show up.

If you want to interactively debug it, comment out the RUN cargo build in the Dockerfile, make the build, then run docker run -it rs_osrm_test bash, then run cargo build in the container instance.

TehGoat commented 3 years ago

Hi, thanks for the detailed report. Im on vacation at the moment but will look into it as soon as I can.

TehGoat commented 3 years ago

Hi, There seems to be a problem with the installation of osrm-backend. I added a temporary fix in your docker file to download and build/install osrm-backend before building the project and it worked for me. When I'm back I will do a proper fix but this should work for now.

# syntax=docker/dockerfile:experimental
FROM ubuntu:focal

ARG DEBIAN_FRONTEND=noninteractive
RUN sed -i -e 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//mirror:\/\/mirrors\.ubuntu\.com\/mirrors\.txt/' /etc/apt/sources.list

RUN \
    --mount=type=cache,target=/var/lib/apt \
    apt-get update -y && \
    apt-get install -y curl build-essential libssl-dev zlib1g-dev libssl-dev pkg-config cmake \
        libboost-iostreams-dev libboost-regex-dev libboost-date-time-dev libboost-filesystem-dev \
        libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libexpat1-dev \
        libbz2-dev lua5.2 liblua5.2-dev libtbb-dev \
        gcc clang gdb valgrind git vim

RUN curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly -y
ENV PATH /root/.cargo/bin:$PATH

RUN git clone https://github.com/Project-OSRM/osrm-backend
WORKDIR /osrm-backend
RUN mkdir build
WORKDIR build
RUN cmake ..
RUN make -j12
RUN make install

RUN mkdir /build
WORKDIR /build
COPY / /build

RUN cargo build
gak commented 3 years ago

Thanks for this temp fix, it works perfectly. I'll leave the issue open for the proper fix.

Enjoy the vacation!