Skip to content

Commit

Permalink
sean-parent/docker fix (#84)
Browse files Browse the repository at this point in the history
* Update Dockerfile

Adding git install to fix:
> error: could not find git for clone of llvm-populate

Specifying build type to fix:
> No build type selected.  You need to pass -DCMAKE_BUILD_TYPE=<type> in
> order to configure LLVM.

* Removing VOLUME variable so script works as-in in PowerShell

* A working mess...

* Update README.md
  • Loading branch information
sean-parent authored Sep 5, 2023
1 parent 4f995b8 commit b765a90
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
42 changes: 34 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,46 @@ RUN apt-get -y install curl gnupg2 software-properties-common ninja-build apt-u

RUN apt-get -y install wget

# Install llvm/clang 13
RUN apt-get -y install git

# Are the build-essential packages needed? This elminates a CMake error
# about /usr/bin/c++ not being found but seems like overkill.
RUN apt-get -y install build-essential

# Install llvm/clang

# This is nesessary because of an issue with the hyde resource-dir. The
# version of clang installed must exactly match the version of clang used
# to build hyde. This is a temporary fix until hyde installs the necessary
# resource directory and encodes the path in the binary.

# If you get an error message about stddef.h or size_t not being found,
# the issue is here. Check where hyde is looking for it's resoruce
# directory with
# `hyde ./test.hpp -- -x c++ -print-resource-dir`

ENV LLVM_VERSION=15

RUN apt-get -y install clang-${LLVM_VERSION}

# The above doesn't setup libc++ header paths correctly. Currently LLVM-15
# doesn't install with llvm.sh in docker. So we install LLVM-16 just for
# the libc++ config!

RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 13 all
RUN ./llvm.sh 16 all

# set clang 13 to be the version of clang we use when clang/clang++ is invoked
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-13 100
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-13 100
# set clang ${LLVM_VERSION} to be the version of clang we use when clang/clang++ is invoked
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${LLVM_VERSION} 100
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${LLVM_VERSION} 100

ADD https://cmake.org/files/v3.24/cmake-3.24.0-linux-x86_64.sh /cmake-3.24.0-linux-x86_64.sh
RUN mkdir /opt/cmake
RUN sh /cmake-3.24.0-linux-x86_64.sh --prefix=/opt/cmake --skip-license
RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake

#install hyde dependencies
#install hyde dependencies
RUN apt-get -y install libyaml-cpp-dev libboost-system-dev libboost-filesystem-dev

COPY . /usr/src/hyde
Expand All @@ -31,10 +55,12 @@ WORKDIR /usr/src/hyde
RUN mkdir -p build \
&& cd build \
&& rm -rf * \
&& cmake .. -GNinja \
&& ninja
&& cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release \
&& ninja

# install hyde
RUN cp ./build/hyde /usr/bin

# RUN apt-get -y install clang-15

CMD ["./generate_test_files.sh"]
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ LLVM/Clang are declared as a dependency in the project's `CMakeLists.txt` file,

# Using Docker

```
VOLUME="hyde"
docker build --tag $VOLUME .
You may need to increase your docker resources to build the image.

```sh
docker build --tag hyde .

docker run --platform linux/x86_64 --mount type=bind,source="$(pwd)",target=/mnt/host \
--tty --interactive \
Expand Down

0 comments on commit b765a90

Please sign in to comment.