RubyGem本机扩展 - 在-lsocket中找不到ntohl() [英] RubyGem Native Extension - can't find ntohl() in -lsocket

查看:388
本文介绍了RubyGem本机扩展 - 在-lsocket中找不到ntohl()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是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.rb
checking for expat.h... yes
checking for XML_ParserCreate() in -lexpat... yes
checking for XML_SetNotStandaloneHandler()... yes
checking for XML_SetParamEntityParsing()... yes
checking for XML_SetDoctypeDeclHandler()... yes
checking for XML_ParserReset()... yes
checking for XML_SetSkippedEntityHandler()... yes
checking for XML_GetFeatureList()... yes
checking for XML_UseForeignDTD()... yes
checking for XML_GetIdAttributeIndex()... yes
checking for ntohl() in -lsocket... no
creating Makefile

make
compiling xmlparser.c
xmlparser.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 errors
make: *** [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-5830358

You have to setup proper compiler flag: https://github.com/sparklemotion/nokogiri/issues/680#issuecomment-5830358

gem install xmlparser - --with-cflags = - Wformat-security

root@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.1
Parsing documentation for xmlparser-0.7.2.1
unable 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, skipping
unable to convert "\xCD" from ASCII-8BIT to UTF-8 for README.ja, skipping
unable to convert "\xC0" from ASCII-8BIT to UTF-8 for ext/xmlparser.o, skipping
unable to convert "\xA0" from ASCII-8BIT to UTF-8 for ext/xmlparser.so, skipping
unable to convert "\xA0" from ASCII-8BIT to UTF-8 for lib/xmlparser.so, skipping
Installing ri documentation for xmlparser-0.7.2.1
1 gem installed

这篇关于RubyGem本机扩展 - 在-lsocket中找不到ntohl()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆