tup
tup copied to clipboard
How do I build with PDB files?
I have been struggling for a while with PDB files in Visual C++ and Google turns up people talking about it, sometimes finding workarounds for specific edge cases, but I can't find any definitive guide to dealing with them correctly.
The problem is, the Visual C++ compiler cl.exe writes to the same pdb file for every source file. If I do not specify the pdb file as an output, I get
tup error: Unspecified output files - A command is writing to files that you didn't specify in the Tupfile. You should add them so tup knows what to expect.
If I do specify the PDB file as an output, I will instead get:
tup error: Unable to create output file '.\X.pdb' because it is already owned by command ###.
Will you please provide a canonical guide / example for dealing with Visual C++ builds, or if Visual C++ is not a supported platform then add an explicit notice about that. Right now it seems like it is intended to work, but I really can't figure out how.
I am able to get around this using tup version v0.7.3-60. Tup will not track a pdb file if one prepends a dot in front of the pdb file name. Later versions do not seem to allow this workaround.
I don't normally use Visual C++ - does using /Z7 help? It sounds like it will embed the debugging info in the object, and then you can use some tools at the end when you link the final exe: https://stackoverflow.com/a/661804
Or, maybe it is possible to use /Fd to output a separate .pdb per .o file and then merge them at the end.
Yes, /Z7 will allow tup to pass the compilation stage. Linking is still an issue as an pdb is always written out in a separate file by current compilers (older compilers <= 2005 allowed embedding as mentioned in http://www.debuginfo.com/articles/gendebuginfo.html). It would be great if tup would allow the .dotfile workaround again.