`
jiangshuiy
  • 浏览: 336158 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Ubuntu下编译libxml2出错

阅读更多
出错信息如下:

gcc -DHAVE_CONFIG_H -I. -I. -I. -I./include -I./include -D_REENTRANT -g -O2 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -MT nanohttp.lo -MD -MP -MF .deps/nanohttp.Tpo -c nanohttp.c  -fPIC -DPIC -o .libs/nanohttp.o
nanohttp.c: In function 'xmlNanoHTTPFetch__internal_alias':
nanohttp.c:1558: warning: ignoring return value of 'write', declared with attribute warn_unused_result
nanohttp.c: In function 'xmlNanoHTTPSave__internal_alias':
nanohttp.c:1597: warning: ignoring return value of 'write', declared with attribute warn_unused_result
In function 'open',
    inlined from 'xmlNanoHTTPSave__internal_alias' at nanohttp.c:1588:
/usr/include/bits/fcntl2.h:51: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[1]: *** [nanohttp.lo] Error 1
make[1]: Leaving directory `/home/winetcn/libxml2-2.6.30'
make: *** [install-recursive] Error 1

解决方法:
打开目录下的nanohttp.c,第1588行由
fd = open(filename, O_CREAT | O_WRONLY);更换为
fd = open(filename, O_CREAT | O_WRONLY,0777);


参考资料:
http://temix.blog.163.com/blog/static/364133200810237854799/

偶遇gcc-4.3 fcntl2.h错误

/usr/include/bits/fcntl2.h:51: 错误: 调用‘__open_missing_mode’,声明有错误属性:open with O_CREAT in second argument needs 3 arguments

网上查了一下,说是gcc-4.3对语法检查严格的结果,找到出错的那一句,在我编译的程序里是这句
int fd = open(fn.c_str(), O_WRONLY | O_CREAT | O_TRUNC);
将之改为
int fd = open(fn.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0777);
就OK了

参考资料:
http://linux.chinaunix.net/techdoc/system/2008/11/08/1044060.shtml
https://bugs.launchpad.net/ubuntu/+source/gcc-4.3/+bug/286565
分享到:
评论
1 楼 spider_bug 2013-03-21  
     
吃水不忘打井人,谢谢了,gentoo上编译也有这个错误

相关推荐

Global site tag (gtag.js) - Google Analytics