Skip to content
⌘ NSIS Forum Archive

Building CVS with scons

40 posts

LIGHTNING UK!#

Building CVS with scons

I hope someone can point me in the right direction here...

I've just downloaded + installed Python 2.4, scons 0.96.1, Microsoft SDK (core package), Microsoft Visual C++ Toolkit 2003.

When I attempt to compile using details here:



...this is what I'm getting:

C:\NSIS>scons
scons: Reading SConscript files ...
Using default tools configuration
AttributeError: SConsEnvironment instance has no attribute 'RES':
File "SConstruct", line 94:
target = SConscript(dirs = 'Source/exehead', build_dir = build_dir, duplicat
e = 0, exports = exports)
File "C:\Python24\scons\SCons\Script\SConscript.py", line 581:
return apply(method, args, kw)
File "C:\Python24\scons\SCons\Script\SConscript.py", line 508:
return apply(_SConscript, [self.fs,] + files, {'exports' : exports})
File "C:\Python24\scons\SCons\Script\SConscript.py", line 239:
exec _file_ in stack[-1].globals
File "Source\exehead\SConscript", line 77:
res = env.RES(resources)
and with the mstoolkit parameter

C:\NSIS>scons MSTOOLKIT=yes
scons: Reading SConscript files ...
Using Microsoft tools configuration
Checking for main() in C library gdi32... yes
Checking for main() in C library user32... yes
Checking for main() in C library version... yes
Checking for main() in C library pthread... no
Checking for main() in C library stdc++... no
Checking for main() in C library iconv... no
Checking for main() in C library libiconv... no

scons: *** Multiple ways to build the same target were specified for: AdvSplash.
dll
File "Contrib\AdvSplash\SConscript", line 18, in ?
deguix#edited
Try to update your Scons to version 0.96.90 to see if that happens again.
LIGHTNING UK!#
I had already tried that actually, but the 0.96.1 seemed to be the better of the two! Anyway, here's the log from that version

C:\NSIS>scons
scons: Reading SConscript files ...
TypeError: cannot concatenate 'str' and 'NoneType' objects:
File "SConstruct", line 47:
prefix = GetLaunchDir() + os.sep
File "C:\Python24\scons\SCons\Script\SConscript.py", line 532:
env = self.factory()
File "C:\Python24\scons\SCons\Script\SConscript.py", line 512:
default_env = SCons.Defaults.DefaultEnvironment()
File "C:\Python24\scons\SCons\Defaults.py", line 65:
_default_env = apply(SCons.Environment.Environment, args, kw)
File "C:\Python24\scons\SCons\Memoize.py", line 815:
klassdict['__init__'] = lambda self, *args, **kw: newinit(self, args, kw)
File "...\SCons\Memoizer-init-lambda<C:\Python24\scons\SCons\Memoize.py>", lin
e 1:
None
File "C:\Python24\scons\SCons\Memoize.py", line 774:
apply(actual_init, (self,)+args, kw)
File "C:\Python24\scons\SCons\Memoize.py", line 1:
"""Memoizer
File "C:\Python24\scons\SCons\Memoize.py", line 777:
apply(super(cls, self).__init__, args, kw)
File "C:\Python24\scons\SCons\Memoize.py", line 815:
klassdict['__init__'] = lambda self, *args, **kw: newinit(self, args, kw)
File "...\SCons\Memoizer-init-lambda<C:\Python24\scons\SCons\Environment.py>",
line 465:
None
File "C:\Python24\scons\SCons\Memoize.py", line 774:
apply(actual_init, (self,)+args, kw)
File "C:\Python24\scons\SCons\Environment.py", line 511:
apply_tools(self, tools, toolpath)
File "C:\Python24\scons\SCons\Environment.py", line 129:
env.Tool(tool, toolpath)
File "C:\Python24\scons\SCons\Environment.py", line 1055:
tool(self)
File "C:\Python24\scons\SCons\Tool\__init__.py", line 87:
apply(self.generate, ( env, ) + args, kw)
File "C:\Python24\scons\SCons\Tool\default.py", line 40:
for t in SCons.Tool.tool_list(env['PLATFORM'], env):
File "C:\Python24\scons\SCons\Tool\__init__.py", line 382:
c_compiler = FindTool(c_compilers, env) or c_compilers[0]
File "C:\Python24\scons\SCons\Tool\__init__.py", line 301:
if t.exists(env):
File "C:\Python24\scons\SCons\Tool\intelc.py", line 278:
top = get_intel_compiler_top()
File "C:\Python24\scons\SCons\Tool\intelc.py", line 142:
top = get_intel_registry_value('ProductDir', version, abi)
File "C:\Python24\scons\SCons\Tool\intelc.py", line 69:
K = 'Software\\Intel\\Compilers\\C++\\' + version + '\\'+abi.upper()
Same for both with and without the MSTOOLKIT=yes parameter.
kichik#
If you're using the toolkit you must use MSTOOLKIT=yes. It might not work because it can not find cl.exe in the path. Try running scons using the Visual C++ Toolkit 2003 Command Prompt. The toolkit installs a link to it on the start menu and in its installation directory.
LIGHTNING UK!#
Ok well I finally kinda got it working after a lot of messing around (not knowing what I'm doing!).

MakeLangId wont complile because it cant find AFXRES.H or WINRES.h.

halibut fails to compile because the environment paths aren't set up correctly. The MSTOOLKIT bit is effectivly ignored in the SConscript in its folder as only the default environment is used.

You also need to ensure hhc is installed and its folder added to the 'path' environment variable.

Download it from here:



contrib/startmenu also wont compile. Needs afxres.h and winres.h too.


Once all that's out of the way, I'm left with this:

C:\NSIS>scons MSTOOLKIT=yes
scons: Reading SConscript files ...
Using Microsoft tools configuration
Checking for main() in C library gdi32... yes
Checking for main() in C library user32... yes
Checking for main() in C library version... yes
Checking for main() in C library pthread... no
Checking for main() in C library stdc++... no
Checking for main() in C library iconv... no
Checking for main() in C library libiconv... no
Using Microsoft tools configuration
scons: done reading SConscript files.
scons: Building targets ...
scons: *** Source `Contrib\AdvSplash\AdvSplash' not found, needed by target `build\AdvSplash\AdvSplash.map'. Stop.
scons: building terminated because of errors.
deguix#
It's now also very easy to build NSIS using the free Visual C++ Toolkit 2003 and Platform SDK.
Kichik just forgot to mention about the "HTML Help Workshop" to compile the docs.

Now, about the problem, it's maybe because you only have the core of Platform SDK. I downloaded all packages, and the latest update for WinXP SP2, and the compilation works.
LIGHTNING UK!#
Ok, it seems the beta of scons works ok but the old one wont.

I'm doing this build on a clean install of Windows 2003, so chances are, others will need to do them too.

I expect you lot have already got loads of bits installed which is making life easier for you!

Copying over the missing header files from MakeLangId and StartMenu isn't a big deal but I'd like the 'Documentation' chunk of the SContruct file fixed so that the correct environment variables are set up and it doesn't again complain about not being able to find cl.exe - which obviously it has been able to find ok for the rest of the script before that point.

I ended up changing SConstruct

stub_env = envs[0]
makensis_env = envs[1]
plugin_env = envs[2]
util_env = envs[3]
to

stub_env = envs[0]
makensis_env = envs[1]
help_env = makensis_env.Copy()
plugin_env = envs[2]
util_env = envs[3]
and then

halibut = SConscript(
dirs = 'Docs/src/bin/halibut',
build_dir = build_prefix + 'halibut',
duplicate = 0
)
to

halibut = SConscript(
dirs = 'Docs/src/bin/halibut',
build_dir = build_prefix + 'halibut',
duplicate = 0,
exports = {'env' : help_env.Copy()}
)
I then changed Docs\src\bin\halibut\SConscript

by changing:

env = Environment()
to

Import('env')
It then compile / linked just fine.

I've no idea if what I've done above is ok, but it works... and that's all that matters!
kichik#
halibut SConscript was indeed using the wrong environment. I've already fixed this in the latest CVS version in a manner similar to what you've suggested.

However, the current CVS can fail building NSIS Update. You can use the -k command line option to keep building anyway.
LIGHTNING UK!#
Ok, I'll keep an eye out for the updated CVS version, it still seems to show the old one on sourceforge.

Can I also point out the makensis.nsi script now fails for 2 reasons (rather than just the 1 it's failed on for a while now).

1. 'bin2h.exe' is still referenced.

2. 'Contrib\Library\LibraryLocal\*.exe' no longer exists because the LibraryLocal.exe is in the 'build\Library\LibraryLocal' folder.
kichik#
Originally posted by kichik
halibut SConscript was indeed using the wrong environment. I've already fixed this in the latest CVS version in a manner similar to what you've suggested.
Oops, was thinking of something else. It's really fixed in CVS now.
iceman_k#
A new problem building the docs:

C:\projects\NSIS>scons -j4 MSTOOLKIT=yes
scons: Reading SConscript files ...
Using Microsoft tools configuration
Checking for main() in C library gdi32... (cached) yes
Checking for main() in C library user32... (cached) yes
Checking for main() in C library version... (cached) yes
Checking for main() in C library pthread... (cached) no
Checking for main() in C library stdc++... (cached) no
Checking for main() in C library iconv... (cached) no
Checking for main() in C library libiconv... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
Copy("C:\projects\NSIS\build\release\Docs", "Docs\src/../style.css")
scons: *** [build\release\Docs\NSIS.chm] Permission denied
scons: building terminated because of errors.
The problem is that the files being copied in the Docs Sconscript file are read-only and that is killing Scons.
So either the destination files should be deleted first or the copy action should force an overwrite.
Comm@nder21#
installed latest python (2.4.1) and scons (0.96.90).
opening console at my nsis root (E:\Programme\NSIS\) and typing "scons" just gives me an error "file or command not found".

what am i doing wrong?

read the news carefully, theres nothing else mentioned.

or do i really need the vcpp toolkit?
LIGHTNING UK!#
Can anyone fix it so that the !InstallNSIS.BAT file (and the script it calls) actually works?

It's great that I can now compile the CVS data without any critical errors, but if I then get stuck building the installer, it's not much use 😉

Thanks!
Comm@nder21#
Make sure that python, VC toolkit and hhc.exe are in your path.
that they are in WHICH path?

and why isn't that fact mentioned anywhere in the documentation/news?

if i install python, it installs to "C:\Program Files\Python24" (on english systems), on mine this would be E:\Programme\Python.
scons uses the same dir:
E:\Programme\Python\scons\SCons
(doubled folder may be a bug in the installer of scons - they didnt use nsis 😁)

nsis is installed in E:\Programme\NSIS
vctoolkit (which i now downloaded and installed) is in
"E:\Programme\Microsoft VisualC++ 2003 Toolkit"

now, what files do i have to put to which directories manually?
LIGHTNING UK!#
if you type 'set path' from the command prompt, you should see e:\programme\python in there somewhere. If not, you need to add it via the 'properties -> Advanced -> Environment variables' bit when you right click My Computer.

After that, it should just be 'scons MSTOOLKIT=yes' to get it to compile. Scons configures the other path settings it needs. Dont forget you need hhc (help workshop from microsoft) installed too.
Comm@nder21#
E:\Programme\NSIS>scons -j4 MSTOOLKIT=yes
scons: Reading SConscript files ...

scons: *** Path does not exist for option CPPPATH:
File "SConstruct", line 61, in ?
E:\Programme\NSIS>
LIGHTNING UK!#
Ermm don't know the answer to that one, sorry!

if you type 'set' from the command prompt, do you get a line like:

VCToolkitInstallDir=C:\Program Files\Microsoft Visual C++ Toolkit 2003\

?? (Obviously your path will be different if you changed it from the default)
LIGHTNING UK!#
ok, still no idea then.

I thought I'd had pretty much every problem is was possible to have. Now it seems I didn't 😉
kichik#
iceman_k, that's very weird... SCons first tries to copy the file and then set the destination to writable:
def _copy_func(src, dest):
shutil.copy2(src, dest)
st=os.stat(src)
os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
I'll see if I can find a workaround or if I'm reading this right later.

LIGHTNING UK!, makensis.nsi will be fixed later. I'm not too sure what I want to do with it yet. I'd be great if the SCons script could generate the installer script too so I only have to specify what to install and where only once. For now, you can use NSIS from the build directory or use:
scons PREFIX="C:\Program Files\NSIS" install
Comm@nder21, are you using the latest version from CVS? I don't get any error with CPPPATH and I'm using the same versions of Python and SCons as you. Is anyone else getting this error?

Please don't post every SCons related question or problem in this thread. It'll get pretty huge and hard to follow.

BTW, I've finally managed to get wine to compile on my linux. It only took a night. I've also managed to get the VC Toolkit, Python and SCons to run on it. With some minor changes to everything involved, NSIS builds just fine. All except the CHM which still needs some love. A complete build took only 3 and half hours on my all so powerful Pentium 100. Once it's completely working, it'll be used to create real nightly snapshots.
Comm@nder21#
yep, i updated it just atm.

could you have a look at your environment vars if theres one called CPPPATH ?

i don't have one, that may be the problem.

installed all programs with their native installer programs, though.
kichik#
I don't have CPPPATH in my environment. CPPPATH is an option which can be used on the command line. It has a default value of None. None should be a "valid" path. Run scons with --debug=stacktrace and attach the stack trace. To get around this, you can try giving it a real path in CPPPATH.
kichik#
iceman_k, I was looking at the wrong place. It's not the copy function that fails, it's the deletion of the target file before the installation. It does however make some sense as read only files shouldn't be touched. I am willing to accept with this reasonable limitation. If you wish, you can submit a bug report to scons.
Comm@nder21#
updated cvs, which contained a new sconstruct scriptfile, but gave the same error.
then ran with your debug instruction:
SCons error: Warning: stacktrace is not a valid debug type
/edit:
updated scons to 0.96.90, like you posted in the other thread.
now i get other errors, which i think are results of missing platform sdk 🙂
(this **** microsoft server gives me no more than 10kbit/s, no pausable downloads, not more than 2 connections a time!!!!)
Comm@nder21#
downloaded and installed platform sdk (under admin account).
get the following errors:
E:\Programme\NSIS>scons -j4 MSTOOLKIT=yes
scons: Reading SConscript files ...
TypeError: cannot concatenate 'str' and 'NoneType' objects:
File "SConstruct", line 54:
defenv = Environment()
File "E:\Programme\Python\scons\SCons\Memoize.py", line 815:
klassdict['__init__'] = lambda self, *args, **kw: newinit(self, args, kw)
File "...\SCons\Memoizer-init-lambda<E:\Programme\Python\scons\SCons\Memoize.p
y>", line 1:
None
File "E:\Programme\Python\scons\SCons\Memoize.py", line 774:
apply(actual_init, (self,)+args, kw)
File "E:\Programme\Python\scons\SCons\Memoize.py", line 1:
"""Memoizer
File "E:\Programme\Python\scons\SCons\Memoize.py", line 777:
apply(super(cls, self).__init__, args, kw)
File "E:\Programme\Python\scons\SCons\Memoize.py", line 815:
klassdict['__init__'] = lambda self, *args, **kw: newinit(self, args, kw)
File "...\SCons\Memoizer-init-lambda<E:\Programme\Python\scons\SCons\Environme
nt.py>", line 465:
None
File "E:\Programme\Python\scons\SCons\Memoize.py", line 774:
apply(actual_init, (self,)+args, kw)
File "E:\Programme\Python\scons\SCons\Environment.py", line 511:
apply_tools(self, tools, toolpath)
File "E:\Programme\Python\scons\SCons\Environment.py", line 129:
env.Tool(tool, toolpath)
File "E:\Programme\Python\scons\SCons\Environment.py", line 1055:
tool(self)
File "E:\Programme\Python\scons\SCons\Tool\__init__.py", line 87:
apply(self.generate, ( env, ) + args, kw)
File "E:\Programme\Python\scons\SCons\Tool\default.py", line 40:
for t in SCons.Tool.tool_list(env['PLATFORM'], env):
File "E:\Programme\Python\scons\SCons\Tool\__init__.py", line 382:
c_compiler = FindTool(c_compilers, env) or c_compilers[0]
File "E:\Programme\Python\scons\SCons\Tool\__init__.py", line 301:
if t.exists(env):
File "E:\Programme\Python\scons\SCons\Tool\intelc.py", line 278:
top = get_intel_compiler_top()
File "E:\Programme\Python\scons\SCons\Tool\intelc.py", line 142:
top = get_intel_registry_value('ProductDir', version, abi)
File "E:\Programme\Python\scons\SCons\Tool\intelc.py", line 69:
K = 'Software\\Intel\\Compilers\\C++\\' + version + '\\'+abi.upper()
E:\Programme\NSIS>
system:
- windows xp sp2
- psdk for sp2
- vc toolkit 2003
- python 2.41
- scons 0.96.90

all installed without errors.
Comm@nder21#
i now probably know, why scons makes so much problems.

running it from cmd.exe gives me the last reported errors.

running it from the vc toolkit prompt brings me the error, that it couldn't find the psdk.
so, at first it doesnt find the vc toolkit.

the psdk is properly installed, and registered, but the scons script searches the wrong registry values.
i searched through the scons script, which contains the following lines:
mstoolkit.py
PlatformSDKDir = ""
try:
PlatformSDKDir = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MicrosoftSDK\Directories\Install Dir')[0]
PlatformSDKDir = str(PlatformSDKDir)
except SCons.Util.RegError:
raise SCons.Errors.InternalError, "The Platform SDK directory was not found in the registry."
it searches in HKLM\SOFTWARE\Microsoft\MicrosoftSDK\Directories\Install Dir
this is wrong.
on my system (see above for details) the install dir is stored in the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\B44C7E10-89BD-4A32-A3BF-D9D0BC4C9A05
as value:
Install Dir

changing this solves the problem with the psdk.