Skip to content

Instantly share code, notes, and snippets.

@xlshiz
Forked from twlz0ne/Dockerfile
Last active December 9, 2018 09:19
Show Gist options
  • Select an option

  • Save xlshiz/26e18b0dd6e90cb89d694f4399260cb7 to your computer and use it in GitHub Desktop.

Select an option

Save xlshiz/26e18b0dd6e90cb89d694f4399260cb7 to your computer and use it in GitHub Desktop.
Debian 9 build ccls
#!/usr/bin/env bash
rm -rf release
cmake -H. -Brelease \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_PREFIX_PATH=/usr/local/ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DSYSTEM_CLANG=On
cmake --build release
FROM launcher.gcr.io/google/debian9:latest
RUN apt-get update && apt-get install -y gnupg wget software-properties-common
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
RUN apt-add-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-6.0 main"
RUN apt-get update && apt-get install -y clang-6.0
RUN apt-get -y install libclang-common-6.0-dev libclang-6.0-dev libclang1-6.0 libllvm6.0 llvm-6.0-dev
## ISSUE:
# CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
# Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
# Call Stack (most recent call first):
# /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
# /usr/share/cmake-3.7/Modules/FindCurses.cmake:196 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
# cmake/FindClang.cmake:120 (find_package)
# CMakeLists.txt:108 (find_package)
RUN apt-get install -y libncurses5-dev
## ISSUE:
# CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
# Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
# Call Stack (most recent call first):
# /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
# /usr/share/cmake-3.7/Modules/FindZLIB.cmake:114 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
# cmake/FindClang.cmake:121 (find_package)
# CMakeLists.txt:108 (find_package)
RUN apt-get install -y zlibc zlib1g zlib1g-dev
## ISSUE:
# CMake Error in CMakeLists.txt:
# Target "ccls" requires the language dialect "CXX17" , but CMake does not
# know the compile flags to use to enable it.
#
## Solution 1: Install cmake from source
# RUN apt-get install -y build-essential
# RUN wget http://www.cmake.org/files/v3.8/cmake-3.8.2.tar.gz && \
# tar xf cmake-3.8.2.tar.gz && \
# cd cmake-3.8.2 && \
# ./configure && \
# make && make install
#
## Solution 2: Install cmake official binary
RUN apt-get install -y make
RUN export version=3.8 && \
export build=2 && \
mkdir ~/temp && \
cd ~/temp && \
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh && \
mkdir /opt/cmake && \
sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake --skip-license && \
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
## ISSUE:
# /usr/bin/clang++-6.0 -DDEFAULT_RESOURCE_DIRECTORY=\"/usr/lib/llvm-6.0/lib/clang/6.0.1\" -DLOGURU_FILENAME_WIDTH=18 -DLOGURU_THREADNAME_WIDTH=13 -DLOGURU_WITH_STREAMS=1 -I/ccls/src -I/ccls/third_party -I/ccls/third_party/rapidjson/include -I/ccls/third_party/loguru -I/ccls/third_party/doctest -isystem /usr/lib/llvm-6.0/include -O3 -DNDEBUG -fno-rtti -Wall -Wno-sign-compare -pthread -std=c++1z -o CMakeFiles/ccls.dir/src/cache_manager.cc.o -c /ccls/src/cache_manager.cc
# In file included from /ccls/src/cache_manager.cc:1:
# /ccls/src/cache_manager.h:3:10: fatal error: 'optional' file not found
# #include <optional>
# ^~~~~~~~~~
# 1 error generated.
# CMakeFiles/ccls.dir/build.make:89: recipe for target 'CMakeFiles/ccls.dir/src/cache_manager.cc.o' failed
# make[2]: *** [CMakeFiles/ccls.dir/src/cache_manager.cc.o] Error 1
# make[2]: Leaving directory '/ccls/release'
# CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/ccls.dir/all' failed
# make[1]: *** [CMakeFiles/ccls.dir/all] Error 2
# make[1]: Leaving directory '/ccls/release'
# Makefile:132: recipe for target 'all' failed
# make: *** [all] Error 2
RUN apt-add-repository "deb http://httpredir.debian.org/debian unstable main"
RUN apt-get update && apt-get -t unstable install -y libstdc++-7-dev
ADD ./build-ccls.sh /build-ccls.sh
sudo apt-get install -y libncurses5-dev
sudo apt-get install -y zlibc zlib1g zlib1g-dev
sudo apt-get install -y make
sudo export version=3.8 && \
export build=2 && \
mkdir ~/temp && \
cd ~/temp && \
wget https://cmake.org/files/v$version/cmake-$version.$build-Linux-x86_64.sh && \
sudo mkdir /opt/cmake && \
sudo sh cmake-$version.$build-Linux-x86_64.sh --prefix=/opt/cmake --skip-license && \
sudo ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake
sudo apt-get install software-properties-common
sudo apt-add-repository "deb http://httpredir.debian.org/debian unstable main"
sudo apt-get update && apt-get -t unstable install -y libstdc++-7-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment