Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » -MT appears to be incorrect for header file dependency generation?
-MT appears to be incorrect for header file dependency generation? [message #1071955] Sun, 21 July 2013 18:04 Go to next message
Shannon Holland is currently offline Shannon HollandFriend
Messages: 2
Registered: July 2013
Junior Member
Hello,

I'm fairly new to Eclipse/CDT so there's likely something stupid I'm missing here But, the issue I was trying to track down was why CDT (in a managed external build) would not recompile source files based on header file dependencies.

Looking through the makefiles I see that the .d files are being generated and included. However, the target within each .d file is the .d file itself rather than the .o file. So, on a header file update make will want to rebuild the .d file (for which there is no rule) rather than the .o file...

If I manually edit the .d file to set the target as a .o and run make from the command line then make will correctly rebuild the object file.

It appears the .d dependency is being explicitly set with a -MT option to the compiler. Is there a way I can change this? Or is something else going on that I'm missing?

I'm using Eclipse Juno with the latest CDT (just updated).

Thanks for any help!

Shannon

[Updated on: Mon, 22 July 2013 04:43]

Report message to a moderator

Re: -MT appears to be incorrect for header file dependency generation? [message #1072848 is a reply to message #1071955] Tue, 23 July 2013 16:29 Go to previous messageGo to next message
Geoff Kaniuk is currently offline Geoff KaniukFriend
Messages: 5
Registered: July 2013
Junior Member
Hi,

Since upgrading from Helios to Juno (prompted by the latest Debian upgrade), I have been experiencing the same problem. I have a project with several header files containing templates, so I am editing .h files a lot without touching the .cpp files. Suppose I change a method body in foo.h and rebuild. Then the main project file is rebuilt, but foo.o and foo.d are not.

I have been scouring Eclipse and aother forums but so far have not found a satisfactory solution. Looking at the build output, I find that the targets in the .d files have changed from Helios to Juno, but the compiler invocation command is the same:

HELIOS
foo.d foo.o: ../foo.cpp ../foo.h 
%.o: ../%.cpp
     g++ -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" 

JUNO
foo.d: ../foo.cpp ../foo.h
%.o: ../%.cpp 
     g++ -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<" 

The 'GNU make' manual (Automatic-Prerequisites) seems to be consistent with the Helios format.

I must be missing something here as both forms seem to imply that whenever .cpp or .h changes, regenerate .d?

For the record:
Toolchain: Linux GCC
Builder: GNU Make Builder
Eclipse CDT 3.8.0

I hope that someone reading this will be able to explain why we are not getting the expected build behaviour, and what we should do to ensure correct builds. If you need more detail about my setup I am happy to provide that.

Many thanks for any help.


Geoff
Re: -MT appears to be incorrect for header file dependency generation? [message #1077694 is a reply to message #1072848] Fri, 02 August 2013 02:53 Go to previous message
Shannon Holland is currently offline Shannon HollandFriend
Messages: 2
Registered: July 2013
Junior Member
Interesting. I haven't fully tracked down the .d rule in the Makefile, but the actual gcc command I'm getting to rebuild a .d file is along the lines of:

arm-none-eabi-gcc -O0 -Wall -Wa,-adhlns="stubs.o.lst" -c -fmessage-length=0 -MMD -MP -MF"app_stubs.d" -MT"stubs.d" -mcpu=cortex-m4 -mthumb -g3 -gdwarf-2 -o "stubs.o" "/Users/holland/Source/stubs.c"

As far as I understand the -MT option this will make stubs.d the dependency target in the .d files, not the actual .o... (This is consistent with what I'm getting in the .d file itself).

I'll poke around more at the overall makefile structure/
Previous Topic:Preprocessor include paths
Next Topic:Missing MinGW toolchain in Kepler
Goto Forum:
  


Current Time: Thu Apr 25 19:37:00 GMT 2024

Powered by FUDForum. Page generated in 0.03530 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top