Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
mike_clarke
Posts: 2
Registered: ‎09-11-2012
My Device: Playbook (Developer)

Building with scons can't find env vars on Win32

A very strange problem here.

 

I'm adding building for BB into our setup using scons. For building on Win32, qcc fails with "The QNX_HOST/QNX_TARGET environment variables must be set", but set they certainly are.

 

If I change our scons script to execute 'set' instead of 'qcc', it lists all of the environment variables that are set inside scons' environment. This is the exact same environment under which qcc gets calls and both variables are there in the list.

 

It still fails if I make those environment variables global instead of local to the shell, but it works if I execute qcc from the command line on its own.

 

I have no problems building with cl or gcc. They find the environment variables just fine. There is something definitely weird about qcc.

 

Any ideas?

New Contributor
mike_clarke
Posts: 2
Registered: ‎09-11-2012
My Device: Playbook (Developer)

Re: Building with scons can't find env vars on Win32

I created a pretty nasty fix for this.

 

I created qcc-wrapper.bat, which sets the environment variables and then executes qcc. It works if I tell scons to use qcc-wrapper instead of caling qcc directly.

 

I suspect that the BB tools are using getenv() instead of GetEnvironmentVariable() from the Win32 API. This is what MSDN says about getenv():


"getenv operates only on the data structures accessible to the run-time library and not on the environment "segment" created for the process by the operating system. Therefore, programs that use the envp argument to main or wmain may retrieve invalid information."

I'll submit this as a bug.