{"id":273315,"date":"2023-05-26T04:05:47","date_gmt":"2023-05-25T20:05:47","guid":{"rendered":"https:\/\/lrxjmw.cn\/lazxgjbgl.html"},"modified":"2023-05-26T04:05:47","modified_gmt":"2023-05-25T20:05:47","slug":"lazxgjbgl","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lazxgjbgl.html","title":{"rendered":"Linux\u5b89\u88c5XCB\u5de5\u5177\u5305\u653b\u7565"},"content":{"rendered":"

Linux<\/a> XCB \u662f X Window \u7cfb\u7edf<\/a>\u4e0b\u7684\u4e00\u4e2a\u5de5\u5177\u5305\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u7a97\u53e3\u7cfb\u7edf\u3002\u672c\u6587\u5c06\u4e3a\u5927\u5bb6\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728 Linux \u7cfb\u7edf\u4e0a\u5b89\u88c5<\/a> XCB \u5de5\u5177\u5305\u3002<\/p>\n

\u4e00\u3001\u5b89\u88c5\u524d\u51c6\u5907<\/p>\n

\u5728\u5b89\u88c5 XCB \u4e4b\u524dlinux xcb \u5b89\u88c5<\/strong>\uff0c\u9700\u8981\u786e\u4fdd\u7cfb\u7edf\u5df2\u7ecf\u5b89\u88c5\u4e86\u4ee5\u4e0b\u8f6f\u4ef6\u5305\uff1a<\/p>\n

1. gcc <\/p>\n

2. git <\/p>\n

3. make <\/p>\n

4. automake <\/p>\n

5. autoconf <\/p>\n

6. libtool <\/p>\n

7. pkg-config <\/p>\n

8. libpthread-stubs0-dev <\/p>\n

9. libxml2-dev <\/p>\n

\u5982\u679c\u7cfb\u7edf\u4e2d\u6ca1\u6709\u5b89\u88c5\u4ee5\u4e0a\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4<\/a>\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n

\n

\nsudo apt-get install gcc git make automake autoconf libtool pkg-config libpthread-stubs0-dev libxml2-dev\n<\/pre>\n<\/p>\n

\u4e8c\u3001\u4e0b\u8f7d\u6e90\u4ee3\u7801<\/p>\n

\u5728\u5b89\u88c5 XCB \u4e4b\u524d\uff0c\u9700\u8981\u5148\u4e0b\u8f7d\u6e90\u4ee3\u7801\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u4e0b\u8f7d\uff1a<\/p>\n

\n

\ngit clone git:\/\/\/git\/xcb\/util-keysyms.git\ncd util-keysyms\n<\/pre>\n<\/p>\n

\u4e09\u3001\u7f16\u8bd1\u5b89\u88c5<\/p>\n

\u4e0b\u8f7d\u5b8c\u6e90\u4ee3\u7801\u540eubuntu linuxlinux\u547d\u4ee4ls\uff0c\u9700\u8981\u8fdb\u884c\u7f16\u8bd1\u548c\u5b89\u88c5\u3002\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n

1.\u8fd0\u884c autogen.sh \u811a\u672c\u751f\u6210 configure \u6587\u4ef6\uff1a<\/p>\n

\n

\n   .\/autogen.sh\n   <\/pre>\n<\/p>\n

2.\u8fd0\u884c configure \u811a\u672c\u751f\u6210 Makefile \u6587\u4ef6\uff1a<\/p>\n

\n

\n   .\/configure --prefix=\/usr\/local\n   <\/pre>\n<\/p>\n

3.\u8fd0\u884c make \u547d\u4ee4\u7f16\u8bd1\u6e90\u4ee3\u7801\uff1a<\/p>\n

\n

\n   make\n   <\/pre>\n<\/p>\n

4.\u8fd0\u884c make install \u547d\u4ee4\u5b89\u88c5 XCB\uff1a<\/p>\n

\n

\n   sudo make install\n   <\/pre>\n<\/p>\n

\u56db\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/a><\/p>\n

\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9700\u8981\u5c06 XCB \u7684\u5e93\u8def\u5f84\u6dfb\u52a0\u5230 LD_LIBRARY_PATH \u73af\u5883\u53d8\u91cf\u4e2d\u3002\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n

1.\u6253\u5f00\/etc\/profile \u6587\u4ef6\uff1a<\/p>\n

\n

\n   sudo vim \/etc\/profile\n   <\/pre>\n<\/p>\n

2.\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

\n

\n   export LD_LIBRARY_PATH=\/usr\/local\/lib:$LD_LIBRARY_PATH\n   <\/pre>\n<\/p>\n

3.\u4fdd\u5b58\u5e76\u9000\u51fa\u6587\u4ef6\u3002<\/p>\n

\u56db\u3001\u6d4b\u8bd5<\/p>\n

\u5b89\u88c5\u5b8c\u6210\u540elinux xcb \u5b89\u88c5<\/strong>\uff0c\u53ef\u4ee5\u8fdb\u884c\u6d4b\u8bd5\u3002\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n

1.\u521b\u5efa\u4e00\u4e2aC++\u6587\u4ef6\uff1a<\/p>\n

linux\u5b89\u88c5_linux xcb \u5b89\u88c5_qt linux xcb<\/p>\n

\n

\n   #include <xcb\/xcb.h>\n   \n   int main(){\n       xcb_connection_t*c= xcb_connect(NULL, NULL);\n       if (!c){\n           return 1;\n       }\n       xcb_disconnect(c);\n       return 0;\n   }\n   <\/pre>\n<\/p>\n

2.\u7f16\u8bd1\u6587\u4ef6\uff1a<\/p>\n

\n

\n   g++-o test test.cpp -lxcb\n   <\/pre>\n<\/p>\n

3.\u8fd0\u884c\u6587\u4ef6\uff1a<\/p>\n

\n

\n   .\/test\n   <\/pre>\n<\/p>\n

\u5982\u679c\u8f93\u51fa\u7ed3\u679c\u4e3a0\uff0c\u5219\u8868\u793a XCB \u5b89\u88c5\u6210\u529f\u3002<\/p>\n

\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u89e3\u51b3\u65b9\u6cd5<\/p>\n

1. configure: error: Package requirements (xcb >=1.7) were not met.<\/p>\n

\u89e3\u51b3\u65b9\u6cd5\uff1a\u5b89\u88c5 xcb-util \u5e93\u3002<\/p>\n

\n

\nsudo apt-get install libxcb-util-dev\n<\/pre>\n<\/p>\n

2. configure: error: Package requirements (libXau) were not met.<\/p>\n

\u89e3\u51b3\u65b9\u6cd5\uff1a\u5b89\u88c5 libxau \u5e93\u3002<\/p>\n

\n

\nsudo apt-get install libxau-dev\n<\/pre>\n<\/p>\n

3. configure: error: Package requirements (libX11) were not met.<\/p>\n

\u89e3\u51b3\u65b9\u6cd5\uff1a\u5b89\u88c5 libx11 \u5e93\u3002<\/p>\n

\n

\nsudo apt-get install libx11-dev\n<\/pre>\n<\/p>\n

\u56db\u3001\u603b\u7ed3<\/p>\n

\u672c\u6587\u4e3a\u5927\u5bb6\u4ecb\u7ecd\u4e86 Linux XCB \u5b89\u88c5\u7684\u8be6\u7ec6\u6b65\u9aa4\uff0c\u4ece\u51c6\u5907\u5de5\u4f5c\u5230\u73af\u5883\u53d8\u91cf\u914d\u7f6e\u518d\u5230\u6d4b\u8bd5\uff0c\u4e00\u6b65\u6b65\u4e3a\u5927\u5bb6\u6f14\u793a\u4e86\u5982\u4f55\u5b89\u88c5 XCB \u5de5\u5177\u5305\u3002\u5e0c\u671b\u80fd\u591f\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7cfb\u7edf\u4e0b\u7684\u4e00\u4e2a\u5de5\u5177\u5305\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u7a97\u53e3\u7cfb\u7edf\u3002\u5de5\u5177\u5305\u3002\u4e4b\u524d\uff0c\u9700\u8981\u786e\u4fdd\u7cfb\u7edf\u5df2\u7ecf\u5b89\u88c5\u4e86\u4ee5\u4e0b\u8f6f\u4ef6\u5305\uff1a\u5982\u679c\u7cfb\u7edf\u4e2d\u6ca1\u6709\u5b89\u88c5\u4ee5\u4e0a\u8f6f\u4ef6\u5305\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a\u4e8c\u3001\u4e0b\u8f7d\u6e90\u4ee3\u7801\u4e4b\u524d\uff0c\u9700\u8981\u5148\u4e0b\u8f7d\u6e90\u4ee3\u7801\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u4e0b\u8f7d\uff1agit:\/\/\/git\/xcb\/util-keysyms.\u4e09\u3001\u7f16\u8bd1\u5b89\u88c5\u4e0b\u8f7d\u5b8c\u6e90\u4ee3\u7801\u540e\uff0c\u9700\u8981\u8fdb\u884c\u7f16\u8bd1\u548c\u5b89\u88c5\u3002\u547d\u4ee4\u7f16\u8bd1\u6e90\u4ee3\u7801\uff1alibx11-dev\u5de5\u5177\u5305\u3002<\/p>\n","protected":false},"author":1,"featured_media":273316,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-273315","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/273315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=273315"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/273315\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/273316"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=273315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=273315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=273315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}