{"id":800,"date":"2019-10-15T14:19:57","date_gmt":"2019-10-15T06:19:57","guid":{"rendered":"http:\/\/iqotom.com\/?p=800"},"modified":"2019-10-15T16:09:42","modified_gmt":"2019-10-15T08:09:42","slug":"ubuntu%e4%b8%8b%e4%bd%bf%e7%94%a8%e8%84%9a%e6%9c%ac%e6%89%93%e5%8c%85qt%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"http:\/\/iqotom.com\/?p=800","title":{"rendered":"Ubuntu\u4e0b\u4f7f\u7528\u811a\u672c\u6253\u5305QT\u7a0b\u5e8f"},"content":{"rendered":"\n<p><strong> Ubuntu\u7248\u672c\uff1a18.04 <\/strong><\/p>\n\n\n\n<p><strong> QT\u7248\u672c\uff1a5.7.0 <\/strong><\/p>\n\n\n\n<p> \u4f8b\u5982\u7a0b\u5e8f\u540d\u4e3a<strong>GPIO-TEST<\/strong>\uff0c\u8bf7\u5c06\u6587\u4e2d\u6240\u6709GPIO-TEST\u4fee\u6539\u4e3a\u4f60\u81ea\u5df1\u7684\u7a0b\u5e8f\u540d<\/p>\n\n\n\n<p> 1.   \u627e\u4e2a\u76ee\u5f55\u521b\u5efa\u6587\u4ef6\u5939\u7528\u6765\u5b58\u653e\u6253\u5305\u7684\u7a0b\u5e8f\uff0c<code>\/zdisk\/MY_GPIO-TEST<\/code> <\/p>\n\n\n\n<p>2.  \u5c06\u5de5\u7a0b\u7528Release\u6a21\u5f0f\u7f16\u8bd1\uff0c\u76f4\u63a5\u8fd0\u884c\u9879\u76ee\u5c31\u884c\u4e86 <\/p>\n\n\n\n<p>3.  \u6253\u5f00\u7f16\u8bd1\u51fa\u6587\u4ef6\u5939\u7684\u6587\u4ef6\uff0c\u6211\u7684\u8def\u5f84\u5982\u4e0b\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/zdisk\/qt-project\/build-GPIO-TEST-Desktop_Qt_5_7_0_GCC_64bit-Release<\/code><\/pre>\n\n\n\n<p>4.  \u5728Release\u6587\u4ef6\u5939\u521b\u5efa\u6587\u4ef6copylib.sh\uff0c\u5e76\u4fee\u6539\u6743\u9650\u4e3a777\uff0c\u6587\u4ef6\u5185\u5bb9\u5982\u4e0b\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>LibDir=$PWD\"\/lib\"\nTarget=$1\n\nlib_array=($(ldd $Target | grep -o \"\/.*\" | grep -o \"\/.*\/[^[:space:]]*\"))\n\n$(mkdir $LibDir)\n\nfor Variable in ${lib_array[@]}\ndo\n    cp \"$Variable\" $LibDir<\/code><\/pre>\n\n\n\n<p> 5. \u6253\u5f00\u7ec8\u7aef\u8fdb\u5230\u5f53\u524d\u6587\u4ef6\u5939\uff0c\u8f93\u5165<code>.\/copylib.sh GPIO-TEST<\/code>\uff0c\u4f1a\u4ea7\u751f\u4e00\u4e2alib\u6587\u4ef6\u5939\uff0c\u8fd9\u91cc\u79f0\u4e3a<strong>GPIO-TEST\u5e93\u6587\u4ef6<\/strong> <br><code> \u811a\u672c\u5b9e\u9645\u4e0a\u662f\u8c03\u7528\u4e86ldd GPIO-TEST\u6307\u4ee4\u83b7\u5f97GPIO-TEST\u8fd0\u884c\u65f6\u9700\u8981\u54ea\u4e9b\u5e93\uff0c\u5e76\u5c06\u5e93\u90fd\u590d\u5236\u653e\u5230\u5f53\u524d\u76ee\u5f55\u7684lib\u6587\u4ef6\u5939\u4e2d <\/code><\/p>\n\n\n\n<p>6.  \u5c06GPIO-TEST\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u548cGPIO-TEST\u7684\u5e93\u6587\u4ef6\u5939\u91cc\u7684\u6240\u6709\u7684\u6587\u4ef6\u590d\u5236\u5230MY_GPIO-TEST\u6587\u4ef6\u5939\u4e2d <\/p>\n\n\n\n<p>7.  \u8fdb\u5165QT\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u627e\u5230platforms\u6587\u4ef6\u5939\uff0c\u6211\u7684\u8def\u5f84\u5982\u4e0b\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/opt\/Qt5.7.0\/5.7\/gcc_64\/plugins\/platforms<\/code><\/pre>\n\n\n\n<p>8.  \u5c06\u4e0a\u6587\u7684copylib.sh\u653e\u5230platforms\u6587\u4ef6\u5939\u4e2d\uff0c\u5e76\u8fd0\u884c<code>.\/copylib.sh libqxcb.so<\/code>\uff0c\u8fd9\u65f6\u4f1a\u5f97\u5230libqxcb.so\u7684\u5e93\u6587\u4ef6\u5939 <\/p>\n\n\n\n<p>9.  \u5c06libqxcb.so\u7684\u5e93\u6587\u4ef6\u5939\u7684\u6240\u6709\u6587\u4ef6\u548cplatforms\u6587\u4ef6\u5939\u590d\u5236\u5230MY_GPIO-TEST\u6587\u4ef6\u5939\u4e2d <\/p>\n\n\n\n<p>10.  \u5728MY_GPIO-TEST\u6587\u4ef6\u5939\u4e2d\u65b0\u5efa\u811a\u672c<strong>GPIO-TEST.sh<\/strong>,\u6267\u884c<code>chmod 777 GPIO-TEST.sh<\/code>,\u5e76\u5728\u5176\u4e2d\u52a0\u5165\u5982\u4e0b\u4ee3\u7801\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\nappname=`basename $0 | sed s,\\.sh$,,`\n\ndirname=`dirname $0`\ntmp=\"${dirname#?}\"\n\nif [ \"${dirname%$tmp}\" != \"\/\" ]; then\ndirname=$PWD\/$dirname\nfi\nLD_LIBRARY_PATH=$dirname\nexport LD_LIBRARY_PATH\n$dirname\/$appname \"$@\"<\/code><\/pre>\n\n\n\n<p>11.  \u5230\u8fd9\u91cc\u5c31\u57fa\u672c\u5b8c\u6210\u4e86\uff0c\u5c06MY_GPIO-TEST\u6587\u4ef6\u5939\u590d\u5236\u5230\u9700\u8981\u8fd0\u884c\u7a0b\u5e8f\u7684\u76ee\u6807\u4e3b\u673a\u5373\u53ef\uff0c\u5728\u76ee\u6807\u4e3b\u673a\u4e2d\uff0c\u8fd0\u884c\u7a0b\u5e8f\uff0c\u90fd\u91c7\u7528<strong> .\/GPIO-TEST.sh<\/strong> \u800c\u4e0d\u662f.\/GPIO-TEST\uff0c\u5373\u8fd0\u884c\u7a0b\u5e8f\u7684sh\u811a\u672c\uff0c\u800c\u4e0d\u662f\u4e8c\u8fdb\u5236\u6587\u4ef6 <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p> \u4ee5\u4e0a\u5c31\u662f\u5728ubuntu\u4e0b\u4f7f\u7528\u811a\u672c\u6253\u5305QT\u7a0b\u5e8f\u7684\u65b9\u6cd5\uff01 <\/p>\n\n\n\n<p>\n\n\u53c2\u8003\u94fe\u63a5\uff1a<a href=\"https:\/\/blog.csdn.net\/z3512498\/article\/details\/64922180\">https:\/\/blog.csdn.net\/z3512498\/article\/details\/64922180<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu\u7248\u672c\uff1a18.04 QT\u7248\u672c\uff1a5.7.0 \u4f8b\u5982\u7a0b\u5e8f\u540d\u4e3aGPIO-TEST\uff0c\u8bf7\u5c06\u6587\u4e2d\u6240\u6709GPIO-TE\u2026 <span class=\"read-more\"><a href=\"http:\/\/iqotom.com\/?p=800\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":802,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,49],"tags":[50,73,72],"_links":{"self":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/800"}],"collection":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=800"}],"version-history":[{"count":2,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/800\/revisions"}],"predecessor-version":[{"id":803,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/posts\/800\/revisions\/803"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=\/wp\/v2\/media\/802"}],"wp:attachment":[{"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=800"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/iqotom.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}