{"id":2490,"date":"2021-01-16T07:44:30","date_gmt":"2021-01-15T23:44:30","guid":{"rendered":"https:\/\/www.csslayer.info\/wordpress\/?p=2490"},"modified":"2021-01-16T07:50:24","modified_gmt":"2021-01-15T23:50:24","slug":"build-im-module-for-wps","status":"publish","type":"post","link":"https:\/\/www.csslayer.info\/wordpress\/fcitx-dev\/build-im-module-for-wps\/","title":{"rendered":"\u6784\u5efa\u4e00\u4e2a\u7ed9 WPS \u7528\u7684 fcitx im module"},"content":{"rendered":"\n<p>WPS \u5904\u4e8e\u8bb8\u53ef\u8bc1\u7684\u8003\u8651\uff0c\u91cc\u9762\u81ea\u5e26\u7684 fcitx \u7684 im module \u662f\u7531 WPS \u7684\u5f00\u53d1\u81ea\u5df1\u5199\u7684\u3002\u4f46\u662f\u8fd9\u5c31\u6709\u4e00\u4e2a\u95ee\u9898\u4e86\uff0c\u4ed6\u4eec\u5bf9\u4e8e\u8ddf\u968f fcitx \u4e0a\u6e38\u7684\u53d8\u5316\u53ef\u4ee5\u8bf4\u662f\u51e0\u4e4e\u6ca1\u6709\u3002\u5728 Fcitx 4 \u5df2\u7ecf\u52a0\u5165\u4e86\u5bf9\u4e8e  flatpak \/ fcitx 5 \u7684\u652f\u6301\u4e4b\u540e\u4ed6\u4eec\u5e76\u6ca1\u6709\u505a\u51fa\u5bf9\u5e94\u7684\u6539\u53d8\uff0c\u5bfc\u81f4\u4e86\u73b0\u5728\u7684\u5f88\u591a\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u5728\u8fc7\u53bb\u7684<a href=\"https:\/\/www.csslayer.info\/wordpress\/fcitx-dev\/a-case-study-how-to-compile-a-fcitx-platforminputcontext-plugin-for-a-proprietary-software-that-uses-qt-5\/\">\u8fd9\u7bc7<\/a>\u4e5f\u66fe\u7ecf\u5199\u5230\u4e86\uff0c\u5982\u4f55\u6784\u5efa\u4e00\u4e2a\u7ed9\u95ed\u6e90 Qt \u7a0b\u5e8f\u7528\u7684\u6a21\u5757\u3002<\/p>\n\n\n\n<p>\u6211\u4e0d\u77e5\u9053\u8fc7\u53bb\u6709\u6ca1\u6709\u4eba\u5e72\u8fc7\u8fd9\u6837\u7684\u4e8b\u60c5\uff0c\u4f46\u6211\u4eec\u73b0\u5728\u5c31\u6765\u505a\u8fd9\u4e48\u4e00\u8d9f\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u89c2\u5bdf WPS \u4f7f\u7528\u7684 Qt \u7248\u672c<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ ls \/usr\/lib\/office6\/libQtCore.so -l &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\nlrwxrwxrwx 1 root root 18 &nbsp;1\u6708 15 14:23 \/usr\/lib\/office6\/libQtCore.so -&gt; libQtCore.so.4.7.4<\/pre>\n\n\n\n<p>\u663e\u800c\u6613\u89c1\uff0c\u662f Qt 4.7.4\uff0c\u51fa\u4e8e Qt API \u7684\u4fee\u6539\u53ef\u80fd\u6709\u517c\u5bb9\u6027\u7684\u8003\u8651\uff0c\u6211\u4eec\u5148\u53bb\u4e0b\u8f7d\u4e00\u4e0b 4.7.4 \u7684\u6e90\u4ee3\u7801\u3002\u73b0\u5728\u53ef\u80fd\u9762\u4e34\u4e24\u4e2a\u95ee\u9898\uff1a<\/p>\n\n\n\n<p>1\u3001Qt 4.7.4 \u7684\u4ee3\u7801\u5728\u5f53\u524d\u7cfb\u7edf\u4e0a\u53ef\u80fd\u7f16\u8bd1\u4e0d\u4e86\u4e86<\/p>\n\n\n\n<p>2\u3001WPS \u7684 Qt \u53ef\u80fd\u4fee\u6539\u8fc7\u5927\u3002<\/p>\n\n\n\n<p>\u5f53\u7136 2 \u7684\u6982\u7387\u76f8\u5bf9\u662f\u8f83\u5c0f\u7684\uff0c\u5373\u4f7f\u5185\u90e8\u7684\u4fee\u6539\u4e5f\u4e0d\u592a\u53ef\u80fd\u5f71\u54cd\u5230 API\u3002\u4f46 1 \u786e\u5b9e\u662f\u6709\u8fd9\u6837\u7684\u73b0\u5b9e\u7684\u95ee\u9898\u3002\u800c\u4e14\u5728\u8fd9\u6b21\u4e5f\u786e\u5b9e\u9047\u89c1\u4e86\uff0c\u4f46\u662f\u6211\u4eec\u5176\u5b9e\u4e0d\u9700\u8981\u5927\u90e8\u5206\u7684\u5de5\u5177\uff0c\u6211\u4eec\u9700\u8981\u7684\u53ea\u662f moc\uff0cqmake \u8fd9\u4e24\u4e2a\u5de5\u5177\uff0c\u5373\u4f7f\u5176\u4ed6\u90fd\u7f16\u8bd1\u5931\u8d25\u4e5f\u6ca1\u6709\u5173\u7cfb\uff0c\u56e0\u4e3a WPS \u91cc\u9762\u5df2\u7ecf\u6709\u4e86\u5bf9\u5e94\u7684\u7f16\u8bd1\u597d\u7684\u5e93\u3002<\/p>\n\n\n\n<p>\u4e0b\u8f7d\u6e90\u4ee3\u7801\u4e4b\u540e\uff0c\u7f16\u8f91 configure \u6587\u4ef6\uff0c\u8bbe\u7f6e CFG_INOTIFY=no \uff0c\u6267\u884c<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> .\/configure -opensource -confirm-license -no-openssl\nmake<\/pre>\n\n\n\n<p>\u5f53\u7136\u786e\u5b9e\u662f\u51fa\u73b0\u4e86\u4e00\u4e9b\u5947\u602a\u7684\u9519\u8bef\uff0c\u4e0d\u7ba1\u4ed6\u3002\u6211\u4eec\u5176\u5b9e\u9700\u8981\u7684\u53ea\u662f\u751f\u6210\u7684 qtconfig.h \u6587\u4ef6\u548c qmake \u548c  moc\u3002<\/p>\n\n\n\n<p>\u7136\u540e\u51c6\u5907\u4e00\u4e9b fcitx \u7684\u6e90\u6587\u4ef6\uff0c\u7528 fcitx \u6216\u8005 fcitx5-qt \u90fd\u53ef\u4ee5\uff0c\u65e9\u524d\u6211\u5df2\u7ecf\u57fa\u672c\u8ba9 fcitx 4 \u7684  im module \u8131\u79bb\u9700\u8981\u94fe\u63a5 fcitx \u672c\u8eab\u7684\u5e93\uff0c\u53ea\u9700\u8981\u94fe\u63a5 Qt \u5373\u53ef\u3002\u4f46\u662f\u6211\u8fd8\u662f\u5f15\u7528\u4e86\u4e00\u4e9b fcitx \u7684\u5934\u6587\u4ef6\u3002\u7528 fcitx 4 \u7684\u4ee3\u7801\u5c31\u9700\u8981\u624b\u52a8\u590d\u5236\u4e00\u4e9b enum \u7684\u5b9a\u4e49\u8fc7\u6765\u3002\u56e0\u6b64 fcitx5-qt \u53ef\u80fd\u66f4\u597d\u4e00\u70b9\u3002<\/p>\n\n\n\n<p>\u6211\u7279\u610f\u4fee\u6539\u4e86\u4e00\u4e0b fcitx5-qt \u7684\u4ee3\u7801\u8ba9\u5b83\u53ef\u4ee5\u4e0d\u4fee\u6539\u5c31\u80fd\u7f16\u8bd1\u901a\u8fc7\u3002\u5199\u4e86\u4e00\u4e2a\u4e13\u95e8\u7684 cmake \u914d\u7f6e\uff0c\u6211\u4e5f\u5c31\u662f\u968f\u610f\u4e00\u5199\uff0c\u6240\u4ee5\u653e\u5230\u4e86\u4e2a\u4eba\u5e10\u53f7\u4e0a\u3002 <a href=\"https:\/\/github.com\/wengxt\/fcitx5-wps\">https:\/\/github.com\/wengxt\/fcitx5-wps<\/a> \u3002\u5229\u7528 git submodule \u76f4\u63a5\u5f15\u7528\u4e86 fcitx5-qt \u7684\u4ee3\u7801\uff0c\u6240\u4ee5 clone \u4e4b\u540e\u522b\u5fd8\u4e86 git submodule update &#8211;init<\/p>\n\n\n\n<p>\u5177\u4f53\u7f16\u8bd1\u53c2\u6570\u5c31\u9700\u8981\u8bbe\u7f6e -DQT_QMAKE_EXECUTABLE=&lt;qt\u6e90\u4ee3\u7801\u8def\u5f84>\/bin\/qmake \u8fd8\u6709 -DWPS_LIBRARY_DIR=&lt;WPS \u7684 qt \u5e93\u8def\u5f84><\/p>\n\n\n\n<p>\u7136\u540e\u751f\u6210\u4e86\u5e93\u4e4b\u540e\u628a\u4ed6\u590d\u5236\u5230 WPS \u5bf9\u5e94\u76ee\u5f55 \/usr\/lib\/office6\/qt\/plugins\/inputmethods\/qtim-fcitx.so \u6d4b\u8bd5\u8fd0\u884c\u3002\u5f53\u7136\uff0c\u6700\u597d\u5220\u6389\u539f\u6765\u7684\u90a3\u4e2a libqim-fcitx.so \u6587\u4ef6\uff0c\u907f\u514d\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u6210 fcitx \u65f6\u4f1a\u8bfb\u5230\u8fd9\u4e2a\u3002<\/p>\n\n\n\n<p>\u55ef\uff1f\u4e3a\u4ec0\u4e48\u4e0d\u884c\uff1f\u8fd9\u65f6\u5019\u5c31\u8981\u5229\u7528 Qt \u7684\u4e00\u4e2a\u8c03\u8bd5\u7528\u73af\u5883\u53d8\u91cf\u6765\u6d4b\u8bd5\u4e86<\/p>\n\n\n\n<p>QT_DEBUG_PLUGINS=1 \/usr\/lib\/office6\/wps<\/p>\n\n\n\n<p>\u53ef\u4ee5\u53d1\u73b0\u6709\u5982\u4e0b\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">QFactoryLoader::QFactoryLoader() looking at \"\/usr\/lib\/office6\/qt\/plugins\/inputmethods\/qtim-fcitx.so\" &nbsp;<br>In \/usr\/lib\/office6\/qt\/plugins\/inputmethods\/qtim-fcitx.so:<br>&nbsp;Plugin uses incompatible Qt library<br>&nbsp;expected build key \"x86_64 linux clang full-config\", got \"x86_64 linux g++-10.2.0 full-config\"<br>\"The plugin '\/usr\/lib\/office6\/qt\/plugins\/inputmethods\/qtim-fcitx.so' uses incompatible Qt library. Expected build key \"x86_64 linux clang full-config\", got \"x86_6<br>4 linux g++-10.2.0 full-config\"\" &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not a plugin<\/pre>\n\n\n\n<p>\u54e6\uff0cQT_BUILD_KEY \u5bf9\u4e0d\u4e0a\u53f7\u5457\u3002\u597d\u529e\uff0c\u76f4\u63a5\u5f3a\u884c\u4fee\u6539\u751f\u6210\u7684\u5bf9\u5e94 qconfig \u6587\u4ef6\u7684\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>\u5728 Qt \u6e90\u4ee3\u7801\u91cc\u9762\u627e\u5230 src\/corelib\/global\/qconfig.h \uff0c\u628a QT_BUILD_KEY \u4fee\u6539\u6210 WPS \u5bf9\u5e94\u7684\u3002\u8fd9\u90e8\u5206\u662f\u76f4\u63a5\u6784\u5efa\u5728 plugin \u91cc\u9762\u7684\uff0c\u6240\u4ee5\u91cd\u65b0\u7f16\u8bd1\u3002\u6d4b\u8bd5\u8f93\u5165\uff0c\u6210\u529f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WPS \u5904\u4e8e\u8bb8\u53ef\u8bc1\u7684\u8003\u8651\uff0c\u91cc\u9762\u81ea\u5e26\u7684 fcitx \u7684 im module \u662f\u7531 WPS \u7684\u5f00\u53d1\u81ea\u5df1\u5199\u7684\u3002\u4f46\u662f\u8fd9\u5c31\u6709\u4e00\u4e2a\u95ee\u9898\u4e86\uff0c\u4ed6\u4eec\u5bf9\u4e8e\u8ddf\u968f fcitx \u4e0a\u6e38\u7684\u53d8\u5316\u53ef\u4ee5\u8bf4\u662f\u51e0\u4e4e\u6ca1\u6709\u3002\u5728 Fcitx 4 \u5df2\u7ecf\u52a0\u5165\u4e86\u5bf9\u4e8e flatpak \/ fcitx 5 \u7684\u652f\u6301\u4e4b\u540e\u4ed6\u4eec\u5e76\u6ca1\u6709\u505a\u51fa\u5bf9\u5e94\u7684\u6539\u53d8\uff0c\u5bfc\u81f4\u4e86\u73b0\u5728\u7684\u5f88\u591a\u95ee\u9898\u3002 \u5728\u8fc7\u53bb\u7684\u8fd9\u7bc7\u4e5f\u66fe\u7ecf\u5199\u5230\u4e86\uff0c\u5982\u4f55\u6784\u5efa\u4e00\u4e2a\u7ed9\u95ed\u6e90 Qt \u7a0b\u5e8f\u7528\u7684\u6a21\u5757\u3002 \u6211\u4e0d\u77e5\u9053\u8fc7\u53bb\u6709\u6ca1\u6709\u4eba\u5e72\u8fc7\u8fd9\u6837\u7684\u4e8b\u60c5\uff0c\u4f46\u6211\u4eec\u73b0\u5728\u5c31\u6765\u505a\u8fd9\u4e48\u4e00\u8d9f\u3002 \u9996\u5148\u89c2\u5bdf WPS \u4f7f\u7528\u7684 Qt \u7248\u672c $ ls \/usr\/lib\/office6\/libQtCore.so -l &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lrwxrwxrwx 1 root root 18 &nbsp;1\u6708 15 &hellip; <a href=\"https:\/\/www.csslayer.info\/wordpress\/fcitx-dev\/build-im-module-for-wps\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-2490","post","type-post","status-publish","format-standard","hentry","category-fcitx-dev"],"_links":{"self":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts\/2490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/comments?post=2490"}],"version-history":[{"count":4,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts\/2490\/revisions"}],"predecessor-version":[{"id":2496,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/posts\/2490\/revisions\/2496"}],"wp:attachment":[{"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/media?parent=2490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/categories?post=2490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.csslayer.info\/wordpress\/wp-json\/wp\/v2\/tags?post=2490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}