My favorites | Sign in
Logo
waf
Project hosting will be READ-ONLY Wednesday, 7AM PST due to brief network maintenance
                
New issue | Search
for
| Advanced search | Search tips
Issue 557: header-only library breaks debug build with MSVC
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Nov 10
Type-Defect


Sign in to add a comment
 
Reported by bitfield.alex, Nov 04, 2009
>> operating system:
Windows 7
>> python version:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit 
(Intel)] on win32
>> waf version (or svn revision):
1.5.9 (bug is present in trunk:HEAD)
>> observed output and expected output:
Waf: Entering directory `D:\projects\waf-bug\build'
Waf: Leaving directory `D:\projects\waf-bug\build'
Traceback (most recent call last):
  File "c:\bin\waf.txt", line 148, in <module>
    Scripting.prepare(t, cwd, VERSION, wafdir)
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Scripting.py", line 102, in 
prepare
    prepare_impl(t,cwd,ver,wafdir)
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Scripting.py", line 95, in 
prepare_impl
    main()
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Scripting.py", line 130, in main
    fun(ctx)
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Scripting.py", line 274, in build
    return build_impl(bld)
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Scripting.py", line 286, in 
build_impl
    bld.compile()
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Build.py", line 143, in compile
    self.flush()
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Build.py", line 426, in flush
    tg.post()
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\TaskGen.py", line 110, in post
    self.apply()
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\TaskGen.py", line 101, in apply
    v()
  File "c:\bin\waf-1.5.9-
d1e0349fc8937631a656fb8ea7e99063\wafadmin\Tools\msvc.py", line 462, in 
apply_flags_msvc
    pdbnode=self.link_task.outputs[0].change_ext('.pdb')
AttributeError: 'NoneType' object has no attribute 'outputs'
>> how to reproduce the problem?
wscript file:
def set_options(opt):
	opt.tool_options('msvc')
def configure(conf):
	conf.check_tool('msvc')
	conf.env.LINKFLAGS += ['/DEBUG']
def build(bld):
	#header-only library
	bld.new_task_gen(
		target='header-only',
		features='cc',
		export_incdirs='header-only'
	)
	bld.new_task_gen(
		target='waf-bug',
		features='cc cprogram',
		source='main.c',
		uselib_local='header-only'
	)
>> testcase - how to reproduce? (provide attachments for testcase files)
see attach

possible solution (patch for trunk:HEAD):
--- wafadmin/Tools/msvc.py	(revision 6784)
+++ wafadmin/Tools/msvc.py	(working copy)
@@ -639,7 +639,7 @@
-	if 'cstaticlib' not in self.features:
+	if 'cshlib' in self.features or 'cprogram' in self.features:

waf-bug.zip
703 bytes Download
Comment 1 by tnagy1024, Nov 04, 2009
The fix is not entirely correct, the condition should be:
if getattr(self, link_task, None): ...

Status: Assigned
Labels: -Type-Other Type-Defect
Comment 2 by tnagy1024, Nov 04, 2009
rev: 6786
Status: Fixed
Comment 3 by bitfield.alex, Nov 06, 2009
Sorry, it doesn't work.
Static library can't have .pdb, so r6786 breaks .lib compilation.

12:40:45 runner system command -> ['C:\\Program Files\\Microsoft Visual Studio 
9.0\\VC\\BIN\\LIB.exe', /NOLOGO', '/OUT:default\\libwaf-bug.lib', 'default\\libwaf-
bug.pdb', 'default\\main_2.o']
LINK : fatal error LNK1181: cannot open input file 'default\libwaf-bug.pdb'

Condition should be:

if 'cstaticlib' not in self.features and getattr(self, link_task, None):

Comment 4 by tnagy1024, Nov 06, 2009
rev: 6789.
Status: update_your_copy
Comment 5 by tnagy1024, Nov 10, 2009
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment

Hosted by Google Code