NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: mh-nexus on March 08, 2021, 06:23:16 PM
-
Hello,
I am trying to compile a recent version of NASM with VC++ 2017 but it fails with the most recent versions.
The issue starts with version 2.15.03 and later, the previous one 2.15.02, still compiles.
Here is the error I get.
> nmake /f Mkfiles/msvc.mak
Microsoft (R) Program Maintenance Utility, Version 14.16.27030.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
NMAKE : U1073: "config\config.h.in" could not be created
Stop.
Mkfiles/msvc.mak(410) : fatal error U1050: Unable to rebuild dependencies file msvc.dep
Stop.
Any clues on what could be causing this?
-
To answer my own question: 2.15.03 is missing config\config.h.in. Copying it from 2.15.04 solves the compiling problem for 2.15.03.
However 2.15.04 and 2.15.05 still don't compile because of this error:
Microsoft (R) Program Maintenance Utility, Version 14.16.27030.1
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
NMAKE : fatal error U1071: Schleife im Abhängigkeitsstruktur für Ziel "asm\nasm.
obj"
Stop.
-
After some more digging I found out the issue. Apparently the following makefile entries in msvc.mak cause the "A circular dependency exists in the dependency tree for the given target. (https://docs.microsoft.com/de-de/cpp/error-messages/tool-errors/nmake-fatal-error-u1071?view=msvc-160)" error.
The relevant 4 lines, starting at line no 231, are:
$(MAKE) asm\warnings.time
asm\warnings.time: $(ALLOBJ:.@OBJEXT@=.c)
: > asm\warnings.time
Comment out these 4 lines, then create the empty file asm\warnings.time manually.
After these steps compiling works again as expected with the usual command:
nmake /f Mkfiles\msvc.mak
I haven't found out a way to fix this issue properly yet, but this stackoverflow entry might give a hint:
https://stackoverflow.com/questions/32394965/makefile-cycle-in-dependency-tree
-
Line 234 has the statement:
: > asm\warnings.time
Which is an illegal command under Windows. I assume it is supposed to update the file modification time, which can be achieved like this:
type NUL > asm\warnings.time
It will also create the file in case it does not exist.
But the real issue is the condition $(ALLOBJ:.@OBJEXT@=.c) in the line 233:
asm\warnings.time: $(ALLOBJ:.@OBJEXT@=.c)
But even if that issue would be solved, I am not sure I understand the logic behind that statement. The file asm\warnings.time has to exist already (which it does not in the default distribution), or nmake will still fail.
-
There are two issues with substring replacement $(ALLOBJ:.@OBJEXT@=.c).
@OBJEXT@ has no effect since macro expansion is not supported by nmake:
https://stackoverflow.com/questions/18374299/how-do-i-substitute-a-string-and-add-a-prefix-or-suffix-in-microsoft-nmake
Therefore it has to be rewritten with string literals, as such:
$(ALLOBJ:.obj=.c)
Fixing all the bugs mentioned in the posts so far, we get:
asm\warnings.time: $(ALLOBJ:.obj=.c)
type NUL > asm\warnings.time
$(MAKE) $(WARNFILES)
But eventhough this string replacement works, we still have cyclic dependencies, for example:
asm\warnings.time -> asm\warnings.c -> asm\warnings.time
The last dependency occurs due to line 237:
asm\warnings.c: asm\warnings.pl asm\warnings.times
and the first dependency due to
asm\warnings.time: $(ALLOBJ:.obj=.c)
Whatever the purpose of this added code to the makefile was, it will not work with nmake, due to the cyclic dependency. So until the original developer fixes it, the best option is to edit the makefile as mentioned in my third post (https://forum.nasm.us/index.php?topic=2746.msg12335#msg12335).
-
Thank you for posting your answers !
Best.
Frank