#148 closed defect (released)
Add header file dependencies to msvc build
Reported by: | Richard Boulton | Owned by: | Charlie Hull |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | MSVC makefiles | Version: | SVN trunk |
Severity: | minor | Keywords: | |
Cc: | Sidnei da Silva, Mark Hammond | Blocked By: | |
Blocking: | Operating System: | Microsoft Windows |
Description
Not a high priority, but it would be nice to do this at some point. Adding this bug so it doesn't get forgotten.
Attachments (4)
Change History (19)
comment:1 by , 18 years ago
Status: | new → assigned |
---|
by , 18 years ago
Attachment: | patch2.patch added |
---|
comment:2 by , 18 years ago
It looks to me like the dependencies are incomplete, because objects in each directory only depend on header files in that directory - whereas, in reality, source files pull in headers from lots of different directories.
However, it's probably better than what we had before, so I'll commit it.
comment:3 by , 18 years ago
I took the list of headers directly from the Unix makefiles; if there's a better way of doing things let me know and I'll try and persuade NMAKE.
comment:4 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
The unix makefiles use the list of headers only as a list of which files need to be put in tarballs when making a release. The actual dependencies are calculated automatically by the compiler: when a .cc file is compiled, the compiler also produces a makefile fragment listing all the header files which were examined when the file was compiled. This fragment is then included by make when running the next time, such that if any of the header files have changed, the .cc file is compiled again. This works whether the header files are in the same directory as the .cc file, or elsewhere in the tree.
The attachment I committed simply assumes that each .cc file depends on the header files in its directory, and not on any other header files. This is wildly inaccurate in many cases, but is still better than nothing (which is why I committed it).
I'm not sure whether it's possible to get the MS compiler to do the automatic dependency generation thing, and even if it is it's probably not something which is possible with a reasonable amount of effort.
The alternative is to use a separate utility to generate the dependencies (rather than getting them as a side effect of the compiler). This is probably even harder to set up.
Therefore, I'm resolving this bug, but setting it to WONTFIX (because we can't easily do better than we already have).
comment:5 by , 18 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
I've got a solution for this using something called makedepend (http://llg.cubic.org/docs/vc7.html) - this will add header file dependencies to the end of the Windows makefiles automatically as part of the build process. Makedepend itself needs hacking to make it work properly with Windows paths though- I'll do this soon - and thus will have to live in xapian-maintainer-tools\win32msvc
comment:6 by , 18 years ago
Cc: | added |
---|
Sidnei is reporting that his compiler doesn't seem to be calling the inference rules correctly: as a result, no .obj files are being generated. The result of attempting to compile is an error reporting "failed to find utils.obj" when linking libcommon.lib, but apparently there are no other .obj files generated either. He's using nmake 7.x from visual studio .net 2003.
I've added him to the CC list and asked him to attach the full output of a make run here, to help us work out what's going on. He's going to do that when he gets back home, hopefully.
comment:7 by , 18 years ago
Cc: | added |
---|
comment:8 by , 18 years ago
Here is the error:
cd ..\common nmake /EL CFG="" DEBUG="" if not exist "..\win32\Release\libs/" mkdir "..\win32\Release\libs" link.exe -lib @C:\DOCUME~1\ADMINI~1.ALI\LOCALS~1\Temp\nm1E.tmp
LINK : fatal error LNK1181: cannot open input file '.\utils.obj' NMAKE : fatal error U1077: 'link.exe' : return code '0x49d' Stop. NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN\nmake.exe"' : return code '0x2'
C:\src\xapian-build\trunk>nmake
Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved.
NMAKE : fatal error U1064: MAKEFILE not found and no target specified Stop.
Stop.
comment:9 by , 18 years ago
Found the issue: Inference rules look at .SUFFIXES: to decide the order in which they are applied.
-> http://msdn2.microsoft.com/en-us/library/7zx09b9a(VS.80).aspx
.SUFFIXES is defined, by default as: .exe .obj .asm .c .cpp .cxx .bas .cbl .for .pas .res .rc .f .f90
-> http://msdn2.microsoft.com/en-us/library/d82af2ab(VS.80).aspx
Adding this to config.mak makes it work:
.SUFFIXES : .cc
FWIW, if you change the inference rules to end with '::' instead of ':' it enables 'batch-mode', which supposedly make the compilation faster because it invokes the compiler only once with all the files.
http://msdn2.microsoft.com/en-us/library/f2x0zs74(vs.80).aspx
comment:10 by , 18 years ago
Applied. Please test that I've applied it right, and close this bug if so.
comment:12 by , 17 years ago
Status: | reopened → assigned |
---|
comment:13 by , 17 years ago
I'm still having trouble with makedepend:
- makedepend.dsp has \r line ends - MSVC insists on \r\n
- makedepend.dsw has the same problem as the other files (but I neglected to
include it in my patch.)
I'm attaching a new .dsw in its entirity - I haven't bothered with the .dsp, but it needs the line endings fixed.
by , 17 years ago
Attachment: | makedepend.dsw added |
---|
New version of the workspace file that loads in MSVC
comment:15 by , 17 years ago
Operating System: | → Microsoft Windows |
---|---|
Resolution: | fixed → released |
Fixed in 1.0.4
Adds header dependencies to make files