Using qrc files as sources doesn't work with variant_dir

Bug #722824 reported by Corni
This bug report is a duplicate of:  Bug #722835: Uic4 doesn't work with variant_dir. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SCons Qt4 Tool
Invalid
Undecided
Unassigned

Bug Description

The following setup

SConstruct:
env = Environment()
envDebug = env.Clone()
envDebug.Append(CPPFLAGS=['-g','-O0','-D_REENTRANT'])
envRelease = env.Clone()
envRelease.Append(CPPFLAGS=['-O3','-D_REENTRANT'])
envDebug.SConscript('src/SConscript', variant_dir='build/debug', duplicate=0, exports={'env':envDebug})
envRelease.SConscript('src/SConscript', variant_dir='build/release', duplicate=0, exports={'env':envRelease})

SConscript:
Import("env")
env['QTDIR']='/usr/bin'
env.Tool('qt4')
env.Uic4(Glob('src/*.ui'))
env.Append(CPPPATH=['/usr/share/qt/mkspecs/linux-g++', '/usr/include/QtCore', '/usr/include/QtGui', '/usr/include'])
env.Append(LIBS=['QtGui','QtCore', 'pthread'])
env.Program(target='pokercalculator', source=Glob('*.cpp')+Glob('*.qrc'))

results in the following error message:
scons: warning: Two different environments were specified for target /pokercalculator/src/qrc_cards.cc,
        but they appear to have the same action: $QT4_RCC $QT4_QRCFLAGS -name cards $SOURCE -o $TARGET
File "/pokercalculator/src/SConscript", line 10, in <module>

scons: *** Multiple ways to build the same target were specified for: /pokercalculator/src/qrc_cards.cc (from ['/pokercalculator/src/cards.qrc'] and from ['/pokercalculator/src/cards.qrc'])
File "/pokercalculator/src/SConscript", line 10, in <module>

Revision history for this message
Dirk Baechle (dl9obn) wrote :

Hi,

the problem here is that you specify "duplicate=0", such that generated files are created in the source directory. SCons then gets confused when you do this twice from different environments.
You need to set duplicate=1, this should fix your problem.

Best regards,

Dirk

Changed in scons-qt4:
status: New → Invalid
Revision history for this message
Corni (comaddcor) wrote :

Would you say that in principle i should be able to use that with duplicate=0 if i want to?

As an intermediate fix i found that using an explicit call like this:
qrccc = env.Qrc4('cards')
env.Program(target='pokercalculator', source=Glob('*.cpp')+qrccc)

works even though duplicate=0 is set.

Revision history for this message
Corni (comaddcor) wrote :

*Wouldn't you say...

Revision history for this message
Corni (comaddcor) wrote :

Also by setting duplicate=1 the qrc file gets copied but the resource files which it points to a naturally not detected by scons as a dependency and are therefore not automatically copied.
Being able to use it with duplicate=0 would therefore be the preferred way.
I therefore have to disagree with you decision to mark the bug as invalid.
Maybe low priority would be more appropriate.

Revision history for this message
Dirk Baechle (dl9obn) wrote :

I'll treat these problems while trying to fix the UIC handling...both are related.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.