728x90
반응형
php make를 진행하던 중 아래와 같은 에러가 발생하였다.
/home/php-5.1.4_nts/install/php-5.1.4/ext/simplexml/simplexml.c:1223:38: error: dereferencing pointer to incomplete type strval = xmlStrndup(outbuf->buffer->content, outbuf->buffer->use);
/home/php-5.1.4_nts/install/php-5.1.4/ext/simplexml/simplexml.c:1223:63: error: dereferencing pointer to incomplete type strval = xmlStrndup(outbuf->buffer->content, outbuf->buffer->use);
make: *** [ext/simplexml/simplexml.lo] 오류 1
1. 오류 발생 원인
CentOS 7.9 환경에서 수동으로 PHP 5.1.4 버전을 make를 하던 중 오류가 발생되었다.
해당 오류는 C언어에서 흔히 일어나는 오류 중 하나로 해당 오류가 발생되는 지점 라인의 자료형이 없어서 발생되는 오류이다. 정석적인 방법으로는 오류가 발생한 자료형에 관련된 헤더를 include 하거나 include 되어 있는 헤더의 경로 설정이 제대로 되어 있는지 확인하고 수정하면 대게 오류가 해결된다.
하지만 나는 다른 경우의 상황이며, 아래와 같이 오류가 발생되는 지점의 코드를 수정하여 해결하였다.
728x90
반응형
2. 오류 해결
오류가 발생한 지점의 코드 수정을 위해 해당 경로로 이동해 준다. 나는 php폴더/ext/simplexml/ 로 이동하여 simplexml.c 파일을 vi로 열어주었다.
해당 오류가 발생된 지점 1223 라인으로 이동하면 아래와 같이 코드가 구성되어 있을 것이다.
if (node) {
if (XML_DOCUMENT_NODE == node->parent->type) {
xmlDocDumpMemory((xmlDocPtr) sxe->document->ptr, &strval, &strval_len);
} else {
/* Should we be passing encoding information instead of NULL? */
outbuf = xmlAllocOutputBuffer(NULL);
if (outbuf == NULL) {
RETURN_FALSE;
}
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 1, ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf);
strval = xmlStrndup(outbuf->buffer->content, outbuf->buffer->use);
xmlOutputBufferClose(outbuf);
}
RETVAL_STRINGL(strval, strlen(strval), 1);
xmlFree(strval);
} else {
RETVAL_FALSE;
}
위 영역에서 아래와 같이 코드를 추가 및 수정을 하고 다시 make를 하면 정상적으로 진행이 될 것이다.
if (node) {
if (XML_DOCUMENT_NODE == node->parent->type) {
xmlDocDumpMemory((xmlDocPtr) sxe->document->ptr, &strval, &strval_len);
} else {
/* Should we be passing encoding information instead of NULL? */
outbuf = xmlAllocOutputBuffer(NULL);
if (outbuf == NULL) {
RETURN_FALSE;
}
xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 1, ((xmlDocPtr) sxe->document->ptr)->encoding);
xmlOutputBufferFlush(outbuf);
// strval = xmlStrndup(outbuf->buffer->content, outbuf->buffer->use); // 삭제
// 추가
#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);
}
RETVAL_STRINGL(strval, strlen(strval), 1);
xmlFree(strval);
} else {
RETVAL_FALSE;
}
728x90
반응형
'오류해결' 카테고리의 다른 글
[오류해결] make: *** [ext/dom/documenttype.lo] error 1 (1) | 2025.04.24 |
---|---|
[오류해결] Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. (0) | 2025.04.15 |
[오류해결] IE에서 padStart 사용하기 (0) | 2025.04.10 |
[오류해결] Java compiler level does not match the version of the installed Java project facet (0) | 2024.07.12 |
[오류해결] ReferenceError: document is not defined (0) | 2024.06.28 |