Gitaly cannot compile git without setting paths for libpcre2.h
Overview
My rspec tests were failing because gitaly was not starting. Apparently, the git binary was not actually present. In the gitaly directory, make prepare-tests or make git needed to be run first.
When I attempted to run make git:
% make git
CC wt-status.o
AR xdiff/lib.a
CC remote-curl.o
CC http-fetch.o
GEN git-instaweb
CC builtin/add.o
CC git.o
* new script parameters
CC builtin/am.o
CC builtin/annotate.o
CC builtin/apply.o
In file included from wt-status.c:7:
In file included from ./revision.h:6:
./grep.h:6:10: fatal error: 'pcre2.h' file not found
#include <pcre2.h>
^~~~~~~~~
In file included from builtin/add.c:19:
In file included from ./revision.h:6:
./grep.h:6:10: fatal error: 'pcre2.h' file not found
#include <pcre2.h>
^~~~~~~~~
1 error generated.
In file included from make[1]: *** [builtin/add.o] Error 1
builtin/am.c:25:
In file included from ./revision.h:6:
./grep.h:6:10: fatal error: 'pcre2.h' file not found
make[1]: *** Waiting for unfinished jobs....
#include <pcre2.h>
^~~~~~~~~
1 error generated.
make[1]: *** [wt-status.o] Error 1
1 error generated.
make[1]: *** [builtin/am.o] Error 1
make: *** [/Users/stanhu/gdk-ee/gitaly/_build/deps/git/install/bin/git] Error 2
Steps to replicate (optional)
On a clean GDK install, install the GDK and try to run rspec spec/models/project_spec.rb in the gitalb directory.
Proposal (optional)
- We may want to run
make gitin thegitalydirectory. - As
@brodockpointed out in this Slack thread, M1 users may need to set:
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
export LD_LIBRARY_PATH=/opt/homebrew/lib
Environment (optional)
% gdk debug-info
Please review the content below, ensuring any sensitive information such as API
keys, passwords etc are removed before submitting:
--------------------------------------------------------------------------------
Operating system: Darwin jet-arm.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 arm64
Architecture: arm64
Ruby version: ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [arm64-darwin21]
GDK version: 6f1290d6
GDK configuration:
--------------------------------------------------------------------------------
Edited by Stan Hu