[Scons-users] CheckPkG on OS X 10.9
Gary Oberbrunner
garyo at oberbrunner.com
Thu May 1 17:54:16 EDT 2014
Start with the SCons man page at
http://www.scons.org/doc/HTML/scons-man.html. Right up near the top
you'll see examples of importing shell environment variables. For
instance, to import PATH and HOME:
import os
env = Environment(ENV = {'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME']})
You'll have to do some legwork to figure out which env var(s) are key
for your problem; just divide and conquer.
On Thu, May 1, 2014 at 5:47 PM, Mr iQ <mriq.13 at gmail.com> wrote:
>
> 2014-05-01 23:24 GMT+02:00 Gary Oberbrunner <garyo at oberbrunner.com>:
>
>> Probably something in your shell environment.
>> See if it works if you replace your env line with:
>> env = Environment(ENV=os.environ)
>>
>
> Bingo !!
> it worked.
>
>>
>> If it does, you have some shell environment variable that you may want
>> to code into your SConstruct.
>>
>
> how ?
> i wanted actually do that but i'm not python programmer and didn't know how
> to include it !
> (i start to like python... maybe some day i start learning python :p)
>
> Thanks again.
>
>>
>> On Thu, May 1, 2014 at 5:16 PM, Mr iQ <mriq.13 at gmail.com> wrote:
>> > Hi all,
>> >
>> > i use Mac OS X. I get problem compiling a simple source code which does
>> > print a gtk+ window. i can paste the source code if necessary but i
>> > don't
>> > think it does anything to do with the source code.
>> >
>> > i took the second example from this url :
>> > http://www.scons.org/wiki/UsingPkgConfig
>> >
>> > after running scons i get the following error message :
>> > scons: Reading SConscript files ...
>> > Checking for pkg-config...yes
>> > Checking for gtk+-3.0no
>> > GTK+-3.0 not be found
>> >
>> > Interesting is that when i run pkg-config --exists 'gtk+-3.0' from
>> > command
>> > line the exit code is 0
>> >
>> > here is the SConstruct file :
>> >
>> > import os
>> >
>> > env = Environment()
>> > env["PKG_CONFIG_PATH"] = os.environ.get("PKG_CONFIG_PATH") # a user in
>> > IRC
>> > suggested
>> > def CheckPKGConfig(context, version):
>> > context.Message( 'Checking for pkg-config...' )
>> > ret = context.TryAction('pkg-config
>> > --atleast-pkgconfig-version=%s'
>> > % version)[0]
>> > context.Result( ret )
>> > return ret
>> >
>> > def CheckPKG(context, name):
>> > context.Message( 'Checking for %s' % name )
>> > ret = context.TryAction('pkg-config --exists \'%s\'' % name)[0]
>> > context.Result( ret )
>> > return ret
>> >
>> > # Configuration
>> >
>> > conf = Configure(env, custom_tests = { 'CheckPKGConfig' :
>> > CheckPKGConfig,
>> > 'CheckPKG' : CheckPKG})
>> >
>> > if not conf.CheckPKGConfig('0.15.0'):
>> > print 'pkg-config not found'
>> > Exit(1)
>> >
>> >
>> > if not conf.CheckPKG('gtk+-3.0'):
>> > print 'GTK+-3.0 not be found'
>> > Exit(1)
>> >
>> > # Your extra checks here
>> >
>> > env = conf.Finish()
>> >
>> > # Now, build
>> > env.ParseConfig('pkg-config --cflags --libs gtk+-3.0')
>> > env.Program('main.c')
>> >
>> >
>> > and here is the config.log
>> >
>> > file /Users/love_osx/Desktop/testscons/SConstruct,line 19:
>> > Configure(confdir = .sconf_temp)
>> > scons: Configure: Checking for pkg-config...
>> > pkg-config --atleast-pkgconfig-version=0.15.0
>> > scons: Configure: yes
>> >
>> > scons: Configure: Checking for gtk+-3.0
>> > pkg-config --exists 'gtk+-3.0'
>> > scons: Configure: no
>> >
>> >
>> > Is there something that a mac user should do before running scons ?
>> >
>> > P.S. i was also in IRC and a user suggested to enter the second line
>> > pasted
>> > in the SConstruct file, but no luck.
>> >
>> >
>> > Thanks for any help.
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-users at scons.org
>> > http://four.pairlist.net/mailman/listinfo/scons-users
>> >
>>
>>
>>
>> --
>> Gary
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> http://four.pairlist.net/mailman/listinfo/scons-users
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
>
--
Gary
More information about the Scons-users
mailing list