[Scons-users] SCons is only installing .lib part of SharedLibrary on Windows when target is specified
Dan Pidcock
dan.pidcock at googlemail.com
Thu Jan 31 08:37:09 EST 2013
I have a project that contains a SharedLibrary and a Program, and when I do
a scons build with no target specified it works fine, but when I do a build
with the program specified as the target after changing a source file in
the library, it rebuilds the .lib and.dll but only installs the .lib (log
output below). In fact I don't really want it to install the .lib anyway as
that is just required for building.
The source is structured as a library and an application directory with a
SConscript in each and a SConstruct at the root. There is then a separate
build directory and a bin directory where shared libraries and executables
should be installed.
The SConstruct basically sets compiler flags and then calls:
projects=[ 'SampleLibrary', 'SampleApplication',]
for project in projects:
variant_dir = buildDir # D:\Build on windows
for dir in string.split(project, '/'):
variant_dir = os.path.join(variant_dir, dir)
SConscript([project+'/SConscript', ], exports='env binDir buildType',
variant_dir=variant_dir, duplicate=dupSrc)
where dupSrc is switched off for Windows
and the SConscripts look like:
Import('*')
projectName='SampleLibrary'
projectEnv = env.Clone()
project = projectEnv.SharedLibrary(projectName, Glob('*.cpp')) # or .Program
Default(project )
Default(projectEnv.Install(binDir, project))
I suspect that it's something to do with the way I'm using Default() in the
SConscripts but I tried several variations on this, including removing the
Default and using env rather than the cloned env but couldn't get it to
work.
btw it works fine on Linux - the .so file is installed as expected.
I've read through the 'Problems with env.Install()' thread in the hopes
that it was the same issue but I don't think so as my SConstruct always
specifies a variant_dir, and I also tried several Web searches and
inspected the manual but couldn't find anything.
Warning: largish logs below
========
For each of these runs the start point is the same: a full build with no
targets has been completed and then a source file in the library has been
edited.
Run 1: Just build SampleApplication using scons --debug=explain
SampleApplication:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: D:\Build\SampleApplication
scons: rebuilding `D:\Build\SampleLibrary\Test.obj' because
`SampleLibrary\Test.cpp' changed
cl /FoD:\Build\SampleLibrary\Test.obj /c SampleLibrary\Test.cpp /TP /nologo
/EHsc /MDd /FC /DWIN32 /DWIN32_LEAN_AND_MEAN /D_DEBUG /I.
scons: rebuilding `D:\Build\SampleLibrary\SampleLibrary.dll' because
`D:\Build\SampleLibrary\Test.obj' changed
link /nologo /DEBUG /dll /out:D:\Build\SampleLibrary\SampleLibrary.dll
/implib:D:\Build\SampleLibrary\SampleLibrary.lib /LIBPATH:D:\Bin
D:\Build\SampleLibrary\Test.obj D:\Build\SampleLibrary\stdafx.obj
LINK : D:\Build\SampleLibrary\SampleLibrary.dll not found or not built by
the last incremental link; performing full link
Creating library D:\Build\SampleLibrary\SampleLibrary.lib and object
D:\Build\SampleLibrary\SampleLibrary.exp
scons: rebuilding `D:\Bin\SampleLibrary.lib' because
`D:\Build\SampleLibrary\SampleLibrary.lib' changed
Install file: "D:\Build\SampleLibrary\SampleLibrary.lib" as
"D:\Bin\SampleLibrary.lib"
scons: rebuilding `D:\Build\SampleApplication\SampleApplication.exe'
because `D:\Bin\SampleLibrary.lib' changed
link /nologo /DEBUG /OUT:D:\Build\SampleApplication\SampleApplication.exe
/LIBPATH:D:\Bin SampleLibrary.lib D:\Build\SampleApplication\main.obj
D:\Build\SampleApplication\stdafx.obj
LINK : D:\Build\SampleApplication\SampleApplication.exe not found or not
built by the last incremental link; performing full link
Creating library D:\Build\SampleApplication\SampleApplication.lib and
object D:\Build\SampleApplication\SampleApplication.exp
scons: `SampleApplication' is up to date.
scons: done building targets.
Note that SampleLibrary.lib and .dll have both been built but
SampleLibrary.dll was not installed.
Run 2: full build using scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: rebuilding `D:\Build\SampleLibrary\Test.obj' because
`SampleLibrary\Test.cpp' changed
cl /FoD:\Build\SampleLibrary\Test.obj /c SampleLibrary\Test.cpp /TP /nologo
/EHsc /MDd /FC /DWIN32 /DWIN32_LEAN_AND_MEAN /D_DEBUG /I.
scons: rebuilding `D:\Build\SampleLibrary\SampleLibrary.dll' because
`D:\Build\SampleLibrary\Test.obj' changed
link /nologo /DEBUG /dll /out:D:\Build\SampleLibrary\SampleLibrary.dll
/implib:D:\Build\SampleLibrary\SampleLibrary.lib /LIBPATH:D:\Bin
D:\Build\SampleLibrary\Test.obj D:\Build\SampleLibrary\stdafx.obj
LINK : D:\Build\SampleLibrary\SampleLibrary.dll not found or not built by
the last incremental link; performing full link
Creating library D:\Build\SampleLibrary\SampleLibrary.lib and object
D:\Build\SampleLibrary\SampleLibrary.exp
scons: rebuilding `D:\Bin\SampleLibrary.dll' because
`D:\Build\SampleLibrary\SampleLibrary.dll' changed
Install file: "D:\Build\SampleLibrary\SampleLibrary.dll" as
"D:\Bin\SampleLibrary.dll"
scons: rebuilding `D:\Bin\SampleLibrary.lib' because
`D:\Build\SampleLibrary\SampleLibrary.lib' changed
Install file: "D:\Build\SampleLibrary\SampleLibrary.lib" as
"D:\Bin\SampleLibrary.lib"
scons: rebuilding `D:\Bin\SampleLibrary.exp' because
`D:\Build\SampleLibrary\SampleLibrary.exp' changed
Install file: "D:\Build\SampleLibrary\SampleLibrary.exp" as
"D:\Bin\SampleLibrary.exp"
scons: rebuilding `D:\Build\SampleApplication\SampleApplication.exe'
because `D:\Bin\SampleLibrary.lib' changed
link /nologo /DEBUG /OUT:D:\Build\SampleApplication\SampleApplication.exe
/LIBPATH:D:\Bin SampleLibrary.lib D:\Build\SampleApplication\main.obj
D:\Build\SampleApplication\stdafx.obj
LINK : D:\Build\SampleApplication\SampleApplication.exe not found or not
built by the last incremental link; performing full link
Creating library D:\Build\SampleApplication\SampleApplication.lib and
object
D:\Build\SampleApplication\SampleApplication.exp
scons: rebuilding `D:\Bin\SampleApplication.exe' because
`D:\Build\SampleApplication\SampleApplication.exe' changed
Install file: "D:\Build\SampleApplication\SampleApplication.exe" as
"D:\Bin\SampleApplication.exe"
scons: done building targets.
Note that this time, SampleLibrary.lib and .dll have both been built and
installed
I can attach a zip of the whole project if that helps and isn't against
mlist etiquette?
Thanks,
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130131/31a60d60/attachment.html>
More information about the Scons-users
mailing list