[LLVMbugs] [Bug 21152] New: Non-standard install of libstdc++, clang does not find a valid gcc install / does not find c++ headers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 3 15:07:51 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=21152

            Bug ID: 21152
           Summary: Non-standard install of libstdc++, clang does not find
                    a valid gcc install / does not find c++ headers
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: phantall+llvm at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

configured with:

PATH=/usr/somenetworkmount/tools/gcc/latest/linux/bin:${PATH}
../../src/llvm/llvm-3.5/configure
--prefix=/usr/somenetworkmount/tools/llvm/3.5/linux/release --enable-optimized
CC=gcc CXX=g++ --with-gcc-toolchain


Everything built, but `make check` failed because it was finding the system
libstdc++.so.6 (I can't control that installation, hence the non-standard
configuration).  I then ran `make check` setting LD_LIBRARY_PATH to compensate
and the checks all passed.

However, it fails to find c++ headers (I hope you'll forgive my not typing
everything out, but I'm testing this on an airgapped machine -- I don't have
the means to test this on a machine with internet access and re-typing the
output of the below commands would be tedious and probably unnecessary):


~ echo '#include <string>' | Release+Asserts/bin/clang -xc++ -v -
clang version 3.5.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
(omitted call to clang with flags)
clang -cc1 version 3.5.0 based upon LLVM 3.5.0 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include

/mnt/scratch/tools/build/llvm-3.5/Release+Asserts/bin/../lib/clang/3.5.0/include
 /usr/include
End of search list.
<stdin>:1:10: fatal error: "string" file not found
#include <string>
          ^
1 error generated.


I did a little digging; at or around lib/Driver/ToolChains.cpp:3474,
LibDir.str() returns the empty string.  I backtracked from there to line 1237
and getGCCToolchainDir returns the simple string "yes".

So I re-ran the above command with a twist:

echo '#include <string>' | strace -f Release+Asserts/bin/clang -xc++ -v - |&
grep -P '\byes\b'
access("yes", F_OK)                      = -1 ENOENT (No such file or
directory)


... to which I conclude it thinks it has received the `--gcc-toolchain` option
(because it was configured/built using --with-gcc-toolchain?), but it doesn't
have a real path for the gcc toolchain.

To confirm this, I ran the following test and it succeeded:

echo '#include <string>' | Release+Asserts/bin/clang -xc++ -
--gcc-toolchain=/usr/somenetworkmount/tools/gcc/latest/Linux -c -o /tmp/blah.o
test -e /tmp/blah.o && echo 'It worked'
It worked

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141003/38eacc47/attachment.html>


More information about the llvm-bugs mailing list