facebook / watchman

Watches files and records, or triggers actions, when they change.
https://facebook.github.io/watchman/
MIT License
12.79k stars 996 forks source link

`watchman --version` always return `0.0.0` when building from source #1206

Open derfsubterfuge opened 8 months ago

derfsubterfuge commented 8 months ago

I'm on Fedora 39. I followed the build from source instructions and augmented them with the final steps of prebuilt binaries. Whenever I run watchman --version I get 0.0.0 instead of the actual version. How do I correct this? Do I need to add a version.txt file somewhere?

Commands that I ran:

  # From build from source
  WATCHMAN_VERSION="v2024.03.25.00"
  WATCHMAN_BUILD_DIR="$(mktemp -d)"
  cd $WATCHMAN_BUILD_DIR
  wget "https://github.com/facebook/watchman/archive/refs/tags/$WATCHMAN_VERSION.tar.gz"
  tar -xvzf "$WATCHMAN_VERSION.tar.gz"
  cd "watchman-$(echo $WATCHMAN_VERSION | sed 's/v//g')"
  sudo dnf install -y cargo
  sudo ./install-system-packages.sh
  ./autogen.sh

  # From prebuilt binaries
  cd built
  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

  # Cleanup
  cd "$HOME"
  rm -rf $WATCHMAN_BUILD_DIR

  # Version command that returns 0.0.0
  watchman --version
jdelliot commented 7 months ago

You can override by setting WATCHMAN_VERSION_OVERRIDE to the desired version. See https://github.com/facebook/watchman/blob/4744a9d434caec403a651411853cc9d9de5c5a75/CMakeLists.txt#L92-L103.

quux-aivar commented 7 months ago

Fedora linux

Similar issue on Fedora

# dnf info watchman
Last metadata expiration check: 0:05:38 ago on Wed 17 Apr 2024 06:21:34 AM UTC.
Installed Packages
Name         : watchman
Version      : 2021.05.10.00
Release      : 24.fc39
Architecture : x86_64
Size         : 1.5 M
Source       : watchman-2021.05.10.00-24.fc39.src.rpm
Repository   : @System
From repo    : updates
Summary      : File alteration monitoring service
URL          : https://facebook.github.io/watchman/
License      : Apache-2.0
Description  : Watchman exists to watch files and record when they actually change. It can also
             : trigger actions (such as rebuilding assets) when matching files change.
# watchman --version
0.0.0

Package info shows that version is 2021.05.10.00, but watchman itself shows 0.0.0.