Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
derfsubterfuge opened this issue Mar 30, 2024 · 2 comments
Open

Comments

@derfsubterfuge
Copy link

derfsubterfuge commented Mar 30, 2024

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
Copy link
Contributor

jdelliot commented Apr 4, 2024

You can override by setting WATCHMAN_VERSION_OVERRIDE to the desired version. See

watchman/CMakeLists.txt

Lines 92 to 103 in 4744a9d

# A nonsensical version that doesn't correspond to any manually
# released version.
set(PACKAGE_VERSION "0.0.0")
set(WATCHMAN_VERSION_OVERRIDE "" CACHE STRING "Use this version code for \
Watchman version instead of the default computed from the repo")
set(WATCHMAN_BUILDINFO_OVERRIDE "" CACHE STRING "Use this version code for \
Watchman build info instead of the default (nothing)")
if (WATCHMAN_VERSION_OVERRIDE)
set(PACKAGE_VERSION "${WATCHMAN_VERSION_OVERRIDE}")
elseif(DEFINED ENV{WATCHMAN_VERSION_OVERRIDE})
set(PACKAGE_VERSION "$ENV{WATCHMAN_VERSION_OVERRIDE}")
.

@quux-aivar
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants