<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - LLDB test makefile rules fail to derive cxx compiler and linker name correctly when directory contains C compiler name"
href="http://llvm.org/bugs/show_bug.cgi?id=17961">17961</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLDB test makefile rules fail to derive cxx compiler and linker name correctly when directory contains C compiler name
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tfiala@google.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=11553" name="attach_11553" title="Tar file with both the patch and the Makefile test script">attachment 11553</a> <a href="attachment.cgi?id=11553&action=edit" title="Tar file with both the patch and the Makefile test script">[details]</a></span>
Tar file with both the patch and the Makefile test script
When running the LLDB test suite via the following:
cd {your_llvm_root}
make -C tools/lldb/test
the test process will fail when lldb was built with a CC/CXX that (1) contains
a directory, and (2) a portion of the directory contains one of clang, icc,
llvm-gcc or gcc. In this case, the lldb test makefile rules will incorrectly
substitute the directory portion and the basename portion with the C => C++
executable mapping, rendering an invalid path to the C++ compiler and linker.
Example failure trace output where the CC was
/usr/local/google/home/tfiala/llvm/manual2/gcc/bin/gcc. The g++ compiler
should have been /usr/local/google/home/tfiala/llvm/manual2/gcc/bin/g++, but
the gcc directory was swapped out to g++ along with the executable name.
=== SNIP trace output ===
Session info generated @ Sat Nov 16 11:47:58 2013
runCmd: settings set auto-confirm true
output:
Adding tearDown hook: self.addTearDownHook(lambda:
self.runCmd("settings clear auto-confirm"))
os command: [['/bin/sh', '-c', "make clean EXE='test_int_type_with_dwarf'
CXX_SOURCES='int.cpp';make MAKE_DSYM=NO ARCH=x86_64
CC=/usr/local/google/home/tfiala/llvm/manual2/gcc/bin/gcc
EXE='test_int_type_with_dwarf' CXX_SOURCES='int.cpp'"]]
with pid: 6799
stdout: make[1]: Entering directory
`/usr/local/google/home/tfiala/llvm/manual2/llvm/tools/lldb/test/types'
rm -rf "test_int_type_with_dwarf" "" int.o int.d *.d.[0-9] *.d.[0-9][0-9]
*.d.[0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9] *.d.[0-9][0-9][0-9][0-9][0-9]
make[1]: Leaving directory
`/usr/local/google/home/tfiala/llvm/manual2/llvm/tools/lldb/test/types'
make[1]: Entering directory
`/usr/local/google/home/tfiala/llvm/manual2/llvm/tools/lldb/test/types'
/usr/local/google/home/tfiala/llvm/manual2/g++/bin/g++ -g -O0 -m64 -c -o
int.o int.cpp
make[1]: Leaving directory
`/usr/local/google/home/tfiala/llvm/manual2/llvm/tools/lldb/test/types'
stderr: /bin/sh: line 1:
/usr/local/google/home/tfiala/llvm/manual2/g++/bin/g++: No such file or
directory
/bin/sh: line 1: /usr/local/google/home/tfiala/llvm/manual2/g++/bin/g++: No
such file or directory
make[1]: /usr/local/google/home/tfiala/llvm/manual2/g++/bin/g++: Command not
found
make[1]: *** [int.o] Error 127
=== SNIP ===
I've attached a patch that fixes the C => C++ compiler and linker mapping
issue.
I've also attached a test makefile that has several unit tests against the
modified cxx_compiler and cxx_linker Makefile macros.
You can run it like so:
make -k -f test_cxx_macros.mk test-all \
LEVEL={your-LLDB-source-root}/test
It will fail 2 of the 4 tests with the unmodified LLDB test makefile rules.
With the patch, all 4 tests will pass.
Tested:
make -k -f test_cxx_macros.mk test-all
LEVEL=$HOME/llvm/manual/llvm/tools/lldb/test
if [ /usr/local/clang/bin/clang++ = \
"/usr/local/clang/bin/clang++" ]; then echo "PASS"; \
else echo "FAIL"; exit 1; fi
PASS
if [ clang++ = \
"clang++" ]; then echo "PASS"; \
else echo "FAIL"; exit 1; fi
PASS
if [ /usr/local/clang/bin/clang++ = \
"/usr/local/clang/bin/clang++" ]; then echo "PASS"; \
else echo "FAIL"; exit 1; fi
PASS
if [ clang++ = \
"clang++" ]; then echo "PASS"; \
else echo "FAIL"; exit 1; fi
PASS
The fix adds one more level to the mapping macros. It first checks if there is
a directory separator character. If not, it just does what it always did.
Otherwise, it runs the old logic against only the $(notdir) portion (i.e.
basename) of the executable and combines that with the directory portion of the
path argument.
It would be great if a committer could verify and submit the patch or a similar
work-around.
Thanks!
Sincerely,
Todd Fiala</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>