换了电脑以后使用安装brew安装wrk时候brew install wrk会无法安装,网上搜到用brew install --build-from-source wrk会出现一个提示

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
==> Downloading https://github.com/wg/wrk/archive/4.1.0.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/downloads/5cd8617ac331ee55222ce9454d8b3b38a7e62a83a1bf75e924d88082d39ea675--4.1.0.tar.gz
==> make
Last 15 lines from /Users/xxx/Library/Logs/Homebrew/wrk/01.make:
	  rm -f luajit.pc.tmp
cd src && install -m 0644 lua.h lualib.h lauxlib.h luaconf.h lua.hpp luajit.h /private/tmp/wrk-20211204-45645-ncemsg/wrk-4.1.0/obj/include/luajit-2.1
cd src/jit && install -m 0644 bc.lua bcsave.lua dump.lua p.lua v.lua zone.lua dis_x86.lua dis_x64.lua dis_arm.lua dis_arm64.lua dis_arm64be.lua dis_ppc.lua dis_mips.lua dis_mipsel.lua dis_mips64.lua dis_mips64el.lua vmdef.lua /private/tmp/wrk-20211204-45645-ncemsg/wrk-4.1.0/obj/share/luajit-2.1.0-beta3/jit
==== Successfully installed LuaJIT 2.1.0-beta3 to /private/tmp/wrk-20211204-45645-ncemsg/wrk-4.1.0/obj ====

Note: the development releases deliberately do NOT install a symlink for luajit
You can do this now by running this command (with sudo):

  ln -sf luajit-2.1.0-beta3 /private/tmp/wrk-20211204-45645-ncemsg/wrk-4.1.0/obj/bin/luajit

Building OpenSSL...
"glob" is not exported by the File::Glob module
Can't continue after import errors at ./Configure line 17.
BEGIN failed--compilation aborted at ./Configure line 17.
make: *** [obj/lib/libssl.a] Error 255

READ THIS: https://docs.brew.sh/Troubleshooting

解决方案

wrk的issue中看到一个解决方案,自测我自己的问题能解决

brew install wrk --build-from-source --HEAD

输出结果可以看到安装成功:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
~ ❯ brew install wrk --build-from-source --HEAD                                                                                                                                                     15:04:31
==> Cloning https://github.com/wg/wrk.git
Cloning into '/Users/xxx/Library/Caches/Homebrew/wrk--git'...
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
==> make
🍺  /opt/homebrew/Cellar/wrk/HEAD-a211dd5: 7 files, 2.7MB, built in 1 minute 39 seconds
==> Running `brew cleanup wrk`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/xxx/Library/Caches/Homebrew/wrk--4.1.0.tar.gz... (6.2MB)