{"id":4871,"date":"2020-12-11T11:07:03","date_gmt":"2020-12-11T03:07:03","guid":{"rendered":"https:\/\/damogame.cn\/wordpress\/?p=4871"},"modified":"2020-12-11T11:07:03","modified_gmt":"2020-12-11T03:07:03","slug":"c-c%e5%b8%b8%e8%a7%81gcc%e7%bc%96%e8%af%91%e8%bf%9e%e6%8e%a5%e9%94%99%e8%af%af%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/4871","title":{"rendered":"C\/C++\u5e38\u89c1gcc\u7f16\u8bd1\u8fde\u63a5\u9519\u8bef\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p><a href=\"https:\/\/www.cnblogs.com\/guozht\/articles\/7591842.html\">\u539f\u6587\u5730\u5740<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;std::basic_string&lt;unsigned char,=&#8221;&#8221; std::basic_string\u9664\u975e\u660e\u786e\u8bf4\u660e\uff0c\u672c\u6587\u5185\u5bb9\u4ec5\u9488\u5bf9x86\/x86_64\u7684Linux\u5f00\u53d1\u73af\u5883\uff08\u52a0\u7c97\u5b57\u4f53\u662f\u5173\u952e\u8bcd\uff09\uff1a<\/p>\n<p>\u7528\u201c-Wl,-Bstatic\u201d\u6307\u5b9a\u94fe\u63a5\u9759\u6001\u5e93\uff0c\u4f7f\u7528\u201c-Wl,-Bdynamic\u201d\u6307\u5b9a\u94fe\u63a5\u5171\u4eab\u5e93\uff0c\u4f7f\u7528\u793a\u4f8b\uff1a<br \/>\n-Wl,-Bstatic -lmysqlclient_r -lssl -lcrypto -Wl,-Bdynamic -lrt -Wl,-Bdynamic -pthread -Wl,-Bstatic -lgtest<br \/>\n\uff08&#8221;-Wl&#8221;\u8868\u793a\u662f\u4f20\u9012\u7ed9\u94fe\u63a5\u5668ld\u7684\u53c2\u6570\uff0c\u800c\u4e0d\u662f\u7f16\u8bd1\u5668gcc\/g++\u7684\u53c2\u6570\u3002\uff09<\/p>\n<p>1) \u4e0b\u9762\u662f\u56e0\u4e3a\u6ca1\u6709\u6307\u5b9a\u94fe\u63a5\u53c2\u6570-lz\uff08\/usr\/lib\/libz.so\uff0c\/usr\/lib\/libz.a \uff09<br \/>\n\/usr\/local\/mysql\/lib\/mysql\/libmysqlclient.a(my_compress.c.o): In function `my_uncompress&#8217;:<br \/>\n\/home\/software\/mysql-5.5.24\/mysys\/my_compress.c:122: undefined reference to `uncompress&#8217;<br \/>\n\/usr\/local\/mysql\/lib\/mysql\/libmysqlclient.a(my_compress.c.o): In function `my_compress_alloc&#8217;:<br \/>\n\/home\/software\/mysql-5.5.24\/mysys\/my_compress.c:71: undefined reference to `compress&#8217;<\/p>\n<p>2) \u4e0b\u9762\u662f\u56e0\u4e3a\u6ca1\u6709\u6307\u5b9a\u7f16\u8bd1\u94fe\u63a5\u53c2\u6570-pthread\uff08\u6ce8\u610f\u4e0d\u4ec5\u4ec5\u662f-lpthraed\uff09<br \/>\n\/usr\/local\/mysql\/lib\/mysql\/libmysqlclient.a(charset.c.o): In function `get_charset_name&#8217;:<br \/>\n\/home\/zhangsan\/mysql-5.5.24\/mysys\/charset.c:533: undefined reference to `pthread_once&#8217;<\/p>\n<p>3) \u4e0b\u9762\u8fd9\u4e2a\u662f\u56e0\u4e3a\u6ca1\u6709\u6307\u5b9a\u94fe\u63a5\u53c2\u6570-lrt<br \/>\n\/usr\/local\/thirdparty\/curl\/lib\/libcurl.a(libcurl_la-timeval.o): In function `curlx_tvnow&#8217;:<br \/>\ntimeval.c:(.text+0xe9): undefined reference to `clock_gettime&#8217;<\/p>\n<p>4) \u4e0b\u9762\u8fd9\u4e2a\u662f\u56e0\u4e3a\u6ca1\u6709\u6307\u5b9a\u94fe\u63a5\u53c2\u6570-ldl<br \/>\n\/usr\/local\/thirdparty\/openssl\/lib\/libcrypto.a(dso_dlfcn.o): In function `dlfcn_globallookup&#8217;:<br \/>\ndso_dlfcn.c:(.text+0x4c): undefined reference to `dlopen&#8217;<br \/>\ndso_dlfcn.c:(.text+0x62): undefined reference to `dlsym&#8217;<br \/>\ndso_dlfcn.c:(.text+0x6c): undefined reference to `dlclose&#8217;<\/p>\n<p>5) \u4e0b\u9762\u8fd9\u4e2a\u662f\u56e0\u4e3a\u6307\u5b9a\u4e86\u94fe\u63a5\u53c2\u6570-static\uff0c\u5b83\u7684\u5b58\u5728\uff0c\u8981\u6c42\u94fe\u63a5\u7684\u5fc5\u987b\u662f\u9759\u6001\u5e93\uff0c\u800c\u4e0d\u80fd\u662f\u5171\u4eab\u5e93<br \/>\nld: attempted static link of dynamic object<br \/>\n\u5982\u679c\u662f\u4ee5-L\u52a0-l\u65b9\u5f0f\u6307\u5b9a\uff0c\u5219\u76ee\u5f55\u4e0b\u5fc5\u987b\u6709.a\u6587\u4ef6\u5b58\u5728\uff0c\u5426\u5219\u4f1a\u62a5-l\u7684\u5e93\u6587\u4ef6\u627e\u4e0d\u5230\uff1ald: cannot find -lACE<\/p>\n<p>6) GCC\u7f16\u8bd1\u9047\u5230\u5982\u4e0b\u7684\u9519\u8bef\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u5728\u7f16\u8bd1\u65f6\u6ca1\u6709\u6307\u5b9a-fPIC\uff0c\u8bb0\u4f4f\uff1a-fPIC\u5373\u662f\u7f16\u8bd1\u53c2\u6570\uff0c\u4e5f\u662f\u94fe\u63a5\u53c2\u6570<br \/>\nrelocation R_x86_64_32S against `vtable for CMyClass` can not be used when making a shared object<\/p>\n<p>7) \u4e0b\u9762\u7684\u9519\u8bef\u8868\u793agcc\u7f16\u8bd1\u65f6\u9700\u8981\u5b9a\u4e49\u5b8f__STDC_FORMAT_MACROS\uff0c\u5e76\u4e14\u5fc5\u987b\u5305\u542b\u5934\u6587\u4ef6inttypes.h<br \/>\ntest.cpp:35: error: expected `)&#8217; before &#8216;PRIu64&#8242;<\/p>\n<p>8) \u4e0b\u9762\u662f\u56e0\u4e3a\u5728x86\u673a\u5668\uff0832\u4f4d\uff09\u4e0a\u7f16\u8bd1\u6ca1\u6709\u6307\u5b9a\u7f16\u8bd1\u53c2\u6570-march=pentium4<br \/>\n..\/..\/src\/common\/libmooon.a(logger.o): In function `atomic_dec_and_test&#8217;:<br \/>\n..\/..\/include\/mooon\/sys\/atomic_gcc.h:103: undefined reference to `__sync_sub_and_fetch_4&#8242;<\/p>\n<p>9) \u4e0b\u5217\u9519\u8bef\u53ef\u80fd\u662f\u56e0\u4e3a\u591a\u4e86\u4e2a\u201c}\u201d<br \/>\nerror: expected declaration before &#8216;}&#8217; token<\/p>\n<p>10) \u4e0b\u5217\u9519\u8bef\u53ef\u80fd\u662f\u56e0\u4e3a\u5c11\u4e86\u4e2a\u201c}\u201d<br \/>\nerror: expected `}&#8217; at end of input<\/p>\n<p>11) \u4e0b\u9762\u8fd9\u4e2a\u9519\u8bef\u662f\u7f16\u8bd1\u4e00\u4e2a\u5171\u4eab\u5e93\u65f6\uff0c\u8be5\u5171\u4eab\u5e93\u4f9d\u8d56\u7684\u4e00\u9759\u6001\u5e93\u7f16\u8bd1\u65f6\u6ca1\u6709\u52a0\u201c-fPIC\u201d\u53c2\u6570\uff0c\u89e3\u51b3\u65b9\u6cd5\u4e3a\u5e26\u201c-fPIC\u201d\u91cd\u65b0\u7f16\u8bd1\u88ab\u4f9d\u8d56\u7684\u9759\u6001\u5e93<br \/>\nrelocation R_X86_64_32 against `a local symbol&#8217; can not be used when making a shared object; recompile with -fPIC<\/p>\n<p>12) \u4e0b\u9762\u8fd9\u4e2a\u9519\u8bef\uff0c\u662f\u56e0\u4e3a\u5934\u6587\u4ef6\u4e2d\u4f7f\u7528\u201c_syscall0(pid_t, gettid)\u201d\u4e0d\u5f53\u5f15\u8d77\u7684<br \/>\n.\/test.o: In function `gettid()&#8217;:<br \/>\n.\/test.h:17: multiple definition of `gettid()&#8217;<\/p>\n<p>\u6b63\u786e\u7684\u7528\u6cd5\u662f\u4f7f\u7528&#8221;inline&#8221;\u6216&#8221;static inline&#8221;\u4fee\u9970\u4e00\u4e0b\uff1a<br \/>\ninline _syscall0(pid_t, gettid)<br \/>\n\u6216<br \/>\nstatic inline _syscall0(pid_t, gettid)<\/p>\n<p>\u5f53\u7136\u4e5f\u53ef\u4ee5\u8fd9\u6837\uff1a<br \/>\n\u5728.h\u5934\u6587\u4ef6\u4e2d\uff1aextern &#8220;C&#8221; pid_t gettid(void);<br \/>\n\u5728.cpp\u6587\u4ef6\u4e2d\uff1a_syscall0(pid_t, gettid)<\/p>\n<p>_syscall0\u662f\u4e00\u4e2a\u5b8f\uff0c\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u7684\u5b9e\u73b0\u3002<\/p>\n<p>13) \u4e0b\u5217\u7f16\u8bd1\u544a\u8b66\u662f\u56e0\u4e3a\u4e00\u4e2astatic\u7c7b\u578b\u7684\u51fd\u6570\u672a\u88ab\u4f7f\u7528<br \/>\nmy.cpp:364: warning: &#8216;int my_function(const cgicc::Cgicc&amp;, const std::string&amp;)&#8217; defined but not used<\/p>\n<p>\u53ea\u9700\u4f7f\u7528\u201c__attribute__((unused))\u201d\u4fee\u9970\u51fd\u6570\u7684\u58f0\u660e\u5373\u53ef\uff1a<br \/>\nstatic int __attribute__((unused)) my_function(const cgicc::Cgicc&amp;, const std::string&amp;);<\/p>\n<p>14) \u6267\u884cthrift\u7684configure\u65f6\u9047\u5230\u5982\u4e0b\u7684\u9519\u8bef\uff08thrift-0.9.0\u548cthrift-0.9.1\u9047\u5230\u8fc7\uff09\uff1a<br \/>\nchecking for setsockopt in -lsocket&#8230; no<br \/>\nchecking for BN_init in -lcrypto&#8230; no<br \/>\nconfigure: error: &#8220;Error: libcrypto required.&#8221;<\/p>\n<p>\u539f\u56e0\u53ef\u80fd\u662f\u56e0\u4e3a\u7f16\u8bd1\u5b89\u88c5openssl\u65f6\u6307\u5b9a\u4e86&#8211;prefix\uff0c\u6bd4\u5982&#8211;prefix=\/usr\/local\/thirdparty\/openssl\uff0c\u53ef\u8fd9\u6837\u89e3\u51b3\uff1a<br \/>\n\u4e0d\u6307\u5b9athrift\u7684configure\u7684&#8211;with-openssl=\/usr\/local\/thirdparty\/openssl\uff0c\u6539\u4e3a\uff1a<br \/>\nCPPFLAGS=&#8221;-I\/usr\/local\/thirdparty\/openssl\/include&#8221; LDFLAGS=&#8221;-ldl -L\/usr\/local\/thirdparty\/openssl\/lib&#8221;<br \/>\n\u66ff\u4ee3\u5b83\u5c31OK\u4e86\u3002<\/p>\n<p>15) \u4e0b\u9762\u8fd9\u4e2a\u7f16\u8bd1\u9519\u8bef\uff08\u8868\u73b0\u4e3ag++\u8fdb\u5165\u6b7b\u5faa\u73af\uff09\uff0c\u53ef\u80fd\u662f\u7531\u4e8e\u7f3a\u5c11\u53f3\u5927\u62ec\u53f7\u201c}\u201d\u5bfc\u81f4\u7684\uff0c\u6bd4\u5982\u5b9a\u4e49\u540d\u5b57\u7a7a\u95f4\u65f6\u5c11\u4e86\u201c}\u201d\uff1a<br \/>\n\/usr\/include\/c++\/4.1.2\/tr1\/type_traits:408: error: &#8216;size_t&#8217; is not a member of &#8216;db_proxy::std&#8217;<br \/>\n\/usr\/include\/c++\/4.1.2\/tr1\/type_traits:408: error: &#8216;size_t&#8217; is not a member of &#8216;db_proxy::std&#8217;<br \/>\n\/usr\/include\/c++\/4.1.2\/tr1\/mu_iterate.h:49: error: &#8216;std::tr1&#8217; has not been declared<br \/>\n\/usr\/include\/c++\/4.1.2\/tr1\/mu_iterate.h:49: error: &#8216;std::tr1&#8217; has not been declared<br \/>\n\/usr\/include\/c++\/4.1.2\/tr1\/bind_iterate.h:78: error: &#8216;std::tr1&#8217; has not been declared<br \/>\n\/usr\/include\/c++\/4.1.2\/tr1\/bind_iterate.h:78: error: &#8216;std::tr1&#8217; has not been declared<br \/>\n\/usr\/include\/c++\/4.1.2\/tr1\/bind_iterate.h:78: error: &#8216;std::tr1&#8217; has not been declared<\/p>\n<p>16) protoc\u7f16\u8bd1\u9519\u8bef\uff0c\u4e0b\u9762\u9519\u8bef\u662f\u56e0\u4e3a\u6ca1\u6709\u5728.proto\u6587\u4ef6\u6240\u5728\u76ee\u5f55\u4e0b\u6267\u884c\uff1a<br \/>\n\/tmp\/test.proto: File does not reside within any path specified using &#8211;proto_path (or -I). \u00a0You must specify a &#8211;proto_path which encompasses this file. \u00a0Note that the proto_path must be an exact prefix of the .proto file names &#8212; protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it&#8217;s harder than you think).<br \/>\n\u89e3\u51b3\u529e\u6cd5\u6709\u4e24\u4e2a\uff1a\u4e00\u662f\u5728.proto\u6587\u4ef6\u6240\u5728\u76ee\u5f55\u4e0b\u6267\u884cprotoc\uff0c\u4e8c\u662f\u4e3aprotoc\u6307\u5b9a\u53c2\u6570&#8211;proto_path\uff0c\u53c2\u6570\u503c\u4e3a.proto\u6587\u4ef6\u6240\u5728\u76ee\u5f55\u3002<\/p>\n<p>17) \u4e0b\u9762\u8fd9\u4e2a\u7f16\u8bd1\u9519\u8bef\uff0c\u53ef\u80fd\u662f\u56e0\u4e3a\u5728\u5168\u5c40\u57df\u5185\u8c03\u7528\u4e00\u4e2a\u7c7b\u5bf9\u8c61\u7684\u6210\u5458\u51fd\u6570\uff0c\u5168\u5c40\u57df\u5185\u662f\u4e0d\u80fd\u76f4\u63a5\u6267\u884c\u51fd\u7684\uff1a<br \/>\nerror: expected constructor, destructor, or type conversion before &#8216;-&gt;&#8217; token<\/p>\n<p>18) \u4e0b\u9762\u8fd9\u4e2a\u9519\u8bef\u662f\u56e0\u4e3a\u6ca1\u6709\u94fe\u63a5OpenSSL\u7684libcrypto\u5e93\uff0c\u6216\u8005\u4f7f\u7528\u4e86\u9759\u6001\u5e93\uff0c\u800c\u987a\u5e8f\u4e0d\u5bf9\uff1a<br \/>\nundefined symbol: EVP_enc_null<\/p>\n<p>19) \u4e0b\u5217\u662f\u94fe\u63a5\u9519\u8bef\uff0c\u4e0d\u662f\u7f16\u8bd1\u9519\u8bef\uff0c\u52a0\u4e0a\u201c-pthread\u201d\u5373\u53ef\uff0c\u6ce8\u610f\u4e0d\u662f\u201c-lpthread\u201d\uff1a<br \/>\n\/usr\/local\/mysql\/lib\/mysql\/libmysqlclient.a(charset.c.o): In function `get_charset_name&#8217;:<br \/>\n\/home\/software\/mysql-5.5.24\/mysys\/charset.c:533: undefined reference to `pthread_once&#8217;<br \/>\n\/usr\/local\/mysql\/lib\/mysql\/libmysqlclient.a(charset.c.o): In function `get_charset_number&#8217;:<\/p>\n<p>20) \u4f9d\u8d56OpenSSL\uff08\u5047\u8bbe\u5b89\u88c5\u5728\/usr\/local\/thirdparty\/openssl-1.0.2a\uff09\u65f6\uff0c\u5982\u679c<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/thirdparty\/libssh2-1.6.0 &#8211;with-libssl-prefix=\/usr\/local\/thirdparty\/openssl-1.0.2a<br \/>\n\u65f6\u9047\u5230\u5982\u4e0b\u9519\u8bef\uff1a<br \/>\nconfigure: error: No crypto library found!<br \/>\nTry &#8211;with-libssl-prefix=PATH<br \/>\nor &#8211;with-libgcrypt-prefix=PATH<br \/>\nor &#8211;with-wincng on Windows<\/p>\n<p>\u53ef\u4ee5\u5982\u4e0b\u65b9\u6cd5\u89e3\u51b3\uff1a<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/thirdparty\/libssh2-1.6.0 &#8211;with-openssl CPPFLAGS=&#8221;-I\/usr\/local\/thirdparty\/openssl-1.0.2a\/include&#8221; LDFLAGS=&#8221;-L\/usr\/local\/thirdparty\/openssl-1.0.2a\/lib&#8221;<\/p>\n<p>21) \u9519\u8bef\u201cerror: expected primary-expression before \u2018;\u2019 token\u201d\u53ef\u80fd\u662f\u56e0\u4e3a\u5982\u4e0b\u539f\u56e0\uff1a<br \/>\nUserInfoInternal* user_info_internal = new UserInfoInternal;<br \/>\ndelete user_info; \/\/ \u8fd9\u91cc\u5e94\u5f53\u662fuser_info_internal<\/p>\n<p>22) \u4e0b\u9762\u8fd9\u4e2a\u7f16\u8bd1\u9519\u8bef\u7684\u539f\u56e0\u662f\u5b9a\u4e49\u5b57\u7b26\u4e32\u5b8f\u65f6\u6ca1\u6709\u52a0\u53cc\u5f15\u5f15\u53f7\uff1a<br \/>\nexample.cpp:563:16: error: too many decimal points in number<br \/>\n\u5982\u5b9a\u4e49\u6210\u4e86\uff1a#define IP1 127.0.0.1\uff0c\u6539\u6210#define IP1 &#8220;127.0.0.1&#8221;\u540e\u95ee\u9898\u5373\u89e3\u51b3\u3002<\/p>\n<p>23) \u4e0b\u9762\u8fd9\u4e2a\u7f16\u8bd1\u9519\u8bef\u662f\u56e0\u4e3ag++\u547d\u4ee4\u53c2\u6570\u6ca1\u5199\u5bf9\uff0c\u591a\u4e86\u4e2a\u201c-\u201d<br \/>\ng++: -E or -x required when input is from standard input<br \/>\n\u5982\uff1a<br \/>\nCPPFLAGS=-pthread &#8211;<br \/>\ng++ -g -o $@ $^ $(CPPFLAGS) $(LDFLAGS)<\/p>\n<p>24) libjson_7.6.1\u7f16\u8bd1\u9519\u8bef\uff1a<br \/>\nmakefile:180: Extraneous text after `else&#8217; directive<br \/>\nmakefile:183: *** only one `else&#8217; per conditional. \u00a0Stop.<br \/>\n\u89e3\u51b3\u529e\u6cd5\uff1a<br \/>\n\u627e\u5230makefile\u6587\u4ef6\u7684\u7b2c180\u884c\uff0c\u5c06\u201celse ifeq ($(BUILD_TYPE), debug)\u201d\uff0c\u6539\u6210\u4e24\u884c\u5185\u5d4c\u65b9\u5f0f\uff1a<br \/>\n# BUILD_TYPE specific settings<br \/>\nifeq ($(BUILD_TYPE), small)<br \/>\nCXXFLAGS \u00a0 \u00a0 = $(cxxflags_small)<br \/>\nelse<br \/>\nifeq ($(BUILD_TYPE), debug) # \u4e0d\u80fd\u548celse\u540c\u4e00\u884c\uff0c\u5426\u5219Makefile\u8bed\u6cd5\u9519\u8bef\uff0c\u4e0d\u652f\u6301else ifeq<br \/>\nCXXFLAGS \u00a0 \u00a0 = $(cxxflags_debug)<br \/>\nlibname \u00a0 \u00a0 := $(libname_debug)<br \/>\nelse<br \/>\nCXXFLAGS \u00a0 \u00a0?= $(cxxflags_default)<br \/>\nendif<br \/>\nendif<br \/>\n\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u6765\u8bbe\u7f6eBUILD_TYPE\uff0c\u5982\uff1aexport BUILD_TYPE=debug<br \/>\n\u4e5f\u53ef\u4ee5\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u6765\u8bbe\u7f6emake install\u65f6\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u5982\uff1aexport prefix=\/usr\/local\/libjson<\/p>\n<p>\u76f8\u5173\u5c0f\u77e5\u8bc6\uff1a<br \/>\n\u5728Makefile\u6587\u4ef6\u4e2d\uff0cprefix=\/usr\u548cprefix?=\/usr\uff0c\u662f\u6709\u533a\u522b\u7684\uff0c\u524d\u8005\u8d4b\u503c\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u8986\u76d6\uff0c\u540e\u8005\u5219\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf\u7684\u503c\u8986\u76d6\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u8bf7\u5c06\u7b2c271\u884c\u5220\u9664\uff1a<br \/>\ncp -rv $(srcdir)\/Dependencies\/ $(include_path)\/$(libname_hdr)\/$(srcdir)<br \/>\n\u6539\u6210\uff1a<br \/>\ncp -rv _internal\/Dependencies\/ $(include_path)\/$(libname_hdr)\/$(srcdir)<br \/>\n\u8fd8\u6709\u7b2c258\u884c\u524d\u63d2\u5165\u5982\u4e00\u6761\u547d\u4ee4\uff1a<br \/>\nmkdir -p $(inst_path)<br \/>\n\u5426\u5219\u201ccp -f .\/$(lib_target) $(inst_path)\u201d\uff0clib\u5c06\u6210\u5e93\u6587\u4ef6\u540d\u3002<\/p>\n<p>25\uff09 \u7f16\u8bd1gcc\u65f6\uff0c\u5982\u679c\u9047\u5230\u4e0b\u9762\u8fd9\u4e2a\u9519\u8bef\uff0c\u8fd9\u662f\u56e0\u4e3a\u8fd0\u884c\u65f6\u627e\u4e0d\u5230mpc\u3001mpfr\u548cgmp\u7684so\u6587\u4ef6\uff1a<br \/>\nchecking for x86_64-unknown-linux-gnu-nm&#8230; \/data\/gcc-4.8.2_src\/host-x86_64-unknown-linux-gnu\/gcc\/nm<br \/>\nchecking for x86_64-unknown-linux-gnu-ranlib&#8230; ranlib<br \/>\nchecking for x86_64-unknown-linux-gnu-strip&#8230; strip<br \/>\nchecking whether ln -s works&#8230; yes<br \/>\nchecking for x86_64-unknown-linux-gnu-gcc&#8230; \/data\/gcc-4.8.2_src\/host-x86_64-unknown-linux-gnu\/gcc\/xgcc -B\/data\/gcc-4.8.2_src\/host-x86_64-unknown-linux-gnu\/gcc\/ -B\/data\/gcc-4.8.2\/x86_64-unknown-linux-gnu\/bin\/ -B\/data\/gcc-4.8.2\/x86_64-unknown-linux-gnu\/lib\/ -isystem \/data\/gcc-4.8.2\/x86_64-unknown-linux-gnu\/include -isystem \/data\/gcc-4.8.2\/x86_64-unknown-linux-gnu\/sys-include<br \/>\nchecking for suffix of object files&#8230; configure: error: in `\/data\/gcc-4.8.2_src\/x86_64-unknown-linux-gnu\/libgcc&#8217;:<br \/>\nconfigure: error: cannot compute suffix of object files: cannot compile<br \/>\nSee `config.log&#8217; for more details.<br \/>\nmake[2]: *** [configure-stage1-target-libgcc] \u9519\u8bef 1<\/p>\n<p>\u6240\u4ee5\u53ea\u9700\u8981\u5982\u4e0b\u64cd\u4f5c\u4e0b\u5373\u53ef\uff1a<br \/>\nexport LD_LIBRARY_PATH=\/usr\/local\/mpc\/lib:\/usr\/local\/mpfr\/lib:\/usr\/local\/gmp\/lib:$LD_LIBRARY_PATH<\/p>\n<p>\u6ce8\uff1agcc-4.8.2\u4f9d\u8d56mpc\u3001mpfr\u548cgmp\uff1a<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/gcc-4.8.2 &#8211;with-mpc=\/usr\/local\/mpc-1.0.3 &#8211;with-mpfr=\/usr\/local\/mpfr-3.1.3 &#8211;with-gmp=\/usr\/local\/gmp-6.0.0<\/p>\n<p>\u800cmpc\u53c8\u4f9d\u8d56\u4e8e\uff1ampfr\u548cgmp\uff1a<br \/>\n.\/configure &#8211;prefix=\/usr\/local\/mpc-1.0.3 &#8211;with-mpfr=\/usr\/local\/mpfr-3.1.3 &#8211;with-gmp=\/usr\/local\/gmp-6.0.0<\/p>\n<p>26\uff09 \u7f16\u8bd1gcc\u65f6\uff0c\u5982\u679c\u9047\u5230\u4e0b\u9762\u8fd9\u4e2a\u9519\u8bef\uff1a<br \/>\nfatal error: gnu\/stubs-32.h: No such file or directory<br \/>\n\u8fd9\u662f\u56e0\u4e3a\u5728x86_64\u4e0a\uff0c\u9ed8\u8ba4\u4f1a\u7f16\u8bd1\u51fa32\u4f4d\u548c64\u4f4d\u4e24\u4e2a\u7248\u672c\u3002\u8fd9\u6837\u7f16\u8bd132\u4f4d\u65f6\uff0c\u9700\u8981\u673a\u5668\u4e0a\u670932\u4f4d\u7684libc\u5934\u6587\u4ef6\u548c\u5e93\u6587\u4ef6\uff0c\u4f46\u4e00\u4e9b\u673a\u5668\u4e0a\u53ef\u80fd\u6ca1\u6709\uff0c\u6bd4\u5982\u6ca1\u6709\/lib\u76ee\u5f55\uff0c\u53ea\u6709\/lib64\u76ee\u5f55\uff0c\u8fd9\u8868\u793a\u4e0d\u652f\u630132\u4f4d\u7684libc\u3002\u4e3a\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u53ef\u4ee5\u7981\u6b62\u7f16\u8bd132\u4f4d\u7248\u672c\uff0c\u5728configure\u65f6\u5e26\u4e0a\u53c2\u6570&#8211;disable-multilib\uff0c\u6216\u8005\u5b89\u88c532\u4f4d\u7248\u672c\u7684glibc\u3002<\/p>\n<p>27\uff09\u67d0\u6b21\u7f16\u8bd1\u9047\u5230\u5982\u4e0b\u8fd9\u6837\u4e00\u4e2a\u94fe\u63a5\u9519\u8bef\uff1a<br \/>\nredis_dbi.cpp:224: undefined reference to `sdscatlen(char*, void const*, unsigned long)&#8217;<br \/>\n\u6309\u5e38\u7406\uff0c\u8fd9\u4e2a\u9519\u8bef\u8981\u4e48\u662f\u6ca1\u6709\u6307\u5b9a\u76f8\u5e94\u7684\u5e93\uff0c\u8981\u4e48\u662f\u9759\u6001\u5e93\u95f4\u7684\u987a\u5e8f\u95ee\u9898\u3002<\/p>\n<p>\u4f46\u7ecf\u8fc7\u68c0\u67e5\uff0c\u8fd9\u4e24\u4e2a\u539f\u56e0\uff0c\u800c\u662f\u56e0\u4e3agcc\u548cg++\u6df7\u7528\u539f\u56e0\uff1a<br \/>\n1. \u5e93libhiredis.a\u548clibhiredis.so\u662f\u7531gcc\u7f16\u8bd1\u51fa\u6765\u7684<br \/>\n2. \u800c\u8c03\u7528\u5b83\u7684\u4ee3\u7801\u662f\u7531g++\u7f16\u8bd1\u7684\uff0c\u56e0\u6b64\u5bfc\u81f4\u4e86\u6b64\u95ee\u9898\u3002<\/p>\n<p>\u95ee\u9898\u7684\u89e3\u51b3\u529e\u6cd5\u6709\u4e24\u4e2a\uff1a<br \/>\n1. \u4fee\u6539sdscatlen\u6240\u5728\u7684.h\u6587\u4ef6\uff0c\u5c06\u4ee3\u7801\u4f7f\u7528<br \/>\n#ifdef __cplusplus<br \/>\nextern &#8220;C&#8221; {<br \/>\n#endif<br \/>\n\u4fee\u9970\u8d77\u6765\uff0c\u6216\u8005\u76f4\u63a5\u4f7f\u7528\u201cextern C\u201d\u4fee\u9970\u51fd\u6570sdscatlen\u3002<\/p>\n<p>2. \u4e0d\u4fee\u6539redis\u7684\u4ee3\u7801\uff0c\u5728\u5f15\u7528sds.h\u65f6\u52a0\u4e0a\u201cextern &#8220;C&#8221; {\u201d\uff1a<br \/>\nextern &#8220;C&#8221; {<br \/>\n#include &#8220;sds.h&#8221;<br \/>\n}<\/p>\n<p>\u4e0a\u9762\u4e24\u4e2a\u529e\u6cd5\u5747\u53ef\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u8003\u8651\u6539\u7528g++\u7f16\u8bd1redis\uff0c\u4e0d\u8fc7\u53ef\u80fd\u4f1a\u9047\u5230\u5f88\u591a\u9519\u8bef\u3002<br \/>\nredis\u5bf9\u5916\u4f9b\u5916\u90e8\u76f4\u63a5\u4f7f\u7528\u7684\u5934\u6587\u4ef6hiredis.h\u5df2\u4f7f\u7528\u4e86extern &#8220;C&#8221; {\uff0c\u6240\u4ee5\u4e0d\u5b58\u5728\u95ee\u9898\uff0c\u53ea\u6709\u5f53\u8df3\u8fc7hiredis.h\uff0c\u53bb\u4f7f\u7528\u4e00\u4e9b\u5185\u90e8\u5934\u6587\u4ef6\u65f6\u9700\u8981\u6ce8\u610f\u4e00\u4e0b\u3002<\/p>\n<p>28\uff09x.hpp:27: error: expected identifier before string constant<br \/>\nx.hpp:27: error: expected `}&#8217; before string constant<br \/>\nx.hpp:27: error: expected unqualified-id before string constant<\/p>\n<p>\u8fd9\u4e2a\u9519\u8bef\uff0c\u53ef\u80fd\u662f\u5b58\u5728\u548c\u679a\u4e3e\u7b49\u540c\u540d\u7684\u5b57\u7b26\u4e32\u5b8f\uff0c\u6bd4\u5982\u5b58\u5728\u4e0b\u9762\u7684\u5b8f\u5b9a\u4e49\uff1a<br \/>\nenum DBTYPE<br \/>\n{<br \/>\nUNDEFINE = 0,<br \/>\nMYSQL_DB = 1,<br \/>\nORACLE_DB = 2<br \/>\n};<\/p>\n<p>\u800c\u53e6\u4e00.h\u6587\u4ef6\u4e2d\u5b9a\u4e49\u4e86\u5b8f\uff1a<br \/>\n#define MYSQL_DB &#8220;mysql&#8221;<\/p>\n<p>29) \u4e0b\u9762\u8fd9\u4e2a\u9519\u8bef\u662f\u56e0\u4e3a\u7c7b\u6210\u5458\u51fd\u6570\u7684\u58f0\u660e\u548c\u5b9a\u4e49\u7684\u8fd4\u56de\u503c\u4e0d\u76f8\u540c<br \/>\ntest.cpp:201:6: \u9519\u8bef\uff1a\u2018bool foo(const string&amp;, const string&amp;, const string&amp;, const string&amp;, const string&amp;, const HBaseRowValue&amp;)\u2019\u7684\u539f\u578b\u4e0d\u5339\u914d\u7c7b\u2018CTest\u2019\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a<br \/>\nbool CHBaseOper::foo(const std::string&amp; tablename, const std::string&amp; rowkey, const std::string&amp; familyname, const std::string&amp; columnname, const std::string&amp; columnvalue, const HBaseRowValue&amp; row_values)<br \/>\n^<br \/>\nIn file included from test.cpp:8:0:<br \/>\ntest.h:58:6: \u9519\u8bef\uff1a\u5907\u9009\u4e3a\uff1aint foo(const string&amp;, const string&amp;, const string&amp;, const string&amp;, const string&amp;, const HBaseRowValue&amp;)<br \/>\nint foo(const std::string&amp; tablename, const std::string&amp; rowkey, const std::string&amp; familyname, const std::string&amp; columnname, const std::string&amp; columnvalue, const HBaseRowValue&amp; row_values);<\/p>\n<p>30)<br \/>\nmessenger.cpp:5: error: expected unqualified-id before &#8216;:&#8217; token<br \/>\n\u8be5\u7f16\u8bd1\u9519\u8bef\u539f\u56e0\u662f\uff1a<br \/>\nCMessager:CMessager()<br \/>\n{<br \/>\n}<br \/>\n\u5373\u5c11\u4e86\u4e2a\u5192\u53f7\uff1a<br \/>\nCMessager::CMessager()<br \/>\n{<br \/>\n}<\/p>\n<p>31) unable to find a register to spill in class \u2018SIREG\u2019<br \/>\n\u7f16\u8bd1\u65f6\u5982\u679c\u9047\u5230\u8fd9\u4e2a\u9519\u8bef\uff0c\u8868\u793a\u9047\u5230\u4e00\u4e2agcc\u7684bug\uff0c\u6700\u7b80\u5355\u7684\u529e\u6cd5\u662f\u53bb\u6389\u7f16\u8bd1\u53c2\u6570\u4e2d\u7684-O3\u7b49\u4f18\u5316\u9879\uff0c\u7136\u540e\u518d\u8bd5\u53ef\u80fd\u5c31\u6210\u529f\u4e86\uff0c\u4e5f\u53ef\u4ee5\u8003\u8651\u6307\u5b9a-fno-schedule-insns\u3002<\/p>\n<p>32\uff09\u50cf\u4e0b\u9762\u8fd9\u6837\u4e00\u5927\u5806\u4e71\u4e03\u516b\u7cdf\u7684\u9519\u8bef\uff0c\u53ef\u4ee5\u8003\u8651\u662f\u5426\u4e3a\u5c11\u4e86\u201c}\u201d\u7b49\u5f15\u8d77\u7684<br \/>\n\/usr\/include\/c++\/4.8.2\/bits\/stl_list.h:131:15: \u9519\u8bef\uff1a\u2018bidirectional_iterator_tag\u2019\u4e0d\u662f\u547d\u540d\u7a7a\u95f4\u2018gongyi::std\u2019\u4e2d\u7684\u4e00\u4e2a\u7c7b\u578b\u540d<br \/>\ntypedef std::bidirectional_iterator_tag \u00a0 \u00a0iterator_category;<br \/>\n^<br \/>\n\/usr\/include\/c++\/4.8.2\/bits\/stl_list.h: \u5728\u6210\u5458\u51fd\u6570\u2018_Tp* gongyi::std::_List_iterator&lt;_tp&gt;::operator-&gt;() const\u2019\u4e2d:<br \/>\n\/usr\/include\/c++\/4.8.2\/bits\/stl_list.h:150:16: \u9519\u8bef\uff1a\u2018__addressof\u2019\u4e0d\u662f\u2018gongyi::std\u2019\u7684\u6210\u5458<br \/>\n{ return std::__addressof(static_cast&lt;_Node*&gt;(_M_node)-&gt;_M_data); }<br \/>\n\u6bd4\u5982\uff1a<br \/>\nnamespace A { namespace B {<br \/>\n\u3002\u3002\u3002\u3002\u3002\u3002<br \/>\n\/\/ \u4e0b\u9762\u5c11\u4e86\u4e00\u4e2a\u201c}\u201d<br \/>\n} \/\/ namespace A { namespace B {<\/p>\n<p>33\uff09crc32\u2019 cannot be used as a function<br \/>\nuint32_t crc32 = crc32(0L, (const unsigned char*)crc32_str.data(), crc32_str.size());<br \/>\n\u9519\u8bef\u662f\u56e0\u4e3a\u51fd\u6570\u540d\u548c\u53d8\u91cf\u540d\u76f8\u540c\u4e86\uff0c\u53ef\u4ee5\u6539\u6210\u5982\u4e0b\u89e3\u51b3\uff1a<br \/>\nuint32_t crc32 = ::crc32(0L, (const unsigned char*)crc32_str.data(), crc32_str.size());<\/p>\n<p>34)<br \/>\n\/data\/X\/mooon\/tools\/hbase_stress.cpp: In function &#8216;void test_write(const std::map&lt;std::basic_string, std::basic_string &gt;&amp;)&#8217;:<br \/>\n\/data\/X\/mooon\/tools\/hbase_stress.cpp:78:117: error: invalid conversion from &#8216;void (*)(uint8_t, const string&amp;, uint16_t) {aka void (*)(unsigned char, const std::basic_string&amp;, short unsigned int)}&#8217; to &#8216;mooon::sys::FunctionWith3Parameter&lt;unsigned char, std::basic_string, short unsigned int&gt;::FunctionPtr {aka void (*)(unsigned char, std::basic_string, short unsigned int)}&#8217; [-fpermissive]<br \/>\nstress_threads[i] = new mooon::sys::CThreadEngine(mooon::sys::bind(write_thread, i, hbase_ip, hbase_port)); \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 ^<br \/>\nIn file included from \/data\/X\/mooon\/tools\/hbase_stress.cpp:24:0:<br \/>\n\/data\/X\/mooon\/tools\/..\/include\/mooon\/sys\/thread_engine.h:777:16: error: \u00a0 initializing argument 1 of &#8216;mooon::sys::Functor mooon::sys::bind(typename mooon::sys::FunctionWith3Parameter&lt;Parameter1Type, Parameter2Type, Parameter3Type&gt;::FunctionPtr, Parameter1Type, Parameter2Type, Parameter3Type) [with Parameter1Type = unsigned char; Parameter2Type = std::basic_string; Parameter3Type = short unsigned int; typename mooon::sys::FunctionWith3Parameter&lt;Parameter1Type, Parameter2Type, Parameter3Type&gt;::FunctionPtr = void (*)(unsigned char, std::basic_string, short unsigned int)]&#8217; [-fpermissive]<br \/>\ninline Functor bind(typename FunctionWith3Parameter&lt;Parameter1Type, Parameter2Type, Parameter3Type&gt;::FunctionPtr function_ptr, Parameter1Type parameter1, Parameter2Type parameter2, Parameter3Type parameter3)<\/p>\n<p>\u4e0a\u9762\u8fd9\u4e2a\u9519\u8bef\u7684\u610f\u601d\u662f\u7b2c\u4e00\u4e2a\u53c2\u6570\u7684\u7c7b\u578b\u4e3a<br \/>\nvoid (*)(unsigned char, std::basic_string, short unsigned int)<br \/>\n\u4f46\u4f20\u5165\u7684\u7c7b\u578b\u4e3a<br \/>\nvoid (*)(unsigned char, const std::basic_string&amp;, short unsigned int)<\/p>\n<p>\u4ece\u4e0a\u9762\u7684\u5bf9\u6bd4\u53ef\u4ee5\u770b\u51fa\uff0c\u8981\u6c42\u51fd\u6570\u7684\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3astd::string\u7c7b\u578b\uff0c\u800c\u4e0d\u662fconst std::string&amp;\u7c7b\u578b\u3002<\/p>\n<p>35) conflicting declaration<br \/>\nhas a previous declaration as<br \/>\n\u8fd9\u4e2a\u9519\u8bef\u53ef\u80fd\u662f\u56e0\u4e3a\u5934\u6587\u4ef6\u6ca1\u6709#ifndef\uff0c\u5bfc\u81f4\u5f15\u5165\u591a\u6b21\u3002<\/p>\n<p>36\uff09 warning: cannot pass objects of non-POD type \u2018const struct std::basic_string&lt;char, std::char_traits, std::allocator &gt;\u2019 through \u2018&#8230;\u2019; call will abort at runtime<br \/>\nwarning: format \u2018%s\u2019 expects type \u2018char*\u2019, but argument 3 has type \u2018int<br \/>\n\u8fd9\u4e2a\u9519\u8bef\u662f\u56e0\u4e3a\u683c\u5f0f\u5316%s\u53c2\u6570\u7684\u503c\u4e3astd::string\u503c\uff0c\u8fd9\u4e2a\u5728\u8fd0\u884c\u65f6\u53ef\u80fd\u4f1a\u89e6\u53d1SIGILL\uff08Illegal instruction\uff09\uff0c\u4f8b\u5982\uff1a<br \/>\nstd::string type;<br \/>\nstd::string name;<br \/>\n\u3002\u3002\u3002 \u3002\u3002\u3002<br \/>\nconst std::string&amp; key = mooon::utils::CStringUtils::format_string(&#8220;%s_%s&#8221;, type.c_str(), name);<\/p>\n<div><\/div>\n<p>&lt;\/std::basic_string<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740 &nbsp; &lt;std:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[117],"class_list":["post-4871","post","type-post","status-publish","format-standard","hentry","tag-01-linux"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/4871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=4871"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/4871\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=4871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=4871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=4871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}