[SERVER-22808] --variables-files=etc/scons/propagate_shell_environment.vars does not work Created: 23/Feb/16  Updated: 15/Mar/16  Resolved: 15/Mar/16

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: 3.2.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Ryan Schmidt Assignee: Jonathan Reams
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-22602 Automatically include openssl on osx ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

CXX=/usr/bin/clang++ scons --variables-files=etc/scons/propagate_shell_environment.vars

Sprint: Platforms 12 (04/01/16)
Participants:

 Description   

Hello, I'm the maintainer of mongodb in MacPorts, trying to update our port from 3.0.8 to 3.2.3.

Running scons with --variables-files=etc/scons/compilers_from_env.vars works, to the extent that the CC and CXX environment variables are imported into scons, but the build fails later because it can't find OpenSSL, because it doesn't know to look for it in our custom prefix.

Additionally setting CPPPATH and LIBPATH in the environment and running scons with --variables-files=etc/scons/propagate_shell_environment.vars does not work; nothing is imported from the environment, not even CC nor CXX.

Specifying the path to a custom vars file containing

import os
 
CC=os.environ['CC']
CPPPATH=os.environ['CPPPATH']
CXX=os.environ['CXX']
LIBPATH=os.environ['LIBPATH']

works but I shouldn't have to do that.



 Comments   
Comment by Jonathan Reams [ 15/Mar/16 ]

Since we haven't heard back about this, I'm going to close this ticket.

Comment by Jonathan Reams [ 14/Mar/16 ]

ryandesign, do you have any more questions about this?

Comment by Andrew Morrow (Inactive) [ 07/Mar/16 ]

ryandesign - I think you have misunderstood the purpose of the propagate_shell_environment.vars file. It does not mean that SCons Variables (e.g. CPPPATH) will be taken from the calling shell environment. It means that the calling shell environment will be made available to subordinate processes started from SCons, which is not normally the case. Propagating the shell environment is sometimes necessary, e.g. to make LD_LIBRARY_PATH available to the linker, or to allow compiler wrappers like scan-build to pass environment variables through.

In general, if you want to import shell variables as SCons Variables, then the file you have written is in fact the intended and correct approach.

Comment by Jonathan Reams [ 01/Mar/16 ]

ryandesign, the propogate_shell_environment.vars file isn't meant to turn shell variables into scons variables, it's there so that all your shell variables appear in the environment block of sub-processes.

Can you try using scons variables instead of shell variables?
scons CC=/path/to/cc CXX=/path/to/cxx LIBPATH=path1:path2 CPPPATH=path1:path2
instead of
CC=/path/to/cc CXX=/path/to/cxx LIBPATH=path1:path2 CPPPATH=path1:path2 scons

Generated at Thu Feb 08 04:01:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.