[Gc] uncontext.h deprecation in MacOS 10.6 (was: Compiling gc with gcc-4.2.1)

Boehm, Hans hans.boehm at hp.com
Mon Aug 31 10:48:45 PDT 2009


[Adding gc.linux.hpl.hp.com]

Actually, NO_GETCONTEXT should already be defined for DARWIN (mach_dep.c:169).
You are right that the real problem seems to be the inclusion of ucontext.h by mach_dep.c.  I would try including that only if NO_GETCONTEXT is not defined.  Including sys/ucontext.h instead might work if that doesn't, but that strikes me as a very MacOS-specific hack.

A tested patch from someone with a Snow Leopard installation would be great.

Hans

> -----Original Message-----
> From: Victor Ivrii [mailto:ivrii at math.toronto.edu] 
> Sent: Monday, August 31, 2009 1:13 AM
> To: Boehm, Hans
> Subject: Re: Compiling gc with gcc-4.2.1
> 
> On Mon, Aug 31, 2009 at 05:49:09AM +0000, Boehm, Hans wrote:
> > Could you please forward this message to the 
> gc at linux.hpl.hp.com mailing list?  I don't want to do so 
> without your permission, and I don't have eaasy access to 
> MacOS 10.6.  But there are experts on the list who are likely 
> to be able to generate a patch fairly quickly.
> > 
> > It is likely that compiling that file with either 
> NO_GETCONTEXT or _XOPEN_SOURCE defined will avoid the issue.
> > 
> > (I will approve the message as moderator, even if you're not 
> > subscribed.)
> > 
> > Hans
> 
> Hans, may be the problem and solution is already known to the 
> list (I could check if I knew where archives are). Googling I found
> 
> 
> ###
> 
> http://planet.factorcode.org/
> 
> Joe Groff: PSA: avoiding the "ucontext routines are 
> deprecated" error on Mac OS 
> +X Snow Leopard
> 
> Recently I upgraded to the new version of Mac OS X. I tried 
> compiling Factor on
> +it, but got this error:
> 
> In file included from vm/os-macosx-x86.64.hpp:1,
>                  from vm/platform.hpp:38,
>                  from vm/master.hpp:36,
>                  from vm/os-unix.cpp:1:
> /usr/include/ucontext.h:42:2: error: #error ucontext routines are
>     deprecated, and require _XOPEN_SOURCE to be defined I 
> googled this error, and I found that users of SBCL, V8, and 
> boehm gc ran into
> +the same problem, but the ensuing bug tracker and mailing list 
> +discussions didn't turn up any robust solutions. So I looked 
> at Apple's 
> +ucontext.h header, and it turns out the only thing they are 
> deprecating 
> +are the context manipulation functions from the old X/Open standard: 
> +getcontext, makecontext, setcontext, and swapcontext. Factor doesn't 
> +use these functions; it only needs the ucontext_t structure, 
> which is 
> +defined in the non-deprecated header sys/ucontext.h. By changing 
> +Factor's C++ core to include sys/ucontext.h instead of ucontext.h on 
> +Mac OS X, the error goes away, and you don't need to define 
> +_XOPEN_SOURCE or leave yourself vulnerable to Apple's 
> aggressive deprecated API elimination when OS X Def Leopard 
> comes out in a couple of years.
> 
> ###
> 
> and changing in gc codes sys/ucontext.h instead of ucontext.h 
> allows to compile
> +and install gc-7.1 and gc-7.2alpha2
> 
> 
> Victor
> 
> PS Surely you have my permission to publish/forward
> > 
> > > -----Original Message-----
> > > From: Victor Ivrii [mailto:ivrii at math.toronto.edu]
> > > Sent: Sunday, August 30, 2009 2:29 AM
> > > To: boehm at acm.org
> > > Subject: Compiling gc with gcc-4.2.1
> > > 
> > > I am trying to compile gc-7.1 or 7.2alpha2 on MacOS 10.6
> > > 
> > > It returns an error:
> > > 
> > > MT mach_dep.lo -MD -MP -MF .deps/mach_dep.Tpo -c mach_dep.c 
> > > -fno-common -DPIC -o .libs/mach_dep.o In file included from
> > > mach_dep.c:164:
> > > /usr/include/ucontext.h:42:2: error: #error ucontext routines are 
> > > deprecated, and require _XOPEN_SOURCE to be defined
> > > make[1]: *** [mach_dep.lo] Error 1
> > > make: *** [all-recursive] Error 1
> > > 
> > > 
> > > Riemann:victor41%gcc --version
> > > i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)
> > > 
> > > Victor
> > > 
> > > --
> > > ==============================================================
> > > Victor Ivrii, Professor, Department of Mathematics, University of 
> > > Toronto, 40 St.George Str., Toronto, Ontario M5S 2E4, Canada
> > > office: HU 1008
> > > 
> > > (416)978-4031 (of),  (416)978-4107 (fax) ivrii at math.toronto.edu
> > >  
> > > ==============================================================
> > > WWW home page:
> > > http://www.math.toronto.edu/ivrii/
> > > 
> --
> ==============================================================
> Victor Ivrii, Professor, Department of Mathematics, 
> University of Toronto, 40 St.George Str., Toronto, Ontario 
> M5S 2E4, Canada
> office: HU 1008
> 
> (416)978-4031 (of),  (416)978-4107 (fax) ivrii at math.toronto.edu
>  
> ==============================================================
> WWW home page:
> http://www.math.toronto.edu/ivrii/
> 


More information about the Gc mailing list