[ 0%] Building CXX object src/CMakeFiles/rime.dir/rime_api.cc.obj
In file included from C:/msys32/usr/include/sys/select.h:15,
from C:/msys32/usr/include/sys/types.h:52,
from C:/msys32/usr/include/pthread.h:11,
from C:/msys32/mingw32/include/c++/9.2.0/i686-w64-mingw32/bits/gthr-default.h:35,
from C:/msys32/mingw32/include/c++/9.2.0/i686-w64-mingw32/bits/gthr.h:148,
from C:/msys32/mingw32/include/c++/9.2.0/ext/atomicity.h:35,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:39,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/usr/include/sys/_timeval.h:40:18: error: conflicting declaration 'typedef __int_least64_t time_t'
40 | typedef _TIME_T_ time_t;
| ^~~~~~
In file included from C:/msys32/mingw32/i686-w64-mingw32/include/crtdefs.h:10,
from C:/msys32/mingw32/i686-w64-mingw32/include/stddef.h:7,
from C:/msys32/mingw32/lib/gcc/i686-w64-mingw32/9.2.0/include/stddef.h:1,
from C:/msys32/usr/include/sys/reent.h:14,
from C:/msys32/usr/include/string.h:11,
from C:/msys32/mingw32/include/c++/9.2.0/cstring:42,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:7:
C:/msys32/mingw32/i686-w64-mingw32/include/corecrt.h:141:20: note: previous declaration as 'typedef __time32_t time_t'
141 | typedef __time32_t time_t;
| ^~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/i686-w64-mingw32/bits/gthr.h:148,
from C:/msys32/mingw32/include/c++/9.2.0/ext/atomicity.h:35,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:39,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/mingw32/include/c++/9.2.0/i686-w64-mingw32/bits/gthr-default.h: In function 'int __gthread_yield()':
C:/msys32/mingw32/include/c++/9.2.0/i686-w64-mingw32/bits/gthr-default.h:693:10: error: 'sched_yield' was not declared in this scope
693 | return __gthrw_(sched_yield) ();
| ^~~~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/cctype:42,
from C:/msys32/mingw32/include/c++/9.2.0/bits/localefwd.h:42,
from C:/msys32/mingw32/include/c++/9.2.0/ios:41,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h: At global scope:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:411:23: error: expected ',' or '...' before numeric constant
411 | int __cdecl abs(int _X);
| ^~
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:412:26: error: expected ',' or '...' before numeric constant
412 | long __cdecl labs(long _X);
| ^~
In file included from C:/msys32/mingw32/i686-w64-mingw32/include/sec_api/stdlib_s.h:9,
from C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:768,
from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/usr/include/stdlib.h:39:3: error: conflicting declaration 'typedef struct div_t div_t'
39 | } div_t;
| ^~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:63:5: note: previous declaration as 'typedef struct _div_t div_t'
63 | } div_t;
| ^~~~~
In file included from C:/msys32/mingw32/i686-w64-mingw32/include/sec_api/stdlib_s.h:9,
from C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:768,
from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/usr/include/stdlib.h:45:3: error: conflicting declaration 'typedef struct ldiv_t ldiv_t'
45 | } ldiv_t;
| ^~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:68:5: note: previous declaration as 'typedef struct _ldiv_t ldiv_t'
68 | } ldiv_t;
| ^~~~~~
In file included from C:/msys32/mingw32/i686-w64-mingw32/include/sec_api/stdlib_s.h:9,
from C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:768,
from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/usr/include/stdlib.h:52:3: error: conflicting declaration 'typedef struct lldiv_t lldiv_t'
52 | } lldiv_t;
| ^~~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:727:61: note: previous declaration as 'typedef struct lldiv_t lldiv_t'
727 | typedef struct { __MINGW_EXTENSION long long quot, rem; } lldiv_t;
| ^~~~~~~
In file included from C:/msys32/mingw32/i686-w64-mingw32/include/sec_api/stdlib_s.h:9,
from C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:768,
from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/usr/include/stdlib.h:205:5: error: conflicting declaration of C function 'int putenv(char*)'
205 | int putenv (char *__string);
| ^~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:713:15: note: previous declaration 'int putenv(const char*)'
713 | int __cdecl putenv(const char *_EnvString) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
| ^~~~~~
In file included from C:/msys32/usr/include/errno.h:9,
from C:/msys32/mingw32/include/c++/9.2.0/cerrno:42,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:44,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/usr/include/sys/errno.h:20:36: error: conflicting declaration 'const char* const _sys_errlist []'
20 | extern __IMPORT const char * const _sys_errlist[];
| ^~~~~~~~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/cstdlib:75,
from C:/msys32/mingw32/include/c++/9.2.0/ext/string_conversions.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_string.h:6493,
from C:/msys32/mingw32/include/c++/9.2.0/string:55,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_classes.h:40,
from C:/msys32/mingw32/include/c++/9.2.0/bits/ios_base.h:41,
from C:/msys32/mingw32/include/c++/9.2.0/ios:42,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/mingw32/i686-w64-mingw32/include/stdlib.h:173:38: note: previous declaration as 'char* _sys_errlist [1]'
173 | extern __declspec(dllimport) char *_sys_errlist[1];
| ^~~~~~~~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/cwctype:50,
from C:/msys32/mingw32/include/c++/9.2.0/bits/locale_facets.h:39,
from C:/msys32/mingw32/include/c++/9.2.0/bits/basic_ios.h:37,
from C:/msys32/mingw32/include/c++/9.2.0/ios:44,
from C:/msys32/mingw32/include/c++/9.2.0/istream:38,
from C:/msys32/mingw32/include/c++/9.2.0/sstream:38,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:8:
C:/msys32/usr/include/wctype.h:22:13: error: conflicting declaration 'typedef int wctype_t'
22 | typedef int wctype_t;
| ^~~~~~~~
In file included from C:/msys32/mingw32/i686-w64-mingw32/include/crtdefs.h:10,
from C:/msys32/mingw32/i686-w64-mingw32/include/stddef.h:7,
from C:/msys32/mingw32/lib/gcc/i686-w64-mingw32/9.2.0/include/stddef.h:1,
from C:/msys32/usr/include/sys/reent.h:14,
from C:/msys32/usr/include/string.h:11,
from C:/msys32/mingw32/include/c++/9.2.0/cstring:42,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:7:
C:/msys32/mingw32/i686-w64-mingw32/include/corecrt.h:112:24: note: previous declaration as 'typedef short unsigned int wctype_t'
112 | typedef unsigned short wctype_t;
| ^~~~~~~~
In file included from C:/msys32/mingw32/include/c++/9.2.0/future:39,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime/deployer.h:10,
from D:/project/emacs-packages/liberime/third_party_build/librime/src/rime_api.cc:14:
C:/msys32/mingw32/include/c++/9.2.0/thread: In function 'void std::this_thread::sleep_for(const std::chrono::duration<_Rep1, _Period1>&)':
C:/msys32/mingw32/include/c++/9.2.0/thread:378:11: error: '::nanosleep' has not been declared
378 | while (::nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
| ^~~~~~~~~
make[2]: *** [src/CMakeFiles/rime.dir/build.make:63:src/CMakeFiles/rime.dir/rime_api.cc.obj] 错误 1
make[2]: 离开目录“/d/project/emacs-packages/liberime/third_party_build/librime/build”
make[1]: *** [CMakeFiles/Makefile2:166:src/CMakeFiles/rime.dir/all] 错误 2
make[1]: 离开目录“/d/project/emacs-packages/liberime/third_party_build/librime/build”
make: *** [Makefile:130:all] 错误 2
我觉得librime就没考虑过在mingw32上编译。windows上可以用visual studio 2015。在windows上编译liberime,主要是少librime.a 没法link。不知道用vs 2015编译产生的librime.a 能不能配合mingw64编译出liberime.so。
liberime的cmake可以改一下,直接用Makefile。cmake搞得太复杂了。
想着要装vs 2015,这么折腾,我直接被劝退了。
可以在https://github.com/rime/librime/releases/download/1.5.3/rime-with-plugins-1.5.3-win32.zip直接下载编译好的librime的SDK(include,lib,dll),刚好是32位的。
这样就只用编译liberime了。
如果在mingw32里编译,它应该能够直接链接.lib文件的。
如果不能,可以用mingw32里的一个工具,dlltool,来从dll生成a文件(能自动生成就幸运,不能就要改它生成的那个def文件)。
然后liberime的cmake改一下,像里面那个APPLE的if一样,也定义个RIME_ENV,指向下载解压好的SDK。
要看小狼毫用啥编译的,感觉vs应该行不通的,应该需要用gcc编译吧,毕竟emacs也是gcc编译的吧。。。
即windows需要mingw才可以。。。
如果可以的话,理想点是把librime和liberime都通过下载的方式直接下载对应平台编译好的lib,比源码下载本地再编译应该意外情况会少很多。
或者liberime还可以依赖librime得到一个单一个lib。
官网的dist/rime.lib是用vc编译的,无法在mingw32中link,gcc报错。
试了一下,成功了。
需要用mingw的dlltools处理下(用的这个tdm-gcc): http://www.mingw.org/wiki/CreateImportLibraries
把librime的release的zip解压到liberime,形成dist/include这样的结构。
dlltool -z dist/lib/librime.def --export-all-symbol dist/lib/rime.dll
改生成的dist/lib/librime.def,加一行“rime_get_api"即可
dlltool -d dist/lib/librime.def -l dist/lib/librime.a
改liberime的CMakeLists.txt,link_directories(“dist/lib”)之类。
cmake -H. -Bbuild -G “MinGW Makefiles”
cmake --build build
编译出来的 dll, emacs可以load吗
不行。。。def文件没生成好。
dlltool -d dist/lib/librime.def -l dist/lib/librime.a
换成
dlltool -d dist/lib/librime.def -l dist/lib/librime.a -D rime.dll
后,生成的dll用各种PE工具看是没啥问题的了。
我在虚拟机里临时下载的是27,liberime里的emacs-module.h应该是只到26,现在下载26又奇慢无比(手机共享上网)(和这个无关)。
官网26不支持模块,还是用27试了下加载成功了。改了下test.el后,runemacs -Q -l test.el,显示get schema list失败,但是在指定的data目录,生成了一个installataion.yaml文件。
文件上传不了。
又试了下,事实上什么lib什么a都不要,只要把rime的dist/lib目录下只留dll文件,就可以成功编译。。。
如果方便的话,建议总结成一个操作文档,或者shell 脚本
见https://gitee.com/wsw0108/liberime/blob/master/BUILD-W32.md
这个只能编译32位的么?
用 GitHub - merrickluo/liberime: A emacs dynamic module provide librime bindings for emacs 测试了,里面有mingw64编译的shell,相当方便。用mingw64可以编译为64bit的。
不过因为librime.dll等几个动态链接库是用mingw64编译的。没法和windows上安装的小狼毫共用一套配置,和互相覆盖。
小狼毫里面也有 librime.dll,不知道能不能通过这个 dll 来编译 liberime, 如果可以,那就比较方便了,只需让用户安装和配置小狼毫,liberime 就自动配置好了。
@wsw 有兴趣研究研究这个路子没?
按照 wsw 的方法,我用https://github.com/rime/librime/releases/download/1.5.3/rime-with-plugins-1.5.3-win32.zip里的rime.dll ,可以编译成64bit的liberime.dll,但是在emacs里加载总是报“找不到指定的模块”。可能是某个dll没加载上去,但是emacs没更详细的log,到底哪个dll没加载上。
另外,不知道64bit的liberime.dll能不能调用32bit的rime.dll。