红联Linux门户
Linux帮助

Ubuntu下编译libxml2出错

发布时间:2015-10-05 10:02:35来源:linux网站作者:拿破仑的海阔天空

出错信息如下:(在ContOS下正常)

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);


Linux环境下C使用的xml解析库:libxml2:http://www.linuxdiyf.com/linux/10901.html