Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.15k stars 93 forks source link

cmake error in docker - not allowed properties #32

Closed binarytrails closed 5 years ago

binarytrails commented 5 years ago
conanfile.py (restinio/0.5.0@None/None): Generating the package
conanfile.py (restinio/0.5.0@None/None): Package folder /usr
conanfile.py (restinio/0.5.0@None/None): Calling package()
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- 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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:13 (set_target_properties):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "CXX_STANDARD" is not allowed.

CMake Error at CMakeLists.txt:13 (set_target_properties):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "CXX_STANDARD_REQUIRED" is not allowed.

CMake Error at CMakeLists.txt:13 (set_target_properties):
  INTERFACE_LIBRARY targets may only have whitelisted properties.  The
  property "CXX_EXTENSIONS" is not allowed.

-- Configuring incomplete, errors occurred!
See also "/restinio-conan/CMakeFiles/CMakeOutput.log".
ERROR: conanfile.py (restinio/0.5.0@None/None): Error in package() method, line 52
    cmake = self._configure_cmake()
while calling '_configure_cmake', line 48
    cmake.configure(source_folder = self.source_subfolder + "/dev/restinio")
    ConanException: Error 256 while executing cd '/restinio-conan' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_EXPORTED="1" -DCONAN_IN_LOCAL_CACHE="OFF" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="5" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++" -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DRESTINIO_INSTALL="True" -DRESTINIO_FIND_DEPS="False" -DRESTINIO_USE_BOOST_ASIO="none" -Wno-dev '/restinio-conan/restinio/dev/restinio'
eao197 commented 5 years ago

I suppose you have CMake 3.0 or older. Try to use CMake 3.1 or newer.

binarytrails commented 5 years ago

@eao197

Step 4/8 : RUN cmake --version
 ---> Running in 64d8dea1b424
cmake version 3.5.1
binarytrails commented 5 years ago

@eao197 If you wanna try it, (note: I didn't filter the opendht dependencies out and I clone your master since the 0.5.1 is not released yet but same logic):

FROM ubuntu:16.04
RUN apt-get update && apt-get install -y build-essential cmake git wget libncurses5-dev libreadline-dev nettle-dev libgnutls28-dev libuv1-dev cython3 python3-dev libcppunit-dev libjsoncpp-dev libasio-dev libssl-dev python3-setuptools python3-pip && apt-get clean

#install conan
RUN pip3 install conan

#build restinio from source
RUN git clone https://github.com/Stiffstream/restinio-conan.git \
    && cd restinio-conan/ \
    && conan remote add stiffstream https://api.bintray.com/conan/stiffstream/public \
    && echo "[requires]" > conanfile.txt \
    && echo "restinio/0.5.0@stiffstream/stable" >> conanfile.txt \
    && git clone https://github.com/Stiffstream/restinio \
    && conan install . --build=missing \
    && conan package --package-folder /usr . \
    && git clone https://github.com/eao197/http-parser.git \
    && cd http-parser && make && make install PREFIX=/usr \
    && cd ../ && rm -rf restinio-conan/

Then, you can build with docker build . -t restinio -f Dockerfile

I'm doing this because we use Continuous Integration to run the tests with travis-ci.org

спасибо!!

eao197 commented 5 years ago

Sorry, but I don't understand what you are trying to do.

The error with:

CMake Error at CMakeLists.txt:13 (set_target_properties): INTERFACE_LIBRARY targets may only have whitelisted properties. The property "CXX_STANDARD" is not allowed.

Has been fixed in some CMake version after 3.5. So you can add the following lines in your Dockerfile to install the rather fresh version of CMake:

# install fresh version of cmake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Linux-x86_64.sh
RUN sh cmake-3.13.4-Linux-x86_64.sh --skip-license
RUN cmake --version

But why do you clone restinio-conan repository? There is restinio-conan-example repo with an example of usage RESTinio via Conan.

binarytrails commented 5 years ago

@eao197

I posted the output of cmake --version the it is way more recent than your suggestion of 3.13.4! Besides, I'm using restinio-conan as you can see in the docker file to build the first version of restinio with dependencies. However, I git clone the master because:

I clone your master since the 0.5.1 is not released yet but same logic

In what relates to:

Sorry, but I don't understand what you are trying to do.

My answer:

I'm doing this because we use Continuous Integration to run the tests with travis-ci.org

Finally, thank you for the link to your home-made docker using conan, I will give it a try right away!