Closed codygreen closed 1 year ago
Hi Cody, thanks for the report. Can you confirm if this is on a M1 Mac?
My M1's brew config
is identical but I cannot reproduce.
It's really quite strange, because "NJS" builds successfully but then cannot be found by the Unit configure
script 😕
Doubly strange seeing as $PKG_CONFIG_PATH
includes the directory where NJS was built (/private/tmp/unit-20230402-67885-12ocpi7/unit-1.29.1/njs/build)
Will investigate further.
Yes, this is on a fresh install M1 Pro. Thanks!
Hi @codygreen,
Could you show the content of the build/autoconf.err
file from Unit? The part related to the njs compiling error is enough.
Btw, with the config options, it seems you didn't specify the njs include and library paths.
==> ./configure --prefix=/opt/homebrew/Cellar/unit/1.29.1 ... --njs --cc-opt=-I/opt/homebrew/opt/openssl@1.1/include --ld-opt=-L/opt/homebrew/opt/openssl@1.1/lib
@codygreen shared the autoconf.err file:
<SNIP 1141 LINES>
/opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config: line 12: /opt/homebrew/opt/pkg-config/bin/pkg-config: No such file or directory
/opt/homebrew/Library/Homebrew/shims/mac/super/pkg-config: line 12: exec: /opt/homebrew/opt/pkg-config/bin/pkg-config: cannot execute: No such file or directory
----------------------------------------
checking for NJS
build/autotest.c:1:10: fatal error: 'njs.h' file not found
#include <njs.h>
^~~~~~~
1 error generated.
----------
#include <njs.h>
int main(void) {
njs_vm_t *vm;
njs_vm_opt_t opts;
njs_vm_opt_init(&opts);
vm = njs_vm_create(&opts);
if (vm == NULL)
return 1;
return 0;
}
----------
clang -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -fstrict-aliasing -Wstrict-overflow=5 -Wmissing-prototypes -Werror -g -I/opt/homebrew/opt/openssl@1.1/include -o build/autotest build/autotest.c -lnjs -lssl -lcrypto \ \ -L/opt/homebrew/Cellar/pcre2/10.42/lib -lpcre2-8 -L/opt/homebrew/opt/openssl@1.1/lib
----------
We concluded that pkg-config
was a missing dependency. Confirmed by running brew install pkg-config
before installing Unit.
This should fix it:
diff --git a/Formula/unit.rb b/Formula/unit.rb
index 583cf0f..d2a0466 100644
--- a/Formula/unit.rb
+++ b/Formula/unit.rb
@@ -5,6 +5,7 @@ class Unit < Formula
sha256 "7d756cff8c1a40b38c313fdbe8748333ffce034a3916fa1b502d63cc10623437"
head "https://hg.nginx.org/unit", using: :hg
+ depends_on "pkg-config"
depends_on "openssl@1.1"
depends_on "pcre2"
brew install -v nginx/unit/unit is failing with the error:
./configure: error: no NJS library found
Full output: