2013-08-18 3 views
2

설치 프로그램이 clang 컴파일러 인스턴스를 가지고 있고 HeaderSearchOptions 클래스를 사용하여 경로를 포함하도록 추가하는 프로그램이 있습니다. 입력 파일 libavutil/samplefmt.c (ffmpeg 패키지에서)에서 ParseAst를 실행하면 화면에 다음 메시지가 표시됩니다. 기본적으로 일부 내장 함수 (gcc?)는 해결할 수 없습니다. 이 오류를 제거하려면 어떻게해야합니까? 일반적으로 HeaderSearchOptions를 통해 경로를 포함하도록 설정하는 경우 gcc 설치의 모든 경로를 놓치지 않도록하려면 어떻게해야합니까?Clang. "알 수없는 기본 제공"오류 메시지를 해결하는 방법

감사합니다.

#include "..." search starts here: 
#include <...> search starts here: 
. 
/usr/include/freetype2 
/usr/include/fribidi 
/usr/local/include 
/usr/include/clang/Basic 
/opt/llvmrelease/bin/../lib/clang/3.4/include 
/usr/include/i386-linux-gnu 
/include 
/usr/include 
End of search list. 
In file included from libavutil/samplefmt.c:19: 
libavutil/common.h:258:12: error: use of unknown builtin '__builtin_clz' 
    return av_log2((x - 1) << 1); 
     ^
libavutil/intmath.h:89:23: note: expanded from macro 'av_log2' 
#define av_log2  ff_log2 
        ^
libavutil/intmath.h:45:29: note: expanded from macro 'ff_log2' 
# define ff_log2(x) (31 - __builtin_clz((x)|1)) 
          ^
libavutil/samplefmt.c:59:14: error: use of unknown builtin '__builtin_strlen' 
     if (!strcmp(sample_fmt_info[i].name, name)) 
      ^
/usr/include/i386-linux-gnu/bits/string2.h:804:22: note: expanded from macro 'strcmp' 
     && (__s1_len = __builtin_strlen (s1), __s2_len = __builtin_strlen (s2), \ 
        ^
libavutil/samplefmt.c:59:14: note: did you mean '__builtin_strchr'? 
/usr/include/i386-linux-gnu/bits/string2.h:804:22: note: expanded from macro 'strcmp' 
     && (__s1_len = __builtin_strlen (s1), __s2_len = __builtin_strlen (s2), \ 
        ^
libavutil/samplefmt.c:59:14: error: use of unknown builtin '__builtin_strcmp' 
     if (!strcmp(sample_fmt_info[i].name, name)) 
      ^
/usr/include/i386-linux-gnu/bits/string2.h:807:9: note: expanded from macro 'strcmp' 

답변

4

프로젝트 구성을 수행 할 때 뭔가 재미 있었어야합니다. ff_log2 코드는, 예를 들어, 내부에 :

#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4) 

그래서 당신은 HAVE_FAST_CLZ이 정의되어 있지 않은지 확인해야합니다, 당신은 그 전면에 확인해야한다. 비슷한 일을하면 strcmp을 수정할 수 있습니다.

+0

감사합니다. config. * files'#define HAVE_FAST_CLZ 1'에 다음 행이 있습니다. 그것을 제거하면 컴파일됩니다. 하지만 놀랍게도 gcc를 직접 프로젝트를 컴파일 할 때 오류가 발생하지 않습니다 (HAVE_FAST_CLZ를 1로 설정). 당신은 내가 clang을 설정하고 include 경로를 추가 할 때만 그것이 일어나는 이유를 말해 줄 수 있습니까? 나는 모든 경로를 포함 시키므로 그 이유는 분명하지 않을 것이라고 확신한다. – user763410

+0

Builtins은 심볼이 실제로 모든 포함 파일에 존재하지 않고 컴파일러에서 직접 정의 할 수 있습니다. 대신, 컴파일러는 컴파일 할 때 찾아서 처리 할 "내장"목록을 내부에 가지고 있습니다. – Brian

+0

@Brian, 나는 내재적 인 아이디어를 얻는다. 그러나이 경우에 놀랍게도 clang을 직접 호출하면 오류가 발생하지 않지만 compilerInstance를 설정하여 프로그램을 통해 호출하면 오류가 발생합니다. 설정하는 동안 경로를 추가해야합니까? 여기 내 코드에 대한 링크입니다 ... http://pastebin.com/cc0rMFr6 – user763410

관련 문제