本文介绍了RubyGem本机扩展 - 在-lsocket中找不到ntohl()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 以下是Google迄今为止还没有很有帮助的一个问题:Here's a question where Google hasn't been very helpful thus far:我在使用本机扩展的Linux Mint上安装RubyGem,所以它试图在我的机器上编译它们。通常情况下,它会返回一个错误,指出它没有构建扩展所需的全部工具:I'm installing a RubyGem on Linux Mint that uses native extension, so it's trying to compile them on my machine. As often happens, it returns an error stating that it doesn't have all the tools on the machine necessary to build the extension:Building native extensions. This could take a while...ERROR: Error installing sas-helper: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rbchecking for expat.h... yeschecking for XML_ParserCreate() in -lexpat... yeschecking for XML_SetNotStandaloneHandler()... yeschecking for XML_SetParamEntityParsing()... yeschecking for XML_SetDoctypeDeclHandler()... yeschecking for XML_ParserReset()... yeschecking for XML_SetSkippedEntityHandler()... yeschecking for XML_GetFeatureList()... yeschecking for XML_UseForeignDTD()... yeschecking for XML_GetIdAttributeIndex()... yeschecking for ntohl() in -lsocket... nocreating Makefilemakecompiling xmlparser.cxmlparser.c: In function ‘XMLParser_mark’:xmlparser.c:185:16: warning: variable ‘parent’ set but not used [-Wunused-but-set-variable]xmlparser.c: In function ‘iterExternalEntityRefHandler’:xmlparser.c:372:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]xmlparser.c: In function ‘myExternalEntityRefHandler’:xmlparser.c:832:9: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]xmlparser.c: In function ‘myStartCdataSectionHandler’:xmlparser.c:860:14: warning: variable ‘parser’ set but not used [-Wunused-but-set-variable]xmlparser.c: In function ‘myEndCdataSectionHandler’:xmlparser.c:868:14: warning: variable ‘parser’ set but not used [-Wunused-but-set-variable]xmlparser.c: In function ‘myNotStandaloneHandler’:xmlparser.c:898:14: warning: variable ‘parser’ set but not used [-Wunused-but-set-variable]xmlparser.c: In function ‘myEndDoctypeDeclHandler’:xmlparser.c:939:14: warning: variable ‘parser’ set but not used [-Wunused-but-set-variable]xmlparser.c: In function ‘XMLParser_parse’:xmlparser.c:1783:2: error: format not a string literal and no format arguments [-Werror=format-security]xmlparser.c:1832:5: error: format not a string literal and no format arguments [-Werror=format-security]cc1: some warnings being treated as errorsmake: *** [xmlparser.o] Error 1我看过谷歌,并没有发现任何与这种情况相关的东西。看来我错过了这个ntohl()函数,谁能告诉我在哪个Debian包中我可以找到这个函数?I've looked on Google, and haven't found much of anything that looks relevant to this situation. It appears that I'm missing this ntohl() function, can anyone tell me in which Debian package I can find this function?推荐答案您必须设置正确的编译器标志: https://github.com/sparklemotion/nokogiri/issues/680#issuecomment-5830358You have to setup proper compiler flag: https://github.com/sparklemotion/nokogiri/issues/680#issuecomment-5830358 gem install xmlparser - --with-cflags = - Wformat-securityroot@c6d50bebf05f:/var/lib/gems/2.0.0/gems# gem install xmlparser -- --with-cflags="-Wformat-security"Building native extensions with: '--with-cflags=-Wformat-security'This could take a while...Successfully installed xmlparser-0.7.2.1Parsing documentation for xmlparser-0.7.2.1unable to convert "\xA0" from ASCII-8BIT to UTF-8 for /var/lib/gems/2.0.0/extensions/x86_64-linux/2.0.0/xmlparser-0.7.2.1/xmlparser.so, skippingunable to convert "\xCD" from ASCII-8BIT to UTF-8 for README.ja, skippingunable to convert "\xC0" from ASCII-8BIT to UTF-8 for ext/xmlparser.o, skippingunable to convert "\xA0" from ASCII-8BIT to UTF-8 for ext/xmlparser.so, skippingunable to convert "\xA0" from ASCII-8BIT to UTF-8 for lib/xmlparser.so, skippingInstalling ri documentation for xmlparser-0.7.2.11 gem installed 这篇关于RubyGem本机扩展 - 在-lsocket中找不到ntohl()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
05-19 14:59