Building watchman from source on Ubuntu 22.04 and Debian:Bullseye leaves the `built/lib` folder empty
- Dominant language
- C++
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi, I'm trying to build watchman from source (trying to support both x64 and arm64 architectures) using the following dockerfile:
```Dockerfile
FROM ubuntu:22.04 AS watchman
ARG WATCHMAN_VERSION=2023.01.16.00
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
RUST_VERSION=1.66.1
# Mostly from official rust container, I just added wget, git, python3-dev, libssl, build-essential, cmake
RUN set -eux; \
apt-get update; \
apt-get install -y \
build-essential \
ca-certificates \
gcc \
libc6-dev \
wget \
libssl-dev \
cmake \
git \
python3-dev \
; \
dpkgArch="$(dpkg --print-architecture)"; \
case "${dpkgArch##*-}" in \
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='48c5ecfd1409da93164af20cf4ac2c6f00688b15eb6ba65047f654060c844d85' ;; \
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0e0be29c560ad958ba52fcf06b3ea04435cb3cd674fbe11ce7d954093b9504fd' ;; \
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
esac; \
url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \
wget "$url"; \
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
chmod +x rustup-init; \
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
rm rustup-init; \
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
rustup --version; \
cargo --version; \
rustc --version;
# Trying to follow the official steps to build watchman from source
RUN git clone https://github.com/facebook/watchman.git -b v$WATCHMAN_VERSION --depth 1
WORKDIR watchman
RUN ./install-system-packages.sh
RUN ./autogen.sh
```
After building (the build finishes without errors) the dockerfile I enter the container to see the results. I see the `watchman` directory with the following content:
```
CMakeLists.txt CODE_OF_CONDUCT.md LICENSE README.markdown autogen.cmd autogen.sh build built eden install-system-packages.sh run-tests.sh watchman website
```
I look into the `built` folder to see the following:
```
5004306 4 drwxr-xr-x 4 root root 4096 Jan 18 01:11 built
5004308 4 drwxr-xr-x 2 root root 4096 Jan 18 01:11 built/lib
5004309 4 drwxr-xr-x 2 root root 4096 Jan 18 01:11 built/bin
5004313 288944 -rwxr-xr-x 1 root root 295873672 Jan 18 01:11 built/bin/watchman
5004317 7296 -rwxr-xr-x 1 root root 7469344 Jan 18 01:11 built/bin/watchmanctl
```
I find it strange that the `built/lib` folder is empty. I assumed, after building from the source that I would just follow the `prebuilt binary` steps to install watchman:
```
$ sudo mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman
$ sudo cp bin/* /usr/local/bin
$ sudo cp lib/* /usr/local/lib
$ sudo chmod 755 /usr/local/bin/watchman
$ sudo chmod 2777 /usr/local/var/run/watchman**
```
Thinking the binary was fully statically built, I tried proceeding without the `lib` folder. This failed with `watchman` asking for one such library. Looking at what the prebuilt binaries offer, the `lib` should contain the following:
```
libevent, libgflags, libglog, libsnappy
```
I was unable to find these libs, either in the `built/lib` folder or in the container.
For more context, my goal is to use the results of this build in another container i.e. I'm building my final docker image through multiple stages and this is just the `watchman` stage. I need to know where the `bin` and `lib` are to copy them to the next stage.
Thank you for your answers.
P.S. I tried the same steps with the same result relying on the rust official image which uses `debian:bullseye`.
Contributor guide
Assessment
This issue has not been assessed yet.