Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build with OpenCL #275

Closed
mohd-akram opened this issue Oct 1, 2023 · 3 comments
Closed

Cannot build with OpenCL #275

mohd-akram opened this issue Oct 1, 2023 · 3 comments

Comments

@mohd-akram
Copy link

ImageMagick version

6.9.12-97

Operating system

MacOS

Operating system, version and so on

13.6

Description

I'm unable to build ImageMagick 6 with OpenCL. I get this error:

magick/opencl.c:3043:16: error: call to undeclared function 'lt_dlclose'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        (void) lt_dlclose(OpenCLLib->base);
               ^
magick/opencl.c:3043:16: note: did you mean 'dlclose'?
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/dlfcn.h:64:12: note: 'dlclose' declared here
extern int dlclose(void * __handle) __DYLDDL_DRIVERKIT_UNAVAILABLE;
           ^
1 error generated.

Adding #include "ltdl.h" to opencl.c (as in ImageMagick 7) resolves the issue. It's not clear if the usage of lt_dlclose should also be conditional based on MAGICKCORE_LTDL_DELEGATE (it is unconditional in v7 as well).

Steps to Reproduce

  1. ./configure --enable-opencl
  2. make

Images

No response

urban-warrior pushed a commit that referenced this issue Oct 2, 2023
@urban-warrior
Copy link
Member

Thanks for the problem report. We can reproduce the issue and will have a patch to fix it in the GIT main branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://imagemagick.org/archive/beta/ by sometime tomorrow.

@mohd-akram
Copy link
Author

@urban-warrior Thanks. For the main v7 branch it builds fine as it is (the header is already present). I thought that perhaps lt_dlclose shouldn't be used if ltdl isn't available, but it seems ltdl is currently required for OpenCL support, so it doesn't matter at the moment.

The commit 7a828b0 added to v6 seems to have included an extra #if defined(MAGICKCORE_OPENCL_SUPPORT) without a matching #endif. There's already such an ifdef a few lines below, so I think the ltdl section can simply be moved inside it.

@mohd-akram
Copy link
Author

I can confirm this works with the new release. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants