Archive: Building NSIS for various compiler (VC6,VC7,VC8...)


Building NSIS for various compiler (VC6,VC7,VC8...)
  I am really having a hard time having SCons build NSIS source for various compilers on my machine where VC6, VC7 (VC++ Toolkit 2003), VC8 (VC++ Express 2005) are installed.
If I run SCons without any changes, it compiles perfectly with VC8. Now I'd like to run it with other compilers.

I tried a lot of various thing and option switches, or even tried to tweak SConstruct, but I get various type of errors, most of the time before it even starts compiling!
Here are some examples of the errors I get:

AttributeError: SConsEnvironment instance has no attribute 'Program':
File "D:\Prog\extern\NSIS\SCons\Config\ms", line 67:
if not conf.TryLink(libcptest % 'no change', '.cpp'):
File "C:\Programs\Python26\Lib\site-packages\scons-1.3.0\SCons\SConf.py", line 618:
return self.TryBuild(self.env.Program, text, extension )
Checking for C library zdll... no
Checking for C library z... no
zlib (win32) is missing!
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [build\release\AdvSplash\AdvSplash.dll] AttributeError : 'NoneType' object has no attribute '__dict__'
So my question is:
How to make this work?! Was someone able to achieve that on a single machine?
What is the set of environment variables needed for each compiler?
I have already:
MSDevDir=C:\Program Files\Microsoft Visual Studio\Common\MSDev98
VCToolkitInstallDir=C:\Program Files\Microsoft Visual C++ Toolkit 2003\
VS80COMNTOOLS=C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\
ZLIB_W32=D:\Prog\extern\zlib
How to force SCons into using a specific compiler?
I already tried forcing values like:
defenv['MSVS_VERSION'] = "6.0"
defenv["MSVS"] = {"VERSION": "6.0"}
defenv["MSVC_VERSION"] = "6.0"
in SConstruct, without success... checking the effect with a print defenv.Dump()
Is the only solution to not have compilers in the standard installation path in order for SCons not to find those compilers?

I used to be able to compile with VC6 and SCons 0.98 just fine, now with the need for a updated SCons (Why??) it no longer compiles without problems.


I use Python 2.6 and SCons 1.3.0 ...


I'm using VC6 SP5+PP and PlatformSDK2003Feb, IIRC the new scons screws up the include directory order for me so I had to override the include and lib dirs in my scons command


The following patch should allow you to select a specific Microsoft compiler.
See also www.scons.org/wiki/MsvsMultipleVersions

Index: SConstruct

>===================================================================
---SConstruct (revision 6046)
+++SConstruct (working copy)
@@ -151,6 +151,7 @@
>opts.Add(('PATH', 'A colon-separated list of system paths instead of the default - TEMPORARY AND MAY DEPRECATE', None))
>opts.Add(('TOOLSET', 'A comma-separated list of specific tools used for building instead of the default', None))
>opts.Add(BoolVariable('MSTOOLKIT', 'Use Microsoft Visual C++ Toolkit', 'no'))
+opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', os.environ.get('MSVS_VERSION'), allowed_values=('6.0', '7.0', '7.1', '8.0', '8.0Exp', '9.0', '9.0Exp', '10.0', '10.0Exp')))
>opts.Add(BoolVariable('CHMDOCS', 'Build CHM documentation, requires hhc.exe', hhc))
>opts.Add(PathVariable('APPEND_CPPPATH', 'Additional paths to search for include files', None))
>opts.Add(PathVariable('APPEND_LIBPATH', 'Additional paths to search for libraries', None))
After you applied the patch you would either set the MSVS_VERSION environment variable or provide MSVS_VERSION as option to scons.

For example to select "Microsoft Visual C++ 2008 Express Edition":

set MSVS_VERSION=9.0Exp

scons
>
or

scons MSVS_VERSION=9.0Exp 

>
scons 1.2.0 has difficulties to detect the Platform SDK installed with VC++ 2008 Express Edition. So in that case you would need to upgrade to scons 1.3.0.

f0rt, I have been telling you for weeks now, VC6 SP5+PP and PlatformSDK2003Feb is the "default" setup and it is currently broken, so can you please fix it, or revert to older scons? I can't remember if it was you or Wizou that made 1.x a requirement, but something broke when that change was made, either with scons itself or our build script


If I change from scons 1.3 to 1.2, my VC6 setup builds, so I guess my problem is with scons itself. So, somebody (f0rt?) should file a bug with scons about platform sdk detection (I know they have done some changes there)


mmmh using f0rt changes, I was able to compile under VC6

and then moving from scons 1.3.0 to 1.2.0, I was able to compile under MSToolkit VC2003, but no longer under VC6 !

grrrr!

(at least, it teaches us that if Nightly builds are made under MSToolkit 2003, they should use SCons 1.2.0)