**SYSTEM
32-bit BLFS, kernel 4.2.6

cc --version
cc (GCC) 4.9.2

% ls -l /usr/bin/cc
lrwxrwxrwx 1 root root 3 2011-12-16 20:56 /usr/bin/cc -> gcc
% ls -l /usr/bin/gcc
-rwxr-xr-x 3 root root 2542645 2014-12-01 17:05 /usr/bin/gcc

clang --version
clang version 3.5.0 (tags/RELEASE_350/final)
Target: i386-pc-linux-gnu
Thread model: posix

**WORK/TESTS directory (unprivileged):
/home/alex/work/tests/

**TEST files 'temp.cc' (unprivileged):
% cat /home/alex/work/tests/temp.cc
#include <bits/alex.h>

'alex.h':  ANY file (% touch alex.h)
-----------------------------------------------
**TESTS
% cd /home/alex/work/tests/

# --Test #1
% find -name alex.h          # So we know where we are
./level1/usr/include/i386-linux-gnu/bits/alex.h

# 'clang' succeeds:
% clang --sysroot=/home/alex/work/tests/level1 -c
/home/alex/work/tests/temp.cc ; echo $?
0

# NOT 'cc', though:
% cc --sysroot=/home/alex/work/tests/level1 -c /home/alex/work/tests/temp.cc
/home/alex/work/tests/temp.cc:1:23: fatal error: bits/alex.h: No such file
or directory
 #include <bits/alex.h>
                       ^
compilation terminated.

# --Test #2
# Now, let's change name of subdirectory 'i386-linux-gnu' to something else
('level2')
% mv level1/usr/include/i386-linux-gnu level1/usr/include/level2

% find -name alex.h          # So we know where we are
./level1/usr/include/level2/bits/alex.h

# in this case clang FAILS too (cc already failed in "good times", above):
% clang --sysroot=/home/alex/work/tests/level1 -c
/home/alex/work/tests/temp.cc
/home/alex/work/tests/temp.cc:1:10: fatal error: 'bits/alex.h' file not
found
#include <bits/alex.h>
         ^
--------------------------------------------------------------------
QUESTIONS
1.  Why 'clang' succeeds (when it does) and 'cc' does not?

2.  Does the latest 'gcc', (I assume, 5.2) behave better/differently?

3.  What's so special in the name 'i386-linux-gnu'?

Thanks,
-- Alex
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to