php 5.2.17 소스 컴파일시 오류 (node.c: In function 'dom_canonicalization')

리눅스/PHP|2019. 2. 13. 16:02
반응형

php 소스 컴파일시 아래와 같은 오류가 발생하는 경우가 있다. 


gcc 4.7 버전에서 아래와 같은 오류가 발생한다. 


/home/segio_php/php-5.2.17/ext/dom/node.c: In function ‘dom_canonicalization’:

/home/segio_php/php-5.2.17/ext/dom/node.c:1953:21: error: dereferencing pointer to incomplete type

/home/segio_php/php-5.2.17/ext/dom/node.c:1955:5: error: dereferencing pointer to incomplete type



이때는 아래와 같은 순서로 php 소스를 패치하면 오류가 사라진다. 


(소스 디렉토리에서)

# wget -O php.patch  https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt

# patch -p0 -b < php.patch

patching file ext/dom/node.c

Hunk #1 succeeded at 1950 (offset 55 lines).

patching file ext/dom/documenttype.c

Hunk #1 succeeded at 215 (offset 10 lines).

patching file ext/simplexml/simplexml.c

Hunk #1 succeeded at 1343 (offset -74 lines).


patch 명령어를 찾을 수 없다고 할 경우 yum -y install patch


위와 같이 패치를 적용한 후 컴파일을 하면 문제없이 진행된다. 


[출처] http://blog.naver.com/ssik425/10175143994



===================== php.patch 내용 ====================

--- ext/dom/node.c	2012-08-06 17:49:48.826716692 +0800
+++ ext/dom/node.c	2012-08-06 17:52:47.633484660 +0800
@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA
         RETVAL_FALSE;
     } else {
 		if (mode == 0) {
+#ifdef LIBXML2_NEW_BUFFER
+            ret = xmlOutputBufferGetSize(buf);
+#else
 			ret = buf->buffer->use;
+#endif
 			if (ret > 0) {
+#ifdef LIBXML2_NEW_BUFFER
+                RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1);
+#else
 				RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
+#endif
 			} else {
 				RETVAL_EMPTY_STRING();
 			}
--- ext/dom/documenttype.c	2012-08-06 18:02:16.019640870 +0800
+++ ext/dom/documenttype.c	2012-08-06 18:06:16.612228905 +0800
@@ -205,7 +205,13 @@ int dom_documenttype_internal_subset_rea
 		if (buff != NULL) {
 			xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL);
 			xmlOutputBufferFlush(buff);
+
+#ifdef LIBXML2_NEW_BUFFER
+			ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff),
+			             xmlOutputBufferGetSize(buff), 1);
+#else
 			ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1);
+#endif
 			(void)xmlOutputBufferClose(buff);
 			return SUCCESS;
 		}
--- ext/simplexml/simplexml.c	2012-08-06 18:10:44.621017026 +0800
+++ ext/simplexml/simplexml.c	2012-08-06 18:12:48.016270419 +0800
@@ -1417,7 +1417,12 @@ SXE_METHOD(asXML)
 
 			xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding);
 			xmlOutputBufferFlush(outbuf);
+#ifdef LIBXML2_NEW_BUFFER
+			RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf),
+			               xmlOutputBufferGetSize(outbuf), 1);
+#else
 			RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1);
+#endif
 			xmlOutputBufferClose(outbuf);
 		}
 	} else {

======================================================




반응형

댓글()