SCons doesn't like op.environ on windows system.

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
MathGeek
Space Floater
Posts: 29
Joined: Mon Mar 09, 2009 1:47 am
Location: Michigan (US)

SCons doesn't like op.environ on windows system.

#1 Post by MathGeek »

I am sure you guys are just groaning on reading the title of this thread. "Another noob can't even get the compiler to work!" :oops:
I saw some general references to scons not passing environment variables correctly, which seems related to what I am getting here, but I couldn't track down a solution that I could understand well enough to adapt it to the error message I was getting:

Code: Select all

scons : Reading Sconscript files ...
KeyError: 'LIB':
	File "D:\FreeOrion_SDK\FreeOrion\GG\SConstruct", line 11:
		'LIB' : os.environ['LIB'],
	File "D:\Python25\lib\os.py", line 433:
		return self.data[key.upper()]
(NOTE: the above was hand typed, so it may have a typo. ask if you're not sure.)
I get this error any time I scons anything. I was following the readme and had no trouble with SVN. Here are the relevant stats:

Windows XP home ed SP3 installed on an old AMD 64bit Athalon
Python 2.5.4
(I also have 2.6.1 installed, but scons should be looking at the other, I have tried both to no avail.)
scons-1.2.0 (d20090223 if that's relevant)
Here's the log file

Code: Select all

file C:\Documents and Settings\tzlaine\Desktop\FreeOrion_SDK\FreeOrion\GG\SConstruct,line 283:
	Configure(confdir = .sconf_temp)
scons: Configure: Checking for pkg-config... 
pkg-config --atleast-pkgconfig-version 0.15.0
'pkg-config' is not recognized as an internal or external command,
operable program or batch file.
scons: Configure: no

scons: Configure: Checking for C++ header file boost/shared_ptr.hpp... 
.sconf_temp\conftest_1.cpp <-
  |
  |#include "boost/shared_ptr.hpp"
  |
  |
cl /nologo /TP "/IC:\Documents and Settings\tzlaine\Desktop\FreeOrion_SDK\Boost\include\boost-1_36" /c .sconf_temp\conftest_1.cpp /Fo.sconf_temp\conftest_1.obj
conftest_1.cpp
.sconf_temp\conftest_1.cpp(2) : fatal error C1083: Cannot open include file: 'boost/shared_ptr.hpp': No such file or directory
scons: Configure: no

scons: Configure: Boost configuration... 
scons: Configure: (cached) no
Any help would be greatly appreciated!

[EDIT] Umm, after some more searching I found this:
viewtopic.php?f=24&t=2466&p=35311&hilit ... %2C#p35311
Is that what I need to do? Where does this code go?
There is no charge for awesomeness ... or attractiveness.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: SCons doesn't like op.environ on windows system.

#2 Post by Geoff the Medio »

I believe the pkgconfig stuff is only relevant for linux.

What commands do you enter to "scons anything" ? Starting from a fresh unpack of the SDK, what do or did you do?

Is that the entire conents of your config.log in the GG directory?

You might also try the MSVC 2008 project files if you can't get scons working.

User avatar
MathGeek
Space Floater
Posts: 29
Joined: Mon Mar 09, 2009 1:47 am
Location: Michigan (US)

Re: SCons doesn't like op.environ on windows system.

#3 Post by MathGeek »

Geoff the Medio wrote:What commands do you enter to "scons anything" ? Starting from a fresh unpack of the SDK, what do or did you do?
OK, with fresh unpack starting in the sdk directory. (computer responses preceded by "-")

Code: Select all

cd  freeorion\gg
svn update
-At Revision 711
cd ..
svn update
-Fetching external item into 'GG'
-External At Revision 711
-{huge list of files followed by...}
-At Revision 2921
cd gg
scons config
{Which is where I get the error previously noted.}
I get the same error if I type "scons update", "scons help", "scons", etc. It doesn't matter what command line arguments I feed it, the error is the same.
Geoff the Medio wrote:Is that the entire conents of your config.log in the GG directory?
Yes.
Geoff the Medio wrote:You might also try the MSVC 2008 project files if you can't get scons working.
I am going to try that a little later this week, I have a project due on Wednesday, so I can't dedicate too much time to fixing this yet :( . Thank you for your help!
There is no charge for awesomeness ... or attractiveness.

User avatar
loonycyborg
Compilation Expert
Posts: 219
Joined: Thu Jul 06, 2006 10:30 pm
Location: Russia/Moscow

Re: SCons doesn't like op.environ on windows system.

#4 Post by loonycyborg »

MathGeek wrote:

Code: Select all

scons : Reading Sconscript files ...
KeyError: 'LIB':
	File "D:\FreeOrion_SDK\FreeOrion\GG\SConstruct", line 11:
		'LIB' : os.environ['LIB'],
	File "D:\Python25\lib\os.py", line 433:
		return self.data[key.upper()]
Try replacing os.environ['LIB'] with os.environ.get('LIB') on line 11 in the SConstruct file.
In Soviet Russia, forum posts YOU!!

User avatar
MathGeek
Space Floater
Posts: 29
Joined: Mon Mar 09, 2009 1:47 am
Location: Michigan (US)

Re: SCons doesn't like op.environ on windows system.

#5 Post by MathGeek »

loonycyborg wrote: Try replacing os.environ['LIB'] with os.environ.get('LIB') on line 11 in the SConstruct file.
After making a couple of those changes, I got scons to run, but it didn't actually compile the program :? There was no executable file in the freeorion directory.

here is the config.log

Code: Select all

file D:\FreeOrion_SDK\FreeOrion\GG\SConstruct,line 293:
	Configure(confdir = .sconf_temp)
scons: Configure: Checking for pkg-config... 
pkg-config --atleast-pkgconfig-version 0.15.0
'pkg-config' is not recognized as an internal or external command,
operable program or batch file.
scons: Configure: no

scons: Configure: Checking for C++ header file boost/shared_ptr.hpp... 
.sconf_temp\conftest_1.cpp <-
  |
  |#include "boost/shared_ptr.hpp"
  |
  |
cl /Fo.sconf_temp\conftest_1.obj /c .sconf_temp\conftest_1.cpp /TP /nologo /ID:\FreeOrion_SDK\Boost\include\boost-1_36
'cl' is not recognized as an internal or external command,
operable program or batch file.
scons: Configure: no

scons: Configure: Boost configuration... 
scons: Configure: (cached) no
I think I will try going the MSVC next.
There is no charge for awesomeness ... or attractiveness.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: SCons doesn't like op.environ on windows system.

#6 Post by Geoff the Medio »

After "scons configure" (that's configure, not just config) you need to "scons install" in the GG directory, and then "scons configure" in the freeorion directory, and "scons" in the freeorion directory as well. Did you do all those steps?

User avatar
loonycyborg
Compilation Expert
Posts: 219
Joined: Thu Jul 06, 2006 10:30 pm
Location: Russia/Moscow

Re: SCons doesn't like op.environ on windows system.

#7 Post by loonycyborg »

MathGeek wrote:

Code: Select all

cl /Fo.sconf_temp\conftest_1.obj /c .sconf_temp\conftest_1.cpp /TP /nologo /ID:\FreeOrion_SDK\Boost\include\boost-1_36
'cl' is not recognized as an internal or external command,
operable program or batch file.
Interesting.. There's no cl in PATH while in your previous config.log cl was found..
In Soviet Russia, forum posts YOU!!

Sajaki
Space Krill
Posts: 4
Joined: Sun Mar 08, 2009 6:40 am

Re: SCons doesn't like op.environ on windows system.

#8 Post by Sajaki »

Hi, another newbie here. Got same error as MathGeek when doing scons configure.

Did change os.environ['LIB'] to os.environ.get('LIB') line 11 in SConstruct, and then got same error on line 12 in SConstruct:

C:\FreeOrion_SDK\FreeOrion\GG>scons configure
scons: Reading SConscript files ...
KeyError: 'INCLUDE':
File "C:\FreeOrion_SDK\FreeOrion\GG\SConstruct", line 12:
'INCLUDE' : os.environ['INCLUDE']})
File "C:\Python25\lib\os.py", line 433:
return self.data[key.upper()]

Then changed os.environ['INCLUDE'] to os.environ.get('INCLUDE')
Probably not a smart thing to do, got following output:

C:\FreeOrion_SDK\FreeOrion\GG>scons configure
scons: Reading SConscript files ...
AttributeError: 'NoneType' object has no attribute 'encode':
File "C:\FreeOrion_SDK\FreeOrion\GG\SConstruct", line 12:
'INCLUDE' : os.environ.get('INCLUDE')})
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Environment.py
", line 995:
apply_tools(self, tools, toolpath)
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Environment.py
", line 106:
env.Tool(tool)
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Environment.py
", line 1694:
tool(self)
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Tool\__init__.
py", line 181:
apply(self.generate, ( env, ) + args, kw)
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Tool\default.p
y", line 41:
SCons.Tool.Tool(t)(env)
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Tool\__init__.
py", line 181:
apply(self.generate, ( env, ) + args, kw)
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Tool\mslink.py
", line 242:
merge_default_version(env)
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Tool\MSCommon\
vs.py", line 475:
nenv = normalize_env(env['ENV'], vscommonvarnames + ['COMSPEC'])
File "C:\Python25\Lib\site-packages\scons-1.2.0.d20090223\SCons\Tool\MSCommon\
common.py", line 82:
normenv[k] = copy.deepcopy(env[k]).encode('mbcs')


Before I dive in I to figure this out, just thought I might ask around. Might save me some time...
Cheers

User avatar
MathGeek
Space Floater
Posts: 29
Joined: Mon Mar 09, 2009 1:47 am
Location: Michigan (US)

Re: SCons doesn't like op.environ on windows system.

#9 Post by MathGeek »

Hmm, this is a little wierd. I thought I had MSVC installed already, but it seems I didn't. After installing 2008 version, I got everything to work up until ".\freeorion\scons install" which had some trouble loading python25.dll could this have something to do with the fact that I uninstalled 2.5 in favor of 2.6? I will switch back and find out. In the mean time, Sajaki, you might try (re)installing Microsoft Visual (something). I will keep you posted. :)
There is no charge for awesomeness ... or attractiveness.

Sajaki
Space Krill
Posts: 4
Joined: Sun Mar 08, 2009 6:40 am

Re: SCons doesn't like op.environ on windows system.

#10 Post by Sajaki »

Thanks MathGeek, but it was just a question of environment variables :oops:. Added LIB and INCLUDE in my windows variables. exe-files built fine (although the game dumps immediately when starting... but that's another issue).

For anyone wanting to check their environment, paste this little snippet in you SConstruct file, before os.environ-calls:

for key in os.environ.keys():
print key

User avatar
MathGeek
Space Floater
Posts: 29
Joined: Mon Mar 09, 2009 1:47 am
Location: Michigan (US)

Re: SCons doesn't like op.environ on windows system.

#11 Post by MathGeek »

Well, I said I had it sorted, but the problem came back after a reboot. Thanks for the tip Sajaki. My environment vars weren't set either. Maybe we should add a line to the readme file about setting those? I will look into having scons make them automatically. Anyway, not a big deal, but after I got it built I keep getting some error with ogre.

Code: Select all

main() caught exception(std::exception): OGRE EXCEPTION(7:InternalErrorException): Could not load dynamic library .\Plugin_CgProgramManager. System Error: The specified module could not be found.
 in DynLib::load at ..\src\OgreDynLib.cpp (line 80)
I didn't have any trouble like this when I downloaded the binary, so it must be from the build. Any ideas?
There is no charge for awesomeness ... or attractiveness.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: SCons doesn't like op.environ on windows system.

#12 Post by Geoff the Medio »

If your version of the SDK is more than a few days old, you might be missing Plugin_CgProgramManager.dll and cg.dll. If that's the case, you can get them from the OGRE installer, or by redownloading the FreeOrion SDK.

User avatar
MathGeek
Space Floater
Posts: 29
Joined: Mon Mar 09, 2009 1:47 am
Location: Michigan (US)

Re: SCons doesn't like op.environ on windows system.

#13 Post by MathGeek »

OK, so I downloaded ogre sdk, but that didn't help, so I went ahead and downloaded the freeorion sdk from sourceforge today. After getting that all updated and configuring it for python 2.6, I didn't get the ogre error :D . Instead I got a new error :(

Code: Select all

main() caught exception(GG::Font::BadFile): Face object created from "D:\Program Files\Freeorion\default\DejaVuSans.ttf" was invalid
Here is the contents of the GG config.log (edited to show the errors that I thought might be relevant).

Code: Select all

[...]	

scons: Configure: Checking for C header file jpeglib.h... 
.sconf_temp\conftest_3.c <-
  |#include "stdio.h"
  |
  |#include "jpeglib.h"
  |
  |
cl /Fo.sconf_temp\conftest_3.obj /c .sconf_temp\conftest_3.c /nologo /ID:\FreeOrion_SDK\Boost\include\boost-1_36 /ID:\FreeOrion_SDK\include
conftest_3.c
.sconf_temp\conftest_3.c(3) : fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory
scons: Configure: no

[...]

scons: Configure: Checking for C header file tiffio.h... 
.sconf_temp\conftest_5.c <-
  |
  |#include "tiffio.h"
  |
  |
cl /Fo.sconf_temp\conftest_5.obj /c .sconf_temp\conftest_5.c /nologo /ID:\FreeOrion_SDK\Boost\include\boost-1_36 /ID:\FreeOrion_SDK\include
conftest_5.c
.sconf_temp\conftest_5.c(2) : fatal error C1083: Cannot open include file: 'tiffio.h': No such file or directory
scons: Configure: no

[...]

scons: Configure: Checking for C header file SDL/SDL.h... 
.sconf_temp\conftest_6.c <-
  |
  |#include "SDL/SDL.h"
  |
  |
cl /Fo.sconf_temp\conftest_6.obj /c .sconf_temp\conftest_6.c /nologo /MD /EHsc /W3 /Zc:forScope /GR /Gd /Zi /wd4146 /wd4099 /wd4251 /wd4800 /wd4267 /wd4275 /wd4244 /wd4101 /wd4258 /wd4351 /wd4996 /DBOOST_ALL_DYN_LINK /DNDEBUG /DWIN32 /D_WINDOWS /D_USRDLL /D_WINDLL /ID:\FreeOrion_SDK\Boost\include\boost-1_36 /ID:\FreeOrion_SDK\include /I. /Ilibltdl
conftest_6.c
.sconf_temp\conftest_6.c(2) : fatal error C1083: Cannot open include file: 'SDL/SDL.h': No such file or directory
scons: Configure: no

scons: Configure: Checking for C header file SDL.h... 
.sconf_temp\conftest_7.c <-
  |
  |#include "SDL.h"
  |
  |
cl /Fo.sconf_temp\conftest_7.obj /c .sconf_temp\conftest_7.c /nologo /MD /EHsc /W3 /Zc:forScope /GR /Gd /Zi /wd4146 /wd4099 /wd4251 /wd4800 /wd4267 /wd4275 /wd4244 /wd4101 /wd4258 /wd4351 /wd4996 /DBOOST_ALL_DYN_LINK /DNDEBUG /DWIN32 /D_WINDOWS /D_USRDLL /D_WINDLL /ID:\FreeOrion_SDK\Boost\include\boost-1_36 /ID:\FreeOrion_SDK\include /I. /Ilibltdl
conftest_7.c
.sconf_temp\conftest_7.c(2) : fatal error C1083: Cannot open include file: 'SDL.h': No such file or directory
scons: Configure: no

[...]
There is no charge for awesomeness ... or attractiveness.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: SCons doesn't like op.environ on windows system.

#14 Post by Geoff the Medio »

It's trying to load font files from the installed freeorion directory (under program files) and not the SDK directory because you've got an old config.xml telling freeorion.exe to load font files from somewhere it shouldn't. Delete that file from

C:\Users\Username\AppData\Roaming\FreeOrion

Post Reply