error installing cogito
Bryan Blackburn
blb at macports.org
Sun Apr 20 17:09:39 PDT 2008
On Apr 20, 2008, at 3:28 PM, Ryan Schmidt wrote:
>
> On Apr 20, 2008, at 3:42 PM, Guido Soranzio wrote:
>
>> On Apr 20, 2008, at 10:28 PM, Ryan Schmidt wrote:
>>
>>> This (various software packages not finding the programs they need
>>> to compile) has happened to many Leopard users for reasons we
>>> don't understand.
>>
>> All these errors are due to the fact that in Leopard sudo doesn't
>> perserve environment variables.
>
> But do you know why it then works the second time, or how we could
> fix it for our portfiles permanently?
>
Actually, it has something to do with the way the environment is setup
and cleaned between stages within MacPorts. I've been trying to
figure out whether this is a tcl bug, or something specific to the Mac
OS X install of 8.4.7 (as of 10.5.2), since I can't make it happen
with 8.5.2.
The basic issue is best demonstrated with a bit of code (first with
the Mac-default 8.4.7):
% puts $env(CC)
can't read "env(CC)": no such variable
% set env(CC) "gcc"
gcc
% puts $env(CC)
gcc
% array unset env *
% puts $env(CC)
% puts [array get env]
... CC {} ...
Note how CC in the environment is now blank, but still exists, after
the 'array unset env *' (and if you run this yourself, you'll see all
the environment variables in that last command are {}). What it
should do, and did (I believe) on 10.4 and does with 8.5.2:
% puts $env(CC)
can't read "env(CC)": no such variable
% set env(CC) "gcc"
gcc
% puts $env(CC)
gcc
% array unset env *
% puts $env(CC)
can't read "env(CC)": no such variable
% puts [array get env]
Here, after 'array unset env *' CC is no longer set in the
environment. Which is how it should work. Note also, the last
command doesn't show all env vars as empty but nothing there.
We can't use 'array unset env' as that is documented to disconnect Tcl
from the environment, and some messing around hasn't shown a clean way
to work around this. Maybe a Tcl expert is needed, and determining if
this is Mac-specific or 8.4.7; of course, either way, we have to deal
with it.
FYI, this is done in portutil.tcl (base/src/port1.0/) in proc
command_exec.
Bryan
More information about the macports-users
mailing list