unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* OSX breakage
@ 2011-11-28 15:36 Mario Lassnig
  2011-11-28 16:48 ` Paul Eggert
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Mario Lassnig @ 2011-11-28 15:36 UTC (permalink / raw)
  To: emacs-devel

Hi,

the recent revno 106533 broke compilation on OSX Lion for me, because 
environ is not defined in unistd.h (possibly this is the case for 
previous versions of OSX as well).


The remedy (to include at the appropriate time and place):

#include <crt_externs.h>
#define environ (*_NSGetEnviron())

Thanks,
Mario



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-28 15:36 Mario Lassnig
@ 2011-11-28 16:48 ` Paul Eggert
  2011-11-28 17:47 ` Eli Zaretskii
  2011-11-29 11:45 ` Ashish SHUKLA
  2 siblings, 0 replies; 11+ messages in thread
From: Paul Eggert @ 2011-11-28 16:48 UTC (permalink / raw)
  To: mario; +Cc: emacs-devel

On 11/28/11 07:36, Mario Lassnig wrote:
> #include <crt_externs.h>
> #define environ (*_NSGetEnviron())

That's weird, since the previous code didn't do that.
Why not use "extern char **environ;", which the
previous code used, and which presumably worked?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-28 15:36 Mario Lassnig
  2011-11-28 16:48 ` Paul Eggert
@ 2011-11-28 17:47 ` Eli Zaretskii
  2011-11-28 19:00   ` Paul Eggert
  2011-11-28 19:29   ` Randal L. Schwartz
  2011-11-29 11:45 ` Ashish SHUKLA
  2 siblings, 2 replies; 11+ messages in thread
From: Eli Zaretskii @ 2011-11-28 17:47 UTC (permalink / raw)
  To: mario; +Cc: emacs-devel

> Date: Mon, 28 Nov 2011 16:36:25 +0100
> From: Mario Lassnig <mario@lassnig.net>
> 
> The remedy (to include at the appropriate time and place):
> 
> #include <crt_externs.h>
> #define environ (*_NSGetEnviron())

Is there really no system header on OS X that declares `environ'?  I'm
surprised.

If there really isn't, and we need to use #ifdef, I'm inclined to use
"extern char **environ;".  What would be a MAC OS X specific symbol to
use with such an ifdef?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
@ 2011-11-28 18:35 Mario Lassnig
  0 siblings, 0 replies; 11+ messages in thread
From: Mario Lassnig @ 2011-11-28 18:35 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1056 bytes --]

>>/  Date: Mon, 28 Nov 2011 16:36:25 +0100/
>>/  From: Mario Lassnig<address@hidden>/
>>/  /
>>/  The remedy (to include at the appropriate time and place):/
>>/  /
>>/  #include<crt_externs.h>/
>>/  #define environ (*_NSGetEnviron())/

>Is there really no system header on OS X that declares `environ'?  I'm
>surprised.

That's correct. And even system headers do it like this, probably
there's some magic in the background to work with ns-dragndrop and the likes.

Mario@shodan:/usr/include$ grep -r " environ " *
X11/Xw32defs.h:#  define environ     _environ
apache2/modperl_perl_includes.h:#   define environ (*_NSGetEnviron())
architecture/i386/fpu.h: *     #define environ (*_NSGetEnviron())

>If there really isn't, and we need to use #ifdef, I'm inclined to use
>"extern char **environ;".  What would be a MAC OS X specific symbol to
>use with such an ifdef?

That would be

#ifdef __APPLE__


Thanks,
Mario

-- 
Mario Lassnig
CERN PH-ADP-DDM 1-R-022
CH-1211 Geneve 23
mario.lassnig@cern.ch
+41 22 76 71268



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4394 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-28 17:47 ` Eli Zaretskii
@ 2011-11-28 19:00   ` Paul Eggert
  2011-11-29  5:00     ` Chong Yidong
  2011-11-28 19:29   ` Randal L. Schwartz
  1 sibling, 1 reply; 11+ messages in thread
From: Paul Eggert @ 2011-11-28 19:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mario, emacs-devel

On 11/28/11 09:47, Eli Zaretskii wrote:
> Is there really no system header on OS X that declares `environ'?  I'm
> surprised.

That's the old, old Unix tradition, alas.  It's not just OS X.
The "right" way to fix it is to declare "extern char **environ;"
if it's not already declared.  There's a Gnulib module for that,
which I can look into -- it puts the declaration into a substitute
unistd.h if unistd.h doesn't already declare it.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-28 17:47 ` Eli Zaretskii
  2011-11-28 19:00   ` Paul Eggert
@ 2011-11-28 19:29   ` Randal L. Schwartz
  1 sibling, 0 replies; 11+ messages in thread
From: Randal L. Schwartz @ 2011-11-28 19:29 UTC (permalink / raw)
  To: emacs-devel

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Mon, 28 Nov 2011 16:36:25 +0100
>> From: Mario Lassnig <mario@lassnig.net>
>> 
>> The remedy (to include at the appropriate time and place):
>> 
>> #include <crt_externs.h>
>> #define environ (*_NSGetEnviron())

Eli> Is there really no system header on OS X that declares `environ'?  I'm
Eli> surprised.

Indeed, there's not.  OSX is BSD is old-school.  environ is "just there".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-28 19:00   ` Paul Eggert
@ 2011-11-29  5:00     ` Chong Yidong
  2011-11-29  9:27       ` Paul Eggert
  0 siblings, 1 reply; 11+ messages in thread
From: Chong Yidong @ 2011-11-29  5:00 UTC (permalink / raw)
  To: Paul Eggert; +Cc: mario, Eli Zaretskii, emacs-devel

Paul Eggert <eggert@cs.ucla.edu> writes:

> On 11/28/11 09:47, Eli Zaretskii wrote:
>> Is there really no system header on OS X that declares `environ'?  I'm
>> surprised.
>
> That's the old, old Unix tradition, alas.  It's not just OS X.
> The "right" way to fix it is to declare "extern char **environ;"
> if it's not already declared.  There's a Gnulib module for that,
> which I can look into -- it puts the declaration into a substitute
> unistd.h if unistd.h doesn't already declare it.

As Eli pointed out in the discussion on bug#10155, there is already code
in lib/unistd.in.h that apparently ought to handle this, but itsn't
working.

I will delay the pretest until this problem is fixed.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-29  5:00     ` Chong Yidong
@ 2011-11-29  9:27       ` Paul Eggert
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Eggert @ 2011-11-29  9:27 UTC (permalink / raw)
  To: Chong Yidong; +Cc: mario, Eli Zaretskii, emacs-devel

On 11/28/11 21:00, Chong Yidong wrote:
> As Eli pointed out in the discussion on bug#10155, there is already code
> in lib/unistd.in.h that apparently ought to handle this, but itsn't
> working.

I'll send a proposed patch to that discussion.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-28 15:36 Mario Lassnig
  2011-11-28 16:48 ` Paul Eggert
  2011-11-28 17:47 ` Eli Zaretskii
@ 2011-11-29 11:45 ` Ashish SHUKLA
  2011-11-30 12:08   ` Carsten Mattner
  2011-11-30 15:00   ` Ashish SHUKLA
  2 siblings, 2 replies; 11+ messages in thread
From: Ashish SHUKLA @ 2011-11-29 11:45 UTC (permalink / raw)
  To: mario; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

Mario Lassnig writes:
> Hi,

> the recent revno 106533 broke compilation on OSX Lion for me, because
> environ is not defined in unistd.h (possibly this is the case for
> previous versions of OSX as well).

It's also broken on FreeBSD, as well.

-- 
Ashish SHUKLA

“The death rate is the same for us as for anybody… one person, one
death, sooner or later.” (Robert A. Heinlein, "Tunnel in the Sky",
1955)

[-- Attachment #2: Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-29 11:45 ` Ashish SHUKLA
@ 2011-11-30 12:08   ` Carsten Mattner
  2011-11-30 15:00   ` Ashish SHUKLA
  1 sibling, 0 replies; 11+ messages in thread
From: Carsten Mattner @ 2011-11-30 12:08 UTC (permalink / raw)
  To: Ashish SHUKLA; +Cc: mario, emacs-devel

On Tue, Nov 29, 2011 at 12:45 PM, Ashish SHUKLA <wahjava.ml@gmail.com> wrote:
> Mario Lassnig writes:
>> Hi,
>
>> the recent revno 106533 broke compilation on OSX Lion for me, because
>> environ is not defined in unistd.h (possibly this is the case for
>> previous versions of OSX as well).
>
> It's also broken on FreeBSD, as well.

Seems to be fixed by Chong in revno 106554 on Darwin, but a typo
has been introduced in the comment: Shouln't unisted.h be unistd.h?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: OSX breakage
  2011-11-29 11:45 ` Ashish SHUKLA
  2011-11-30 12:08   ` Carsten Mattner
@ 2011-11-30 15:00   ` Ashish SHUKLA
  1 sibling, 0 replies; 11+ messages in thread
From: Ashish SHUKLA @ 2011-11-30 15:00 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

Ashish SHUKLA writes:
> Mario Lassnig writes:
>> Hi,

>> the recent revno 106533 broke compilation on OSX Lion for me, because
>> environ is not defined in unistd.h (possibly this is the case for
>> previous versions of OSX as well).

> It's also broken on FreeBSD, as well.

Fixed on FreeBSD after installing r106556.

Thanks
-- 
Ashish SHUKLA

“Never underestimate the power of human stupidity.” (Robert
A. Heinlein, 1973)

[-- Attachment #2: Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-11-30 15:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-28 18:35 OSX breakage Mario Lassnig
  -- strict thread matches above, loose matches on Subject: below --
2011-11-28 15:36 Mario Lassnig
2011-11-28 16:48 ` Paul Eggert
2011-11-28 17:47 ` Eli Zaretskii
2011-11-28 19:00   ` Paul Eggert
2011-11-29  5:00     ` Chong Yidong
2011-11-29  9:27       ` Paul Eggert
2011-11-28 19:29   ` Randal L. Schwartz
2011-11-29 11:45 ` Ashish SHUKLA
2011-11-30 12:08   ` Carsten Mattner
2011-11-30 15:00   ` Ashish SHUKLA

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).