After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 673969 - build fails because OpenCL not available on Mac OSX 10.5 PowerPC
build fails because OpenCL not available on Mac OSX 10.5 PowerPC
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: build
git master
Other Mac OS
: Normal major
: ---
Assigned To: Default Gegl Component Owner
Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2012-04-12 08:13 UTC by stargood
Modified: 2014-03-09 13:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
log of failed gegl git master buld (60.77 KB, text/plain)
2012-04-12 08:13 UTC, stargood
  Details
Proposed fix (2.24 KB, patch)
2012-04-12 10:34 UTC, Jon Nordby
none Details | Review
Build error forcing use of Apple GCC 3.3 (50.52 KB, text/plain)
2012-07-03 11:26 UTC, stargood
  Details
Leopard build fix (1.66 KB, patch)
2012-09-03 21:01 UTC, Jeremy Huddleston
none Details | Review

Description stargood 2012-04-12 08:13:31 UTC
Created attachment 211908 [details]
log of failed gegl git master buld

I'm trying to compile gegl from git on Mac OSX Leopard 10.5 PowerPC. The configure script completes ok, but the build dies almost immediately since I don't have OpenCL which was introduced with OSX 10.6. I need the latest gegl because the new gimp 2.8 RC1 requires 0.2.0. I experience the same build failure with 0.2.0. I have attached a log of the failed build including the configure run. I'm hoping there is some way for me to turn off OpenCL support since it's not possible for me to install OpenCL.
Comment 1 Jon Nordby 2012-04-12 09:00:51 UTC
We include the necessary headers for openCL in GEGL itself, so it should not be necessary to have openCL installed for the build to succeed. For that reason there is no configure option to turn the openCL build off.

As a work-around you may try to remove the line "gegl/opencl/Makefile" from 
AC_CONFIG_FILES in configure.ac, to not build the gegl/opencl subdirectory.
Comment 2 Jon Nordby 2012-04-12 10:34:09 UTC
Created attachment 211914 [details] [review]
Proposed fix

On OSX it seems some system headers are included from the header files we ship, and that these assume Mac OSX 10.6+. Please this following patch for working around this issue.

On your system, do you have the header OpenCL/cl_platform.h anywhere in your include paths?
Comment 3 stargood 2012-04-12 22:35:46 UTC
No, I do not have OpenCL/cl_platform.h anywhere on my system include paths. It does not exist at all because the OpenCL framework was added in OSX 10.6 and I am on 10.5. I applied your patch and I got the same exact build failure. I then tried a fresh clone, applied the patch again  and tried your suggestion in your first comment about removing "gegl/opencl/Makefile" from configure.ac before running autogen.sh. The build failure was the same.
Comment 4 Victor Oliveira 2012-07-01 21:39:06 UTC
(In reply to comment #3)
> No, I do not have OpenCL/cl_platform.h anywhere on my system include paths. It
> does not exist at all because the OpenCL framework was added in OSX 10.6 and I
> am on 10.5. I applied your patch and I got the same exact build failure. I then
> tried a fresh clone, applied the patch again  and tried your suggestion in your
> first comment about removing "gegl/opencl/Makefile" from configure.ac before
> running autogen.sh. The build failure was the same.

The problem was that I forgot to update the APPLE includes in opencl headers to point to local files (as we are distributing the headers in our code)... I've just commited a fix to that, tell me if it works for you now.
Comment 5 stargood 2012-07-03 11:26:20 UTC
Created attachment 217924 [details]
Build error forcing use of Apple GCC 3.3

This file shows the build error when compiling gegl-tile-backend.c which forced me to switch to Apple GCC 3.3. This appeared to be a type of error which may have been triggered by a stricter compiler enforcing a newer version of the C standard.
Comment 6 stargood 2012-07-03 11:54:02 UTC
Victor, I actually have been able to compile the git master now with some changes similar to yours but slightly more extensive. I think the resulting build is okay since at least some of the example test programs did work. I originally changed

"#ifdef __APPLE__" to "#ifndef __APPLE__" in three locations:

gegl/opencl/cl.h			line 29
gegl/opencl/cl_platform.h	line 48
gegl/opencl/cl_gl.h			line 35

My change to cl.h would produce the same result as your change of simply removing the __APPLE__ define and just including local cl_platform.h.

I had to also make a change to the #ifdef __APPLE__ in local cl_platform.h since there are "AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER" macros there which would halt the build on MacOSX 10.5 Leopard.

My change to cl_gl.h does slightly more since it would only include local cl.h. The include of <OpenGL/CGLDevice.h> must be removed or commented out since that header is not available in the MacOSX 10.5 Leopard version of the OpenGL framework.

I had to make one final change. I had to change my compiler version to Apple GCC 3.3. (If anyone else does this, they should add the flag "-Wno-long-double" to their CFLAGS to silence the warning which may get thrown on almost every file.) When compiling with Apple's GCC 4.2 or the default 4.0 there was a build error when compiling gegl-tile-backend.c. The GCC 4.2 error was:

../../gegl/property-types/gegl-color.h:110: error: expected ';', ',' or ')' before 'unsigned'
../../gegl/property-types/gegl-color.h:121: error: expected ';', ',' or ')' before 'unsigned'

The Leopard default compiler version of GCC 4.0 gives a similar error, but less descriptive. This appeared to be a type of error which may have been triggered by a stricter compiler enforcing a newer version of the C standard, and I have solved similar problems this way. I am not familiar enough with GCC to know if there are flags which may be added to GCC 4.0/2 to allow those compilers to successfully complete the build.

I hope that there are such flags, because this last step of using GCC 3.3 is not available to users on MacOSX 10.5 Leopard Intel because Apple's GCC 3.3 is not capable of producing Intel binaries. However, these users always have the last resort option of upgrading to 10.6 Snow Leopard if no other workaround becomes available.

So finally, I suppose perhaps a separate patch might be made available for people using MacOSX 10.5 Leopard PowerPC since these changes might break the build for users of 10.6+. For me the OpenCL code just has to build, it doesn't have to work since it can't be used anyway.
Comment 7 saso 2012-07-16 20:02:29 UTC
10.6 Snow Leopard is only for Intel CPUs so 10.5 Leopard PPC users can't upgrade.
Comment 8 Jeremy Huddleston 2012-09-03 20:39:33 UTC
AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER and related macros are for system headers.  You shouldn't need them in a 3rd party product.  What are you trying to use them for?
Comment 9 Jeremy Huddleston 2012-09-03 21:01:59 UTC
Created attachment 223377 [details] [review]
Leopard build fix

Please use this patch which will use OpenCL.framework when it is available in the SDK (or you can always add a check for it to configure.ac if you prefer).

You should also probably follow it up with a patch that removes your use of availability macros since that doesn't make sense for a 3rd party header...
Comment 10 Jeremy Huddleston 2012-09-03 21:45:45 UTC
Also, that "build error after forcing gcc-3.3" is unrelated to this bug, and it's unrelated to gcc-3.3.  That issue is due to poor choice of variable name.  gcc's altivec.h defines pixel as:

#define pixel unsigned short

So that results in a parse error when building ppc.  There are similar failures for "vector".
Comment 11 Daniel Sabo 2014-03-09 13:10:18 UTC
I don't actually know if this fixes everything because I don't have 10.5 to test on, please reopen if there are still issues with OpenCL. Or open a new bug if there are other 10.5 related issues.

commit 92d1e14df34558431275081d9fc5a914a2dc9096
Author: Daniel Sabo <DanielSabo@gmail.com>
Date:   Tue Feb 4 07:48:33 2014 -0800

    Don't use AvailabilityMacros on OSX (bug 673969)
    
    These were inherited from the OSX system headers, but are meaningless
    for GEGL because all functions are loaded dynamically.

 gegl/opencl/cl_platform.h | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)