-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
I tried to build jq
from source recently and I got the following error:
posix.c:94:3: error: implicit declaration of function 'onig_end' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
onig_end();
This is happening because git submodule update --init
pulls in revision 6fa38f4084b448592888ed9ee43c6e90a46b5f5c (15 Mar 2017) of oniguruma
, which lacks the following explicit declaration in src/onigposix.h
:
ONIG_EXTERN int onig_end P_((void));
This was added to oniguruma
in revision 5a24a49d710a9e3bb8ff11d12e1eae5a9f9df40c (8 Sep 2017).
The workaround is to run git submodule update --remote --init
in place of git submodule update --init
. The problem with doing this is that git will pull in the latest revision of oniguruma
and I know I wouldn't personally be comfortable doing that against a 3rd party repository. Fortunately, it looks like you can change the revision git points at (this Stack Overflow post provides great instructions).
n.b. Git submodule essentially pins the oniguruma
module version to whatever revision it was at when the submodule definition was committed to this repository.
To reproduce
I just followed the build steps from the README.md, but here's a one liner for convenience:
git clone https://github.com/stedolan/jq && cd jq && git submodule update --init && autoreconf -fi && ./configure --with-oniguruma=builtin && make -j8 && make check
Output:
gcc -DHAVE_CONFIG_H -I. -I../src -I../src -I/usr/local/include -g -O2 -MT posix.o -MD -MP -MF .deps/posix.Tpo -c -o posix.o posix.c
posix.c:94:3: error: implicit declaration of function 'onig_end' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
onig_end();
^
1 error generated.
Expected behaviour
The build, or rather the make check
step should complete without any errors.
Environment (please complete the following information):
- macOS Monterey (12.0.1), arm64
jq
from master, revision: a9f97e9
Additional context
Workaround one liner:
git clone https://github.com/stedolan/jq && cd jq && git submodule update --remote --init && autoreconf -fi && ./configure --with-oniguruma=builtin && make -j8 && make check