Correct usage of isysroot argument

Hi

When I'm using clang 3.1 with the isysroot argument, it doesn't seem
to pick up header files from the directory I'm passing through the
command line:

$ clang -isysroot/myownheaders -v foo.c -c -o foo.o
clang version 3.1 (tags/RELEASE_31/final)
Target: i386-pc-linux-gnu
Thread model: posix
"/usr/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name foo.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.22 -momit-leaf-frame-pointer -v -coverage-file foo.o -resource-dir /usr/bin/../lib/clang/3.1 -isysroot /myownheaders -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.1/include -internal-externc-isystem /usr/include/i386-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/user/test -ferror-limit 19 -fmessage-length 174 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o foo.o -x c foo.c
clang -cc1 version 3.1 based upon LLVM 3.1 default target i386-pc-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/bin/../lib/clang/3.1/include
/usr/include/i386-linux-gnu
/usr/include
End of search list.

As I interpret this, it doesn't search for headers under "/myownheaders" folder.

In case I run it with gcc it doesn seem to searching for headers in
"/myownheaders":

$ gcc -isysroot/myownheaders -v foo.c -c -o foo.o
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
COLLECT_GCC_OPTIONS='-isysroot' '/myownheaders' '-v' '-c' '-o' 'foo.o' '-mtune=generic' '-march=i686'
/usr/lib/gcc/i686-linux-gnu/4.6/cc1 -quiet -v -imultilib . -imultiarch i386-linux-gnu -isysroot /myownheaders foo.c -quiet -dumpbase foo.c -mtune=generic -march=i686 -auxbase-strip foo.o -version -fstack-protector -o /tmp/ccuQ580s.s
GNU C (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (i686-linux-gnu)
        compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128201
ignoring nonexistent directory "/usr/lib/gcc/i686-linux-gnu/4.6/../../../../i686-linux-gnu/include"
ignoring nonexistent directory "/myownheaders/usr/include/i386-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/i686-linux-gnu/4.6/include
/usr/lib/gcc/i686-linux-gnu/4.6/include-fixed
/myownheaders/usr/include
End of search list.

Am I invoking clang incorrectly? Where is the problem?

Thanks
pM0n

This means that all default include paths should be prefixed with
/myownheaders. Are you sure you don't mean -isystem/myownheaders?

Joerg

I'm do looking for the features the isysroot gives. I have
"/myownheaders/usr/include" and "/myownheaders/usr/local/include"
folders (they contain the actual header files).

Again, the strange that gcc seem to be working with it.

In the mean time I've found this
(http://lists.cs.uiuc.edu/pipermail/llvmbugs/2011-December/021136.html),
isn't it related?