openspy / openspy-core

132 stars 21 forks source link

Cmake version error when building docker image #19

Closed sceadu37 closed 1 month ago

sceadu37 commented 1 month ago

While attempting to build a docker image, I receive this error:

------
 > [build 46/59] RUN cmake -DCMAKE_BINARY_DIR="/root/os-bin" -DCMAKE_CXX_FLAGS="-I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/"  -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE="Release" ../code:
0.356 CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
0.356   CMake 3.22 or higher is required.  You are running version 3.5.1
0.356
0.356
0.356 -- Configuring incomplete, errors occurred!
------
Dockerfile:55
--------------------
  53 |     RUN mkdir /root/os-bin /root/os-make
  54 |     WORKDIR /root/os-make
  55 | >>> run cmake -DCMAKE_BINARY_DIR="/root/os-bin" -DCMAKE_CXX_FLAGS="-I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/"  -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE="Release" ../code
  56 |     run make
  57 |     RUN mkdir -p /root/fs-out/opt/openspy/bin /root/fs-out/opt/openspy/lib
--------------------
ERROR: failed to solve: process "/bin/sh -c cmake -DCMAKE_BINARY_DIR=\"/root/os-bin\" -DCMAKE_CXX_FLAGS=\"-I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/\"  -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE=\"Release\" ../code" did not complete successfully: exit code: 1

cmake 3.22 didn't seem to be available through apt-get for ubuntu:16.04, so I tried changing the docker build version to ubuntu:22.04, which resulted in this error:

 => ERROR [build 46/59] RUN cmake -DCMAKE_BINARY_DIR="/root/os-bin" -DCMAKE_CXX_FLAGS="-I/root/fs-out/usr/local/i  0.8s
------
 > [build 46/59] RUN cmake -DCMAKE_BINARY_DIR="/root/os-bin" -DCMAKE_CXX_FLAGS="-I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/"  -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE="Release" ../code:
0.446 OS_CMAKE_MODULE_PATH="/root/code/../cmake/modules"
0.490 -- The C compiler identification is GNU 11.4.0
0.553 -- The CXX compiler identification is GNU 11.4.0
0.561 -- Detecting C compiler ABI info
0.622 -- Detecting C compiler ABI info - done
0.632 -- Check for working C compiler: /usr/bin/cc - skipped
0.632 -- Detecting C compile features
0.633 -- Detecting C compile features - done
0.637 -- Detecting CXX compiler ABI info
0.698 -- Detecting CXX compiler ABI info - failed
0.698 -- Check for working CXX compiler: /usr/bin/c++
0.758 -- Check for working CXX compiler: /usr/bin/c++ - broken
0.758 CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
0.758   The C++ compiler
0.758
0.758     "/usr/bin/c++"
0.758
0.758   is not able to compile a simple test program.
0.758
0.758   It fails with the following output:
0.758
0.758     Change Dir: /root/os-make/CMakeFiles/CMakeTmp
0.758
0.758     Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_252e3/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_252e3.dir/build.make CMakeFiles/cmTC_252e3.dir/build
0.758     gmake[1]: Entering directory '/root/os-make/CMakeFiles/CMakeTmp'
0.758     Building CXX object CMakeFiles/cmTC_252e3.dir/testCXXCompiler.cxx.o
0.758     /usr/bin/c++   -I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/  -o CMakeFiles/cmTC_252e3.dir/testCXXCompiler.cxx.o -c /root/os-make/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
0.758     Linking CXX executable cmTC_252e3
0.758     /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_252e3.dir/link.txt --verbose=1
0.758     /usr/bin/c++ -I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/  CMakeFiles/cmTC_252e3.dir/testCXXCompiler.cxx.o -o cmTC_252e3
0.758     /usr/bin/ld: cannot find -lz: No such file or directory
0.758     collect2: error: ld returned 1 exit status
0.758     gmake[1]: *** [CMakeFiles/cmTC_252e3.dir/build.make:99: cmTC_252e3] Error 1
0.758     gmake[1]: Leaving directory '/root/os-make/CMakeFiles/CMakeTmp'
0.758     gmake: *** [Makefile:127: cmTC_252e3/fast] Error 2
0.758
0.758
0.758
0.758
0.758
0.758   CMake will not be able to correctly generate this project.
0.758 Call Stack (most recent call first):
0.758   CMakeLists.txt:8 (project)
0.758
0.758
0.758 -- Configuring incomplete, errors occurred!
0.758 See also "/root/os-make/CMakeFiles/CMakeOutput.log".
0.758 See also "/root/os-make/CMakeFiles/CMakeError.log".
------
Dockerfile:56
--------------------
  54 |     RUN mkdir /root/os-bin /root/os-make
  55 |     WORKDIR /root/os-make
  56 | >>> run cmake -DCMAKE_BINARY_DIR="/root/os-bin" -DCMAKE_CXX_FLAGS="-I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/"  -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE="Release" ../code
  57 |     run make
  58 |     RUN mkdir -p /root/fs-out/opt/openspy/bin /root/fs-out/opt/openspy/lib
--------------------
ERROR: failed to solve: process "/bin/sh -c cmake -DCMAKE_BINARY_DIR=\"/root/os-bin\" -DCMAKE_CXX_FLAGS=\"-I/root/fs-out/usr/local/include -L/root/fs-out/usr/local/lib -lz -L/root/fs-out/usr/local/lib/x86_64-linux-gnu/\"  -DBUILD_SHARED_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE=\"Release\" ../code" did not complete successfully: exit code: 1
sceadu37 commented 1 month ago

Closing because #13 already addresses docker build issues