prost-build tries to install libprotobuf-lite.a to /usr/local?
On a CI setup that presumably doesn't have protobuf stuff installed, I see this build failure:
stdout:
cargo:rerun-if-changed=/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/cmake
CMAKE_TOOLCHAIN_FILE_x86_64-unknown-linux-gnu = None
CMAKE_TOOLCHAIN_FILE_x86_64_unknown_linux_gnu = None
HOST_CMAKE_TOOLCHAIN_FILE = None
CMAKE_TOOLCHAIN_FILE = None
CMAKE_GENERATOR_x86_64-unknown-linux-gnu = None
CMAKE_GENERATOR_x86_64_unknown_linux_gnu = None
HOST_CMAKE_GENERATOR = None
CMAKE_GENERATOR = None
CMAKE_PREFIX_PATH_x86_64-unknown-linux-gnu = None
CMAKE_PREFIX_PATH_x86_64_unknown_linux_gnu = None
HOST_CMAKE_PREFIX_PATH = None
CMAKE_PREFIX_PATH = None
CMAKE_x86_64-unknown-linux-gnu = None
CMAKE_x86_64_unknown_linux_gnu = None
HOST_CMAKE = None
CMAKE = None
running: "cmake" "/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/cmake" "-Dprotobuf_BUILD_TESTS=OFF" "-DCMAKE_INSTALL_PREFIX=/home/circleci/project/target/release/build/prost-build-a86690dea9c84054/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/home/circleci/.conan/data/cross-toolchain/0.11.0/palantir/release/package/c9748b43f254ada220d8cf5667e7e3d00e6e1980/bin/x86_64-linux-gnu-gcc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/home/circleci/.conan/data/cross-toolchain/0.11.0/palantir/release/package/c9748b43f254ada220d8cf5667e7e3d00e6e1980/bin/x86_64-linux-gnu-g++" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/home/circleci/.conan/data/cross-toolchain/0.11.0/palantir/release/package/c9748b43f254ada220d8cf5667e7e3d00e6e1980/bin/x86_64-linux-gnu-gcc" "-DCMAKE_BUILD_TYPE=Debug"
--
-- 3.19.4.0
-- Configuring done
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Check for working C compiler: /home/circleci/.conan/data/cross-toolchain/0.11.0/palantir/release/package/c9748b43f254ada220d8cf5667e7e3d00e6e1980/bin/x86_64-linux-gnu-gcc
-- Check for working C compiler: /home/circleci/.conan/data/cross-toolchain/0.11.0/palantir/release/package/c9748b43f254ada220d8cf5667e7e3d00e6e1980/bin/x86_64-linux-gnu-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/circleci/.conan/data/cross-toolchain/0.11.0/palantir/release/package/c9748b43f254ada220d8cf5667e7e3d00e6e1980/bin/x86_64-linux-gnu-g++
-- Check for working CXX compiler: /home/circleci/.conan/data/cross-toolchain/0.11.0/palantir/release/package/c9748b43f254ada220d8cf5667e7e3d00e6e1980/bin/x86_64-linux-gnu-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
-- 3.19.4.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/circleci/project/target/release/build/prost-build-a86690dea9c84054/out/build
running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--parallel" "8"
Scanning dependencies of target gmock
[ 0%] Building CXX object CMakeFiles/gmock.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/third_party/googletest/googlemock/src/gmock-all.cc.o
[ 0%] Building CXX object CMakeFiles/gmock.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/third_party/googletest/googletest/src/gtest-all.cc.o
Scanning dependencies of target libprotobuf-lite
[ 1%] Building CXX object CMakeFiles/libprotobuf-lite.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/src/google/protobuf/any_lite.cc.o
....
[ 97%] Building CXX object CMakeFiles/tests.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/src/google/protobuf/util/message_differencer_unittest.pb.cc.o
[ 98%] Building CXX object CMakeFiles/tests.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/src/google/protobuf/map_lite_unittest.pb.cc.o
[ 98%] Building CXX object CMakeFiles/tests.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/src/google/protobuf/unittest_import_lite.pb.cc.o
[ 98%] Building CXX object CMakeFiles/tests.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/src/google/protobuf/unittest_import_public_lite.pb.cc.o
[ 98%] Building CXX object CMakeFiles/tests.dir/usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/src/google/protobuf/unittest_lite.pb.cc.o
[ 99%] Linking CXX executable tests
[100%] Built target tests
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/libprotobuf-lite.a
stderr:
....
CMake Error at cmake_install.cmake:41 (file):
file INSTALL cannot copy file
"/home/circleci/project/target/release/build/prost-build-a86690dea9c84054/out/build/libprotobuf-lite.a"
to "/usr/local/lib/libprotobuf-lite.a": Permission denied.
make: *** [Makefile:84: install] Error 1
thread 'main' panicked at '
command did not execute successfully, got: exit status: 2
build script failed, must exit now', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.48/src/lib.rs:975:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
It does look like cmake is being passed a reasonable install prefix: -DCMAKE_INSTALL_PREFIX=/home/circleci/project/target/release/build/prost-build-a86690dea9c84054/out, so this may be a bug in protobuf's build system?
Very strangely, it seems like this may only happen for release builds?
Not totally sure, but the next release will remove cmake and compiling protoc so I think this will be a none issue in the future.
I'm getting the same problem as well - any workaround?
inside /opt/src/target/debug/build/prost-build-588ccae2029ab841/out/build (where /opt/src is my checkout), CMakeCache.txt has
CMAKE_INSTALL_PREFIX:PATH=/usr/local
not sure why, even though I do see in the log
running: "cmake" "/home/hieu/.cargo/registry/src/github.com-1ecc6299db9ec823/prost-build-0.10.4/third-party/protobuf/cmake" "-Dprotobuf_BUILD_TESTS=OFF" "-DCMAKE_INSTALL_PREFIX=/opt/src/target/debug/build/prost-build-588ccae2029ab841/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/gcc-10" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/g++-10" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_ASM_COMPILER=/usr/bin/gcc-10" "-DCMAKE_BUILD_TYPE=Debug"
Running the cmake command manually works, and unblocks the build. So weird. I'm guessing it has something to do with argument parsing when invoking cmake command line from inside cargo build
@hicder upgrading prost will no longer require cmake.