Closed gaboolic closed 3 weeks ago
直接运行rimeac.lua.exe 即可
我是mac和linux用户 😂 也是想用这个脚本给rime方案做做单元测试
我是mac和linux用户 😂 也是想用这个脚本给rime方案做做单元测试
有cmakelists呀,构建一下也快
git clone -v --recursive https://github.com/fxliang/rimeac.lua.git 克隆一下,系统上有librime,接下来就是cmake的事情了
下面是我在手机termux上都可以做的
rimeac.lua ➤ cmake -GNinja -Bbuild . -DCMAKE_BUILD_TYPE=Release git:master*
-- The C compiler identification is Clang 18.1.8
-- The CXX compiler identification is Clang 18.1.8
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (4.3s)
-- Generating done (0.0s)
-- Build files have been written to: /data/data/com.termux/files/home/rimeac.lua/build
rimeac.lua ➤ cmake --build build git:master*
[19/36] Building C object CMakeFiles/lua54.dir/lua-v5.4/loslib.c.o
/data/data/com.termux/files/home/rimeac.lua/lua-v5.4/loslib.c:174:3: warning: 'tmpnam' is deprecated: tmpnam is unsafe, use mkstemp or tmpfile instead [-Wdeprecated-declarations]
174 | lua_tmpnam(buff, err);
| ^
/data/data/com.termux/files/home/rimeac.lua/lua-v5.4/loslib.c:124:33: note: expanded from macro 'lua_tmpnam'
124 | #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
| ^
/data/data/com.termux/files/usr/include/stdio.h:162:5: note: 'tmpnam' has been explicitly marked deprecated here
162 | __warnattr("tmpnam is unsafe, use mkstemp or tmpfile instead");
| ^
/data/data/com.termux/files/usr/include/sys/cdefs.h:143:40: note: expanded from macro '__warnattr'
143 | #define __warnattr(msg) __attribute__((deprecated(msg)))
| ^
1 warning generated.
[36/36] Linking CXX executable rimeac.lua
-- Configuring done (0.0s) CMake Error at CMakeLists.txt:15 (add_library): No SOURCES given to target: lua54
我执行cmake报如上错误,怎么解决呢? 我直接执行lua,显示Lua 5.4.7 Copyright (C) 1994-2024 Lua.org, PUC-Rio
set_project("
> -- Configuring done (0.0s) CMake Error at CMakeLists.txt:15 (add_library): No SOURCES given to target: lua54
>
> 我执行cmake报如上错误,怎么解决呢? 我直接执行lua,显示Lua 5.4.7 Copyright (C) 1994-2024 Lua.org, PUC-Rio
你没有将submodules下载完吧?
换了Linux系统,
cmake -GNinja -Bbuild . -DCMAKE_BUILD_TYPE=Release
可以执行成功
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gbl/vscode_proj/rimeac.lua/build
执行cmake --build build 失败了
gbl@gbl-computer:~/vscode_proj/rimeac.lua$ cmake --build build
[1/3] Building CXX object CMakeFiles/rimeac.lua.dir/main.cpp.o
FAILED: CMakeFiles/rimeac.lua.dir/main.cpp.o
/usr/bin/c++ -I/home/gbl/vscode_proj/rimeac.lua/./include -I/home/gbl/vscode_proj/rimeac.lua/lua-v5.4 -I/home/gbl/vscode_proj/rimeac.lua/./LuaBridge3/Distribution -O3 -DNDEBUG -MD -MT CMakeFiles/rimeac.lua.dir/main.cpp.o -MF CMakeFiles/rimeac.lua.dir/main.cpp.o.d -o CMakeFiles/rimeac.lua.dir/main.cpp.o -c /home/gbl/vscode_proj/rimeac.lua/main.cpp
/home/gbl/vscode_proj/rimeac.lua/main.cpp:2:10: fatal error: lua5.4/lua.hpp: 没有那个文件或目录
2 | #include <lua5.4/lua.hpp>
| ^~~~~~~~~~~~~~~~
compilation terminated.
[2/3] Linking C static library liblua54.a
ninja: build stopped: subcommand failed.
重新拉一下代码,我改成不依赖系统安装了
gbl@gbl-computer:~/vscode_proj/rimeac.lua$ cmake --build build
[1/2] Building CXX object CMakeFiles/rimeac.lua.dir/main.cpp.o
FAILED: CMakeFiles/rimeac.lua.dir/main.cpp.o
/usr/bin/c++ -I/home/gbl/vscode_proj/rimeac.lua/./include -I/home/gbl/vscode_proj/rimeac.lua/lua-v5.4 -I/home/gbl/vscode_proj/rimeac.lua/./LuaBridge3/Distribution -O3 -DNDEBUG -MD -MT CMakeFiles/rimeac.lua.dir/main.cpp.o -MF CMakeFiles/rimeac.lua.dir/main.cpp.o.d -o CMakeFiles/rimeac.lua.dir/main.cpp.o -c /home/gbl/vscode_proj/rimeac.lua/main.cpp
/home/gbl/vscode_proj/rimeac.lua/main.cpp:8:10: fatal error: rime_api.h: 没有那个文件或目录
8 | #include <rime_api.h>
| ^~~~~~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
这个错误,还需要把librime装到系统里吗?我之前应该只编译了一下librime
gbl@gbl-computer:~/vscode_proj/rimeac.lua$ cmake --build build [1/2] Building CXX object CMakeFiles/rimeac.lua.dir/main.cpp.o FAILED: CMakeFiles/rimeac.lua.dir/main.cpp.o /usr/bin/c++ -I/home/gbl/vscode_proj/rimeac.lua/./include -I/home/gbl/vscode_proj/rimeac.lua/lua-v5.4 -I/home/gbl/vscode_proj/rimeac.lua/./LuaBridge3/Distribution -O3 -DNDEBUG -MD -MT CMakeFiles/rimeac.lua.dir/main.cpp.o -MF CMakeFiles/rimeac.lua.dir/main.cpp.o.d -o CMakeFiles/rimeac.lua.dir/main.cpp.o -c /home/gbl/vscode_proj/rimeac.lua/main.cpp /home/gbl/vscode_proj/rimeac.lua/main.cpp:8:10: fatal error: rime_api.h: 没有那个文件或目录 8 | #include <rime_api.h> | ^~~~~~~~~~~~ compilation terminated. ninja: build stopped: subcommand failed.
这个错误,还需要把librime装到系统里吗?我之前应该只编译了一下librime
你要么安装,要么添加一下include路径和lib路径到cmakelists里面
或者,你安装的输入法应该有带librime.so,添加那个到路径里;include_directories里添加 你编译的librime的src目录的路径,应该可以。我没有linux或macos的环境,也不熟,只能你自行摸索了
最新有可require的lua模块的产出了,不过librime(或rime.dll)还是要在path里才行。构建有cmake或xmake选。
最终还是没成功,mac编译出来的是librime.1.11.2.dylib 文件 不是dll/so
最终还是没成功,mac编译出来的是librime.1.11.2.dylib 文件 不是dll/so
没有Mac,不懂。只能确认的是Linux和Windows下是没有问题的。Mac下你有环境要自行调整修改点东西吧
下载了rimeac.lua.x86.7z
执行
lua script.lua
我的lua版本是Lua 5.4.4