llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.35k stars 12.14k forks source link

Finish dependency file support #3975

Closed llvmbot closed 14 years ago

llvmbot commented 15 years ago
Bugzilla Link 3603
Resolution FIXED
Resolved on Mar 12, 2010 00:57
Version unspecified
OS All
Blocks llvm/llvm-project#3974
Reporter LLVM Bugzilla Contributor
CC @EdSchouten,@edwintorok,@pwo

Extended Description

clang is still missing various things needed for full dependency file generation support.

  1. Change -M options to be sane and force driver to convert -M to the sane set.

  2. Support -M, -MG, -MM, -MQ.

  3. Some corner cases differ vs gcc. For example:

    ddunbar@lordcrumb:tmp$ rm -f foo && xcc -S -MD -MF foo -m32 -o y -x c /dev/null; cat foo y.o: /dev/null ddunbar@lordcrumb:tmp$ rm -f foo && gcc -S -MD -MF foo -m32 -o y -x c /dev/null; cat foo y: /dev/null

ddunbar@lordcrumb:tmp$ rm -f foo && xcc -E -MD -MF foo -m32 -o y -x c /dev/null; cat foo cat: foo: No such file or directory ddunbar@lordcrumb:tmp$ rm -f foo && gcc -E -MD -MF foo -m32 -o y -x c /dev/null; cat foo null.o: /dev/null

llvmbot commented 15 years ago

Treating this as fixed, we are only missing -MG and -MQ, both of which are slightly icky, and neither of which anyone has asked for.

llvmbot commented 15 years ago

Looks like a separate issue; can you file as a new bug with a simple test case?

llvmbot commented 15 years ago

Seems there's still some issues with -MM:

GCC's output:

game_evaluator.o: game_evaluator.c bungie_net_player.h \ ../common/metaserver_common_structs.h ../common/cseries.h \ ../common/platform.h bungie_net_order.h ../room_new/games.h

clang's output:

game_evaluator.o: game_evaluator.c /bungie_net_player.h \ ../common/metaserver_common_structs.h ../common/cseries.h \ ../common/platform.h /bungie_net_order.h ../room_new/games.h

Notice how clang incorrectly starts bungie_net_player.h and bungie_net_order.h with a "/" as if those headers were at "/" (they're not - they're in the current directory and #include'd normally).

The include flags passed are: -I./ -I../common -I../utils -I../room_new

Those two headers are at "./"

llvmbot commented 15 years ago

it works for freebsd make depend. (tested with clang version 1.0 (http://llvm.org/svn/llvm-project/cfe/trunk 68030M)

llvmbot commented 15 years ago

-M and -MM fixed here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090330/014751.html

I'm keeping this bug open, but please remove the block(s) if it works.

llvmbot commented 15 years ago

Incremental improvement here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090323/014748.html

Still missing -M and -MM most notably.

edwintorok commented 15 years ago

This is also needed for clang to work with ccache:

"/usr/lib/ccache/gcc" "-DHAVE_CONFIG_H" "-I." "-I../../../clamav-devel/libltdl" "-I.." "-DLT_CONFIG_H=" "-DLTDL" "-I." "-I../../../clamav-devel/libltdl" "-Ilibltdl" "-I../../../clamav-devel/libltdl/ libltdl" "-I../../../clamav-devel/libltdl/libltdl" "-MT" "dlopen.lo" "-MD" "-MP" "-MF" ".deps/dlopen.Tpo" "- fPIC" "-DPIC" "-c" "-o" ".libs/dlopen.o" "-x" "assembler" "/tmp/cc-9aFdvV.s" libtool: compile: clang -DHAVE_CONFIG_H -I. -I../../../clamav-devel/libltdl -I.. "-DLT_CONFIG_H=" -DLTDL -I. -I../../../clamav-devel/libltdl -Ilibltdl -I../../../clamav-devel/libltdl/libltdl -I../.. /../clamav-devel/libltdl/libltdl "-###" -MT dlopen.lo -MD -MP -MF .deps/dlopen.Tpo -c ../../../clamav-devel/ libltdl/loaders/dlopen.c -o dlopen.o >/dev/null 2>&1 mv -f .deps/dlopen.Tpo .deps/dlopen.Plo mv: cannot stat `.deps/dlopen.Tpo': No such file or directory make[3]: *** [dlopen.lo] Error 1

To use clang with ccache it is enough to create a symlink: sudo ln -s /usr/bin/ccache /usr/lib/ccache/clang And add /usr/lib/ccache to the PATH (before /usr/bin or /usr/local/bin).

ccache doesn't recover from the missing file errors though, so you'll need to clear the cache (ccache -C) after each attempt to use clang with ccache (otherwise it caches the result, i.e. the missing file and the error).

EdSchouten commented 15 years ago

Yes. It seems like FreeBSD's mkdep(1) just uses -M.

llvmbot commented 15 years ago

I believe -M and -MM are our main missing features.

lattner commented 15 years ago

Which specific feature does freebsd require?

EdSchouten commented 15 years ago

It seems this issue affects both FreeBSD's `make buildworld' and compilation of Perl.

llvmbot commented 15 years ago

Bug llvm/llvm-project#3959 has been marked as a duplicate of this bug.