[cfe-users] Standard headers cannot be found when compiling with Clang

Matthew Brush via cfe-users cfe-users at lists.llvm.org
Fri Jan 15 21:39:47 PST 2016


On 2016-01-15 8:36 PM, Qiuping Yi via cfe-users wrote:
> I use ubuntu,
>

I don't think Clang ever could find proper includes here. See the bugs like:

https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1242300

It works fine, it just doesn't know where to find the correct stdlib 
headers, so you have to use an -I argument to tell it where your stdlib 
headers are (arch-specific on Debians/Ubuntus/etc).

Cheers,
Matthew Brush

> $ uname -a
> Linux novice 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31
> UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>
> and this is the output of 'clang -v -c'
>
> $ clang -v -c test.c
> clang version 3.6.0 (tags/RELEASE_360/final)
> Target: x86_64-unknown-linux-gnu
> Thread model: posix
>   "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/clang" -cc1
> -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
> -main-file-name t1.c -mrelocation-model static -mthread-model posix
> -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
> -munwind-tables -target-cpu x86-64 -v -dwarf-column-info -coverage-file
> /home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/t1.c
> -resource-dir
> "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/\${CLANG_RESOURCE_DIR}"
> -isysroot "\${DEFAULT_SYSROOT}" -c-isystem /home/novice/.install/include
> -cxx-isystem /home/novice/.install/include -internal-isystem
> "\${DEFAULT_SYSROOT}/usr/local/include" -internal-isystem
> "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/\${CLANG_RESOURCE_DIR}/include"
> -internal-externc-isystem "\${C_INCLUDE_DIRS}" -fdebug-compilation-dir
> /home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin -ferror-limit 19
> -fmessage-length 205 -mstackrealign -fobjc-runtime=gcc
> -fdiagnostics-show-option -fcolor-diagnostics -o t1.o -x c
> /home/novice/installed/llvm-3.2.src/examples/test/t1.c
> clang -cc1 version 3.6.0 based upon ${BACKEND_PACKAGE_STRING} default
> target x86_64-unknown-linux-gnu
> ignoring nonexistent directory "/home/novice/.install/include"
> ignoring nonexistent directory "/home/novice/.install/include"
> ignoring nonexistent directory "${DEFAULT_SYSROOT}/usr/local/include"
> ignoring nonexistent directory
> "/home/novice/installed/llvm-3.6.0.src/Release+Asserts/bin/${CLANG_RESOURCE_DIR}/include"
> ignoring nonexistent directory "${C_INCLUDE_DIRS}"
> #include "..." search starts here:
> End of search list.
> /home/novice/installed/llvm-3.2.src/examples/test/t1.c:2:10: fatal error:
> 'stdio.h' file not found
> #include <stdio.h>
>           ^
> 1 error generated.
>
> I put clang in llvm-3.6.0.src/toos/...
>
>
> --------------------------------------------
> Qiuping Yi
> Institute Of Software
> Chinese Academy of Sciences
>
> On Sat, Jan 16, 2016 at 12:56 AM, Hans Wennborg <hans at chromium.org> wrote:
>
>> On Fri, Jan 15, 2016 at 7:06 AM, Qiuping Yi via cfe-users
>> <cfe-users at lists.llvm.org> wrote:
>>> Hello All,
>>>
>>> I am a beginner of clang. I installed clang 3.6 with llvm 3.6, but I
>> found
>>> my clang cannot work as expected.
>>> For the next simple program test.c:
>>>
>>> #include <stdio.h>
>>> int main() {return 0;}
>>>
>>> $ clang -c test.c
>>>
>>> I got the next information:
>>>
>>> fatal error: 'stdio.h' file not found
>>> #include <stdio.h>
>>>               ^
>>> 1 error generated.
>>>
>>> what's wrong? I found other standard headers are also cannot be found.
>>> Any suggestion is OK. Thank you in advance.
>>
>> What operating system are you using?
>>
>> What's the output of "clang -v -c test.c"?
>>
>>  From where did you install clang?
>>
>
>
>
> _______________________________________________
> cfe-users mailing list
> cfe-users at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
>




More information about the cfe-users mailing list