[lldb-dev] [Bug 17961] New: LLDB test makefile rules fail to derive cxx compiler and linker name correctly when directory contains C compiler name
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Nov 16 12:25:41 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=17961
Bug ID: 17961
Summary: LLDB test makefile rules fail to derive cxx compiler
and linker name correctly when directory contains C
compiler name
Product: lldb
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: lldb-dev at cs.uiuc.edu
Reporter: tfiala at google.com
Classification: Unclassified
Created attachment 11553
--> http://llvm.org/bugs/attachment.cgi?id=11553&action=edit
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
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20131116/124b95b4/attachment.html>
More information about the lldb-dev
mailing list