[cfe-dev] How to overcome “unknown builtin” error message

G Raghuram contactraghu at gmail.com
Sun Aug 18 05:38:46 PDT 2013


Hello,

I have a program that setups a clang compiler instance and adds
include paths using HeaderSearchOptions class. When I run ParseAst on
the input file libavutil/samplefmt.c (from ffmpeg package), I get the
following message on the screen. Basically, it is not able to resolve
some (gcc?) builtin functions. How do I get rid of this error? In
general, If setting include path through HeaderSearchOptions, how do I
ensure I don't miss out on all include paths from my gcc installation?

I also asked this question on here (better formatting, etc),

http://stackoverflow.com/questions/18299125/clang-how-to-overcome-unknown-builtin-error-message

Thanks!


Error message:

#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'



More information about the cfe-dev mailing list