[gdal-dev] Error compiling GDAL from trunk on Mac OS X 10.6.8

William Kyngesburye woklist at kyngchaos.com
Fri Mar 15 17:05:27 PDT 2013


On Mar 15, 2013, at 5:55 PM, Jorge Arévalo wrote:

>>>> http://www.gnu.org/software/gnulib/manual/html_node/environ.html suggests
>>>> me the following patch. Please test and report if it works.
>>>> 
>>>> Index: port/cpl_spawn.cpp
>>>> ===================================================================
>>>> --- port/cpl_spawn.cpp (revision 25734)
>>>> +++ port/cpl_spawn.cpp (working copy)
>>>> @@ -461,8 +461,13 @@
>>>> #include <signal.h>
>>>> #ifdef HAVE_POSIX_SPAWNP
>>>> #include <spawn.h>
>>>> +#ifdef MACOSX_FRAMEWORK
>>>> +#include <crt_externs.h>
>>>> +#define environ (*_NSGetEnviron())
>>>> +#else
>>>> extern char** environ;
>>>> #endif
>>>> +#endif
>>>> 
>>>> #if 0
>>>> /************************************************************************
>>>> /
>>>> 
>>>>> Thanks in advance,
>>> 
>>> Thanks! We got to the same solution :-). I've found the same patch in
>>> MacPorts
>>> (http://trac.macports.org/browser/trunk/dports/lang/hugs98/files/patch-pac
>>> kages-base-include-HsBase.h.diff?rev=81676). It worked.
>>> 
>>> I could create a new ticket and attach the patch file. Is it ok?
>> 
>> Or you can commit it directly as you wish since you've commit rights. But the  
>> patch are not strictly identical. I tested #ifdef MACOSX_FRAMEWORK whereas the  
>> link you provide test #ifdef __APPLE__ . Not sure if they are equivalent in  
>> the GDAL context. Perhaps #ifdef __APPLE__ is better and MACOSX_FRAMEWORK too  
>> specific to a special flavour of building a shared lib ? Just guessing  
>> blindly...
> 
> Honestly, I'm not sure.  
> 
> __APPLE__ is a gcc predefined macro (as listed here http://sourceforge.net/p/predef/wiki/OperatingSystems/), and MACOSX_FRAMEWORK is defined by GDAL in configure time if the user specified --with-macosx-framework and 'Darwin' is present executing uname. That option tells GDAL to be constructed as a Mac OS X Framework.
> 
> Both macros are used in the sources. Why do we have 2 options to the same thing? Or am I wrong and they have different purposes?
> 
__APPLE__ is standard for OS X, this is what should be used.  MACOSX_FRAMEWORK is internal for GDAL, and is for when GDAL is configured to make a framework instead of a standard dylib.  Both configurations use all the same system headers and APIs otherwise.  (Note that the "dylib" in the error has nothing to do with a non-framework build, the basic compilation always produces this internally and it is at installation that it is made into a framework if requested.)

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Those people who most want to rule people are, ipso-facto, those least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy




More information about the gdal-dev mailing list