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

ImageMagick: switch to CMake, migrate to Conan v2 #21699

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

valgur
Copy link
Contributor

@valgur valgur commented Dec 9, 2023

Continues from #10003 by @Cyriuz.

It merges the build scripts from the latest commit at https://github.com/Cyriuz/ImageMagick into the official source archive.

I also exposed all available options and added support for all dependencies available on CCI.

@CLAassistant
Copy link

CLAassistant commented Dec 9, 2023

CLA assistant check
All committers have signed the CLA.

@valgur
Copy link
Contributor Author

valgur commented Dec 9, 2023

@Cyriuz Could you please sign the CLA for this PR?

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ❌

Failure in build 11 (0176c0c34de8b016b6a563e2829c0c2d1aeef9af):

  • imagemagick/7.1.1-25:
    CI failed to create some packages (All logs)

    Logs for packageID 4f32311aea55023f8e5f70aad2b9cbc1901d3bef:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=clang
    compiler.libcxx=libc++
    compiler.version=12
    os=Linux
    [options]
    imagemagick:shared=False
    
    [...]
    dpkg-query: no packages found matching libxv-dev
    dpkg-query: no packages found matching libxxf86vm-dev
    dpkg-query: no packages found matching libxcb-render0-dev
    dpkg-query: no packages found matching libxcb-render-util0-dev
    dpkg-query: no packages found matching libxcb-xkb-dev
    dpkg-query: no packages found matching libxcb-icccm4-dev
    dpkg-query: no packages found matching libxcb-image0-dev
    dpkg-query: no packages found matching libxcb-keysyms1-dev
    dpkg-query: no packages found matching libxcb-randr0-dev
    dpkg-query: no packages found matching libxcb-shape0-dev
    dpkg-query: no packages found matching libxcb-sync-dev
    dpkg-query: no packages found matching libxcb-xfixes0-dev
    dpkg-query: no packages found matching libxcb-xinerama0-dev
    dpkg-query: no packages found matching libxcb-dri3-dev
    dpkg-query: no packages found matching uuid-dev
    dpkg-query: no packages found matching libxcb-cursor-dev
    debconf: delaying package configuration, since apt-utils is not installed
    dpkg-query: no packages found matching libxcb-util-dev
    debconf: delaying package configuration, since apt-utils is not installed
    Delegate BZip2 found.
    Delegate LibLZMA found.
    Delegate ZLIB found.
    Delegate zstd found.
    Delegate Freetype found.
    Delegate LibXml2 found.
    CMake Error at /home/conan/w/prod-v1/bsr/89797/bcbcd/.conan/data/cmake/3.28.1/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
      Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
    Call Stack (most recent call first):
      /home/conan/w/prod-v1/bsr/89797/bcbcd/.conan/data/cmake/3.28.1/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
      /home/conan/w/prod-v1/bsr/89797/bcbcd/.conan/data/cmake/3.28.1/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/share/cmake-3.28/Modules/FindOpenMP.cmake:580 (find_package_handle_standard_args)
      cmake/delegates.cmake:5 (find_package)
      cmake/delegates.cmake:36 (magick_find_delegate)
      CMakeLists.txt:73 (include)
    
    
    WARN: cairo/1.18.0: requirement zlib/[>=1.2.11 <2] overridden by imagemagick/7.1.1-25 to zlib/1.3 
    WARN: freetype/2.13.2: requirement zlib/[>=1.2.10 <2] overridden by cairo/1.18.0 to zlib/1.3 
    WARN: libpng/1.6.40: requirement zlib/[>=1.2.11 <2] overridden by freetype/2.13.2 to zlib/1.3 
    WARN: glib/2.78.1: requirement zlib/[>=1.2.11 <2] overridden by cairo/1.18.0 to zlib/1.3 
    WARN: pcre2/10.42: requirement zlib/[>=1.2.11 <2] overridden by glib/2.78.1 to zlib/1.3 
    WARN: openexr/3.2.1: requirement zlib/[>=1.2.11 <2] overridden by imagemagick/7.1.1-25 to zlib/1.3 
    WARN: libtiff/4.6.0: requirement zlib/[>=1.2.11 <2] overridden by imagemagick/7.1.1-25 to zlib/1.3 
    WARN: libxml2/2.12.3: requirement zlib/[>=1.2.11 <2] overridden by imagemagick/7.1.1-25 to zlib/1.3 
    imagemagick/7.1.1-25: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    imagemagick/7.1.1-25: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    imagemagick/7.1.1-25: ERROR: Package '4f32311aea55023f8e5f70aad2b9cbc1901d3bef' build failed
    imagemagick/7.1.1-25: WARN: Build folder /home/conan/w/prod-v1/bsr/89797/bcbcd/.conan/data/imagemagick/7.1.1-25/_/_/build/4f32311aea55023f8e5f70aad2b9cbc1901d3bef/build/Release
    ERROR: imagemagick/7.1.1-25: Error in build() method, line 340
    	cmake.configure()
    	ConanException: Error 1 while executing cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/home/conan/w/prod-v1/bsr/89797/bcbcd/.conan/data/imagemagick/7.1.1-25/_/_/build/4f32311aea55023f8e5f70aad2b9cbc1901d3bef/build/Release/generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/conan/w/prod-v1/bsr/89797/bcbcd/.conan/data/imagemagick/7.1.1-25/_/_/package/4f32311aea55023f8e5f70aad2b9cbc1901d3bef" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/conan/w/prod-v1/bsr/89797/bcbcd/.conan/data/imagemagick/7.1.1-25/_/_/build/4f32311aea55023f8e5f70aad2b9cbc1901d3bef/src"
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.


Conan v2 pipeline ❌

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping @conan-io/barbarians on the PR and we will help you.

See details:

Failure in build 11 (0176c0c34de8b016b6a563e2829c0c2d1aeef9af):

  • imagemagick/7.1.1-25:
    CI failed to create some packages (All logs)

    Logs for packageID 76ba6406bb2adf0a816c7460efc43fab2667e980:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=apple-clang
    compiler.cppstd=17
    compiler.libcxx=libc++
    compiler.version=13
    os=Macos
    [options]
    */*:shared=False
    
    [...]
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clReleaseContext", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clReleaseEvent", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clReleaseKernel", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clReleaseMemObject", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clReleaseProgram", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clRetainEvent", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clRetainMemObject", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clSetEventCallback", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clSetKernelArg", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
      "_clWaitForEvents", referenced from:
          _InitializeOpenCL in libMagickCore-7.Q16HDRI.a(opencl.c.o)
    [ 97%] Building CXX object Magick++/CMakeFiles/Magick++.dir/lib/Pixels.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [utilities/magick] Error 1
    make[1]: *** [utilities/CMakeFiles/magick.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    [ 98%] Building CXX object Magick++/CMakeFiles/Magick++.dir/lib/ResourceLimits.cpp.o
    [ 98%] Building CXX object Magick++/CMakeFiles/Magick++.dir/lib/SecurityPolicy.cpp.o
    [ 98%] Building CXX object Magick++/CMakeFiles/Magick++.dir/lib/Statistic.cpp.o
    [ 99%] Building CXX object Magick++/CMakeFiles/Magick++.dir/lib/STL.cpp.o
    [ 99%] Building CXX object Magick++/CMakeFiles/Magick++.dir/lib/Thread.cpp.o
    [100%] Building CXX object Magick++/CMakeFiles/Magick++.dir/lib/TypeMetric.cpp.o
    [100%] Linking CXX static library libMagick++-7.Q16HDRI.a
    [100%] Built target Magick++
    make: *** [all] Error 2
    
    imagemagick/7.1.1-25: ERROR: 
    Package '76ba6406bb2adf0a816c7460efc43fab2667e980' build failed
    imagemagick/7.1.1-25: WARN: Build folder /Users/jenkins/w/prod-v2/bsr/75086/bdcda/p/b/imagebf966bfd70826/b/build/Release
    *********************************************************
    Recipe 'imagemagick/7.1.1-25' cannot build its binary
    It is possible that this recipe is not Conan 2.0 ready
    If the recipe comes from ConanCenter, report it at https://github.com/conan-io/conan-center-index/issues
    If it is your recipe, check if it is updated to 2.0
    *********************************************************
    
    ERROR: imagemagick/7.1.1-25: Error in build() method, line 341
    	cmake.build()
    	ConanException: Error 2 while executing
    

Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@jsinge
Copy link
Contributor

jsinge commented Apr 4, 2024

Hey there, small feedback on the relevance of this PR:

libvips requires imagemagick for working with .bmp files ( libvips/libvips#1528 ). If I understand the changes correctly, this PR would enable imagemagick for windows? I would very much welcome this.

@Julianiolo
Copy link
Contributor

@valgur What is the state of this? I tried using it with the newest Imagemagick (7.1.1-32) and it worked? I had to make some changes though: I changed the freetype version to 2.15.0 and disabled fftw and openmp since they did not work. In the test_package the identify test does not work, as it cannot find it, and the check for gslib and ps did not work (both not in the options?). When disabling these everything seemed to work?

(Built on Windows mvsc)

@valgur
Copy link
Contributor Author

valgur commented May 14, 2024

@Julianiolo Thanks for testing the recipe. That's good to know!

However, the custom build system included from the forked repo is a too significant change to be acceptable on CCI, I'm afraid. It should really be merged upstream instead, ultimately.

For CCI, a more realistic approach would be to substitute the custom "configure.exe" executable on Windows with a simpler workaround, I think.

@Julianiolo
Copy link
Contributor

Yeah I guess the build situation with imagemagick is a little .... unfortunate at the moment.

About an configure.exe workaround: I guess that could work, but that would probably be the same deal as with cmake now. I'm not sure on how this is handled best. Maybe using the cmake solution isn't that bad of an idea?, it does not seem they will adopt more portable build systems any time soon ...

@Julianiolo
Copy link
Contributor

I guess it would maybe be possible to use msys2/mingw gcc, but I don't know how conan would/can handle that, when building with msvc...

@Cyriuz
Copy link
Contributor

Cyriuz commented May 14, 2024

However, the custom build system included from the forked repo is a too significant change to be acceptable on CCI, I'm afraid. It should really be merged upstream instead, ultimately.

The big problem is that they won't accept any new build system unless it is used by the community and "proven" to work, so at least when I tried to get this into CCI it was with the intent to do just that and then possibly get it merged upstream later. But yes it would be quite some code to maintain on the recipe level unfortunately.

@neobrain
Copy link

neobrain commented May 18, 2024

Thanks for working on this! I've been using this recipe locally and it's working fairly well.

I've encountered two small issues though:

  • On macOS, linking fails unless with_opencl=False: "_clBuildProgram", referenced from: _InitializeOpenCL in libMagickCore-7.Q16HDRI.a[55](opencl.c.o) (maybe it's picking up the wrong opencl library?)
  • Conan generates CMake targets named imagemagick::Magick++/MagickCore from the recipe, but CMake's FindImageMagick module ImageMagick::Magick++/MagickCore. I think this can be fixed by setting self.cpp_info.components["MagickCore"].set_property("cmake_target_name", "ImageMagick::MagickCore")

Since I copied the recipe locally I can just work around this issues easily, but I figured I'd let you know :)

@valgur
Copy link
Contributor Author

valgur commented May 19, 2024

I patched out the MFC dependency for configure.exe on Windows at #18623, so that version should support all platforms now.

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

Successfully merging this pull request may close these issues.

None yet

8 participants