当前位置: 首页 > news >正文

MacOS 使用 luarocks+wrk+luajit

MacOS 使用 luarocks+wrk+luajit

luarocks 默认使用的是 lua 5.4 版本,一些工具,例如 wrk 使用的 lua 5.1,那么 luarocks 在安装依赖的时候就需要指定 lua 5.1。

luarocks config 配置 lua 5.1

请确保已经安装了 lua5.1 或者 luajit,本处使用 luajit。

luarocks config lua_dir /opt/homebrew/opt/luajit
Lua version will default to 5.1 in /opt/homebrew/etc/luarocks
Wrotelua_version = "5.1"
to/opt/homebrew/etc/luarocks/config-5.1.lua
qyvlik@qyvlikdeMacBook-Pro luarocks % luarocks config lua_dir /opt/homebrew/opt/luajit
Wrotevariables.LUA = "/opt/homebrew/opt/luajit/bin/luajit"variables.LUA_BINDIR = "/opt/homebrew/opt/luajit/bin"variables.LUA_DIR = "/opt/homebrew/opt/luajit"variables.LUA_INCDIR = "/opt/homebrew/opt/luajit/include/luajit-2.1"variables.LUA_LIBDIR = "/opt/homebrew/opt/luajit/lib"
to/opt/homebrew/etc/luarocks/config-5.1.lua

写入文件的位置 /opt/homebrew/etc/luarocks/config-5.1.lua,内容如下:

-- LuaRocks configurationrocks_trees = {{ name = "user", root = home .. "/.luarocks" };{ name = "system", root = "/opt/homebrew" };
}
variables = {LUA_DIR = "/opt/homebrew/opt/luajit";LUA_BINDIR = "/opt/homebrew/opt/luajit/bin";LUA_VERSION = "5.1";LUA = "/opt/homebrew/opt/luajit/bin/luajit";
}
luarocks config lua_version 5.1
Wrotelua_version = "5.1"
to/opt/homebrew/etc/luarocks/config-5.1.lua

写入文件的位置 /opt/homebrew/etc/luarocks/default-lua-version.lua,内容如下:

return "5.1"

luarocks install snowflake

如果需要使用代理安装,请在执行如下命令,请确保有对应的 proxy 服务在运行。

export all_proxy=http://127.0.0.1:3128

安装需要指定 --lua-version=5.1

luarocks install snowflake --lua-version=5.1

没有指定 lua-version

admin@localhost% luarocks install snowflake
Installing https://luarocks.org/snowflake-1.0-1.rockspec
Cloning into 'lua-snowflake'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 21 (delta 3), reused 2 (delta 2), pack-reused 13 (from 1)
Receiving objects: 100% (21/21), 8.39 KiB | 8.39 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Note: switching to 'e4f3008828ea83ff1ba6651a766a349d449cee44'.You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:git switch -c <new-branch-name>Or undo this operation with:git switch -Turn off this advice by setting config variable advice.detachedHead to falsesnowflake 1.0-1 depends on lua >= 5.1 (5.4-1 provided by VM: success)
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -O2 -fPIC -I/opt/homebrew/opt/lua/include/lua5.4 -c src/main.c -o src/main.o
src/main.c:47:23: error: call to undeclared function 'luaL_checkint'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]47 |     g_datacenter_id = luaL_checkint(L, 1);|                       ^
src/main.c:47:23: note: did you mean 'luaL_checkany'?
/opt/homebrew/opt/lua/include/lua5.4/lauxlib.h:68:18: note: 'luaL_checkany' declared here68 | LUALIB_API void (luaL_checkany) (lua_State *L, int arg);|                  ^
1 error generated.Error: Build error: Failed compiling object src/main.o

指定 lua-version

admin@localhost% luarocks install snowflake --lua-version=5.1
Installing https://luarocks.org/snowflake-1.0-1.rockspec
Cloning into 'lua-snowflake'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 21 (delta 3), reused 2 (delta 2), pack-reused 13 (from 1)
Receiving objects: 100% (21/21), 8.39 KiB | 4.19 MiB/s, done.
Resolving deltas: 100% (3/3), done.
Note: switching to 'e4f3008828ea83ff1ba6651a766a349d449cee44'.You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:git switch -c <new-branch-name>Or undo this operation with:git switch -Turn off this advice by setting config variable advice.detachedHead to falsesnowflake 1.0-1 depends on lua >= 5.1 (5.1-1 provided by VM: success)
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc -O2 -fPIC -I/opt/homebrew/opt/luajit/include/luajit-2.1 -c src/main.c -o src/main.o
src/main.c:8:9: warning: 'luaL_newlib' macro redefined [-Wmacro-redefined]8 | #define luaL_newlib(L, l) ( lua_newtable( L ), luaL_register( L, NULL, l ) )|         ^
/opt/homebrew/opt/luajit/include/luajit-2.1/lauxlib.h:125:9: note: previous definition is here125 | #define luaL_newlib(L, l)       (luaL_newlibtable(L, l), luaL_setfuncs(L, l, 0))|         ^
1 warning generated.
env MACOSX_DEPLOYMENT_TARGET=11.0 gcc  -bundle -undefined dynamic_lookup -all_load -o /var/folders/lt/g2t6nfq96cs0lwt4nl86gys40000gn/T/luarocks_build-snowflake-1.0-1-5295760/snowflake.so src/main.o
No existing manifest. Attempting to rebuild...
snowflake 1.0-1 is now installed in /opt/homebrew (license: MIT)

ref

  • https://github.com/luarocks/luarocks/issues/337

文章转载自:

http://Jyf5KuKN.rpgdd.cn
http://tR52uX5Y.rpgdd.cn
http://X8BiVopc.rpgdd.cn
http://g1otxH8v.rpgdd.cn
http://PZ0EcKaE.rpgdd.cn
http://5uqG0x9Q.rpgdd.cn
http://oNV30nfW.rpgdd.cn
http://CnlSRHsc.rpgdd.cn
http://CbMX8LbS.rpgdd.cn
http://FILFgIcg.rpgdd.cn
http://NnSf5xj0.rpgdd.cn
http://PLGUAQ73.rpgdd.cn
http://bcDCWz7S.rpgdd.cn
http://IsAWMhN7.rpgdd.cn
http://kIg9XsYa.rpgdd.cn
http://kx69KXt3.rpgdd.cn
http://L3m68FqZ.rpgdd.cn
http://jCpHiJzM.rpgdd.cn
http://asedH2ef.rpgdd.cn
http://faXPBPeC.rpgdd.cn
http://ck8CCGyr.rpgdd.cn
http://dDw5D1fK.rpgdd.cn
http://dyHoWFoZ.rpgdd.cn
http://bd2RmHyk.rpgdd.cn
http://9ShpHTrY.rpgdd.cn
http://3lP1P3GV.rpgdd.cn
http://SS0653rI.rpgdd.cn
http://3FrF1fJG.rpgdd.cn
http://oyF1x8yA.rpgdd.cn
http://GIpKWnnx.rpgdd.cn
http://www.dtcms.com/a/369936.html

相关文章:

  • Rust在医疗系统中的应用:安全、性能与合规性实践(上)
  • 《云原生微服务治理进阶:隐性风险根除与全链路能力构建》
  • 006-Dephi 表达式 选择语句 循环语句其他语句
  • 深度学习:残差网络ResNet与迁移学习
  • SQL 实战指南:校园图书管理系统 SQL 设计(借阅 / 归还 / 库存查询实现)——超全项目实战练习
  • 输入2.2V~16V 最高输出20V2.5A DCDC升压芯片MT3608L
  • 人工智能学习:什么是seq2seq模型
  • 【基础-单选】singleton模式下首次进入的执行顺序是
  • 基于YOLO8的汽车碰撞事故检测系统【数据集+源码+文章】
  • 【c++进阶系列】:万字详解AVL树(附源码实现)
  • 【设计模式】 工厂方法模式
  • 总结-遇到
  • java分布式场景怎么实现一个高效的 读-写锁
  • 计算机毕设大数据方向:基于Spark+Hadoop的餐饮外卖平台数据分析系统【源码+文档+调试】
  • Java并发机制的底层实现原理
  • 数据结构:查找
  • PyQt5 多线程编程与排错技术文档
  • Linux 使用pip报错(error: externally-managed-environment )解决方案
  • Flask论坛与个人中心页面开发教程完整详细版
  • 【PostgreSQL】如何实现主从复制?
  • 进程与服务管理:systemd / sysvinit 服务管理、定时服务(cron / at)
  • Java全栈工程师面试实录:从基础到高并发场景的技术探索
  • 2025高教社国赛数学建模A题参考论文35页(含代码和模型)
  • 前缀和、子矩阵的和;差分、差分矩阵
  • 如何在 FastAPI 中巧妙覆盖依赖注入并拦截第三方服务调用?
  • LeetCode算法日记 - Day 34: 二进制求和、字符串相乘
  • 【PyTorch实战:Tensor】4、NumPy与PyTorch Tensor指南:深度学习中的数据操作与转换
  • W25Q128
  • 【LeetCode热题100道笔记】二叉树展开为链表
  • 【LeetCode热题100道笔记】对称二叉树