GwenNelson / distcc

Automatically exported from code.google.com/p/distcc
GNU General Public License v2.0
0 stars 0 forks source link

Missing directory from object file target in generated dependency file #62

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Answering the following questions is a big help:

Were using distcc 2.18.3 on RHEL 5.0 to build an internal project.

Problem:
  distcc does not include the directory in which the object file resides
when generating dependency files.

Attached is a simple example of what our build system does.  We separated
object files, makefiles and source file from each other because of our
large project size.  When gcc produces the dependency file it is not aware
of the path in which the dependency file will be placed, so the
dependencies are incorrect.  In my example you can see the difference
between the proper dependency file and the one distcc outputs.

It also includes an example where if you make it, then change the header
file, and make it again it detects no need to compile anything.

Fix:
  For the moment we added a line to prepend the path back to the dependency
file after it is built, but it would be nice if this could be done inside
distcc.  If you can point me in the right direction I would be happy to
implement it.

Original issue reported on code.google.com by markit...@gmail.com on 19 Feb 2010 at 4:05

Attachments:

GoogleCodeExporter commented 9 years ago
Take a look at cpp.c:

   /* We strip the -o option and allow cpp to write to stdout, which is
     * caught in a file.  Sun cc doesn't understand -E -o, and gcc screws up
     * -MD -E -o.
     *
     * There is still a problem here with -MD -E -o, gcc writes dependencies
     * to a file determined by the source filename.  We could fix it by
     * generating a -MF option, but that would break compilation with older
     * versions of gcc.  This is only a problem for people who have the source
     * and objects in different directories, and who don't specify -MF.  They
     * can fix it by specifying -MF.  */

Original comment by crazygeo...@gmail.com on 27 Jul 2010 at 8:22

GoogleCodeExporter commented 9 years ago
sinclude ../build/example.dep
../build/example.o:../src/example.c
    $(CC) -c $< -o $@ -MF $(@:%.o=%.dep) -MP -MMD -I`dirname $<`

Original comment by crazygeo...@gmail.com on 27 Jul 2010 at 8:54

GoogleCodeExporter commented 9 years ago
I use -MMD -MF, but still object path in deps files is missing.

CFLAGS= -MF $(DEPS_DIR)/$<.d -MMD -msse2 -g3 -ggdb -Wall

Original comment by Nuclear...@gmail.com on 23 Jan 2015 at 2:51