I have been trying to compile a project in docker using cmake. However, I get the following error:
cmake: /build/cmake-pCygIN/cmake-3.13.4/Source/cmOutputConverter.cxx:125: static std::__cxx11::string cmOutputConverter::ForceToRelativePath(const string&, const string&): Assertion `local_path.empty() || local_path[local_path.size() - 1] != '/'' failed.
This is using the following Dockerfile, for a helloworld c script
WORKDIR .
COPY ./ ./
RUN apt-get update && apt-get -y install cmake
WORKDIR ./build
RUN cmake .. && make
The cmake command works fine in my home environment. I presume this is because I have not installed something in the docker environment, but I am not sure what it would be.
If anyone else encounters this issue, the problem is running cmake in the root directory. Moving all the code into a ./src/
file, and changing the dockerfile to:
FROM python:3.7
WORKDIR .
COPY ./ ./
RUN apt-get update && apt-get -y install cmake
WORKDIR ./build
RUN cmake ../src && make
Fixes the issue
As HLL suggested, running cmake in the root directory will cause that error, complete Dockerfile as follow:
WORKDIR .
COPY ./ ./src
RUN apt-get update && apt-get -y install cmake
RUN cmake ../src && make
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With