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 6.9.9-25 fails to build for --without-modules #21291

Closed
jeroen opened this Issue Dec 3, 2017 · 18 comments

Comments

Projects
None yet
2 participants
@jeroen
Contributor

jeroen commented Dec 3, 2017

Please always follow these steps:

  • Confirmed this is a problem with brew installing one, specific Homebrew/homebrew-core formula (not cask or tap) and not every time you run brew? If it's a general brew problem please file this issue at https://github.com/Homebrew/brew/issues/new. If it's a brew cask problem please file this issue at https://github.com/caskroom/homebrew-cask/issues/new. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed all issues and retried your prior step?
  • Ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?

Since the latest update I can no longer build imagemagick@6 --without-modules. It fails to link against libtool libltdl.

==> Reinstalling imagemagick@6 --without-modules
==> Downloading https://dl.bintray.com/homebrew/mirror/imagemagick%406-6.9.9-25.tar.xz
Already downloaded: /Users/jeroen/Library/Caches/Homebrew/imagemagick@6-6.9.9-25.tar.xz
==> ./configure --disable-osx-universal-binary --prefix=/usr/local/Cellar/imagemagick@6/6.9.9-25 --disable-silent-rules --enable-shared --enable-static --without-
==> make install
Last 15 lines from /Users/jeroen/Library/Logs/Homebrew/imagemagick@6/02.make:
      _OpenModule in magick_libMagickCore_6_Q16_la-module.o
      _DestroyModuleNode in magick_libMagickCore_6_Q16_la-module.o
  "_lt_dlinit", referenced from:
      _IsModuleTreeInstantiated in magick_libMagickCore_6_Q16_la-module.o
  "_lt_dlopen", referenced from:
      _InvokeDynamicImageFilter in magick_libMagickCore_6_Q16_la-module.o
      _OpenModule in magick_libMagickCore_6_Q16_la-module.o
  "_lt_dlsym", referenced from:
      _InvokeDynamicImageFilter in magick_libMagickCore_6_Q16_la-module.o
      _OpenModule in magick_libMagickCore_6_Q16_la-module.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[1]: *** [magick/libMagickCore-6.Q16.la] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [install] Error 2

Here is the full gist log. I have reported this as a bug upstream but the IM maintainers say it may be a dependency issue in homebrew. @urban-warrior says:

We downloaded the ImageMagick source to the latest Mac OS X release (High Sierra), ran your exact configure command-line, and built binaries without complaint. We're not sure why its failing with brew. We did need to make a change recently because OpenCL support requires lt_dlopen, lt_dlinit, etc. Does your computer include a GPU and OpenCL libraries? You can check the config.log file to see if OpenCL is reported as supported. We have no control over brew, but they might need to include a dependency to the libtool-ltdl library.

As a workaround this seems to work:

export LIBS=-lltdl
brew install imagemagick@6 --without-modules

Thank you!

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

@jeroen given you're saying this used to work and no longer does, I don't see how this can be a Homebrew issue. Are you still able to actually build successfully with the prior version?

Contributor

ilovezfs commented Dec 3, 2017

@jeroen given you're saying this used to work and no longer does, I don't see how this can be a Homebrew issue. Are you still able to actually build successfully with the prior version?

@jeroen

This comment has been minimized.

Show comment
Hide comment
@jeroen

jeroen Dec 3, 2017

Contributor

I assumed this as well (as I reported in the linked issue) but they say the problem does not appear if they build on MacOS, it only happens for homebrew so it must be an issue in the homebrew libtool not yieling the proper linking flags.

Contributor

jeroen commented Dec 3, 2017

I assumed this as well (as I reported in the linked issue) but they say the problem does not appear if they build on MacOS, it only happens for homebrew so it must be an issue in the homebrew libtool not yieling the proper linking flags.

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

Sounds like a case for git bisect. It didn't spontaneously break.

Contributor

ilovezfs commented Dec 3, 2017

Sounds like a case for git bisect. It didn't spontaneously break.

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

If it's a Homebrew issue, I suspect it's actually broken with 6.9.9-24 now too.

Contributor

ilovezfs commented Dec 3, 2017

If it's a Homebrew issue, I suspect it's actually broken with 6.9.9-24 now too.

@jeroen

This comment has been minimized.

Show comment
Hide comment
@jeroen

jeroen Dec 3, 2017

Contributor

Yes 6.9.9-24 and 6.9.9-25 are the same they were only released a few hours after each other. But it was working for 6.9.9-23.

Yes upstream already says that they did make changes:

We did need to make a change recently because OpenCL support requires lt_dlopen, lt_dlinit, etc. Does your computer include a GPU and OpenCL libraries?

So that would explain why these issues now arise.

Contributor

jeroen commented Dec 3, 2017

Yes 6.9.9-24 and 6.9.9-25 are the same they were only released a few hours after each other. But it was working for 6.9.9-23.

Yes upstream already says that they did make changes:

We did need to make a change recently because OpenCL support requires lt_dlopen, lt_dlinit, etc. Does your computer include a GPU and OpenCL libraries?

So that would explain why these issues now arise.

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

If export LIBS=-lltdl fixes it, the bug is probably in one of the Makefiles.

Contributor

ilovezfs commented Dec 3, 2017

If export LIBS=-lltdl fixes it, the bug is probably in one of the Makefiles.

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

Do you know what causes this?

Undefined symbols for architecture x86_64:
  "_AcquireDrawingWand", referenced from:
      _ipa_device_open in magick_libMagickCore_6_Q16_la-wmf.o
  "_DestroyDrawingWand", referenced from:
      _ipa_device_close in magick_libMagickCore_6_Q16_la-wmf.o
  "_DestroyMagickWand", referenced from:
      _ipa_device_begin in magick_libMagickCore_6_Q16_la-wmf.o
      _ipa_bmp_draw in magick_libMagickCore_6_Q16_la-wmf.o
      _util_set_brush in magick_libMagickCore_6_Q16_la-wmf.o
etc.
Contributor

ilovezfs commented Dec 3, 2017

Do you know what causes this?

Undefined symbols for architecture x86_64:
  "_AcquireDrawingWand", referenced from:
      _ipa_device_open in magick_libMagickCore_6_Q16_la-wmf.o
  "_DestroyDrawingWand", referenced from:
      _ipa_device_close in magick_libMagickCore_6_Q16_la-wmf.o
  "_DestroyMagickWand", referenced from:
      _ipa_device_begin in magick_libMagickCore_6_Q16_la-wmf.o
      _ipa_bmp_draw in magick_libMagickCore_6_Q16_la-wmf.o
      _util_set_brush in magick_libMagickCore_6_Q16_la-wmf.o
etc.
@jeroen

This comment has been minimized.

Show comment
Hide comment
@jeroen

jeroen Dec 3, 2017

Contributor

Never seen that. Google suggests building --without-wmf.

Contributor

jeroen commented Dec 3, 2017

Never seen that. Google suggests building --without-wmf.

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

Ah probably an opportunistic linkage issue because I happen to have libwmf installed

Contributor

ilovezfs commented Dec 3, 2017

Ah probably an opportunistic linkage issue because I happen to have libwmf installed

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor
if test "$build_modules" != 'no'; then
    MAGICK_DEP_LIBS="$USER_LIBS $LCMS_LIBS $FREETYPE_LIBS $RAQM_LIBS $LQR_LIBS $FFTW_LIBS $FLIF_LIBS $FONTCONFIG_LIBS $XEXT_LIBS $IPC_LIBS $X11_LIBS $XT_LIBS $LZMA_LIBS $BZLIB_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
else
    MAGICK_DEP_LIBS="$USER_LIBS $JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $RAQM_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FLIF_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBPMUX_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $LIBOPENJP2_LIBS $PANGO_LIBS $RAW_R_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
fi

The else is missing LTDL_LIBS

Contributor

ilovezfs commented Dec 3, 2017

if test "$build_modules" != 'no'; then
    MAGICK_DEP_LIBS="$USER_LIBS $LCMS_LIBS $FREETYPE_LIBS $RAQM_LIBS $LQR_LIBS $FFTW_LIBS $FLIF_LIBS $FONTCONFIG_LIBS $XEXT_LIBS $IPC_LIBS $X11_LIBS $XT_LIBS $LZMA_LIBS $BZLIB_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
else
    MAGICK_DEP_LIBS="$USER_LIBS $JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $RAQM_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FLIF_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBPMUX_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $LIBOPENJP2_LIBS $PANGO_LIBS $RAW_R_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
fi

The else is missing LTDL_LIBS

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

This fixes it

diff --git a/Formula/imagemagick@6.rb b/Formula/imagemagick@6.rb
index 1a135f022c..577439d1b6 100644
--- a/Formula/imagemagick@6.rb
+++ b/Formula/imagemagick@6.rb
@@ -29,6 +29,8 @@ class ImagemagickAT6 < Formula
   deprecated_option "enable-hdri" => "with-hdri"
   deprecated_option "with-jp2" => "with-openjpeg"
 
+  depends_on "automake" => :build
+  depends_on "autoconf" => :build
   depends_on "pkg-config" => :build
   depends_on "libtool" => :run
   depends_on "xz"
@@ -56,7 +58,11 @@ class ImagemagickAT6 < Formula
 
   skip_clean :la
 
+  patch :DATA
+
   def install
+    system "autoreconf", "-fiv"
+
     args = %W[
       --disable-osx-universal-binary
       --prefix=#{prefix}
@@ -125,3 +131,18 @@ class ImagemagickAT6 < Formula
     end
   end
 end
+
+__END__
+diff --git a/configure.ac b/configure.ac
+index f72b90b..f0d693f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3881,7 +3881,7 @@ fi
+ if test "$build_modules" != 'no'; then
+     MAGICK_DEP_LIBS="$USER_LIBS $LCMS_LIBS $FREETYPE_LIBS $RAQM_LIBS $LQR_LIBS $FFTW_LIBS $FLIF_LIBS $FONTCONFIG_LIBS $XEXT_LIBS $IPC_LIBS $X11_LIBS $XT_LIBS $LZMA_LIBS $BZLIB_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
+ else
+-    MAGICK_DEP_LIBS="$USER_LIBS $JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $RAQM_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FLIF_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBPMUX_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $LIBOPENJP2_LIBS $PANGO_LIBS $RAW_R_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
++    MAGICK_DEP_LIBS="$USER_LIBS $JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $RAQM_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FLIF_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBPMUX_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $LIBOPENJP2_LIBS $PANGO_LIBS $RAW_R_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
+ fi
+ AC_SUBST(MAGICK_DEP_LIBS)
+ 
Contributor

ilovezfs commented Dec 3, 2017

This fixes it

diff --git a/Formula/imagemagick@6.rb b/Formula/imagemagick@6.rb
index 1a135f022c..577439d1b6 100644
--- a/Formula/imagemagick@6.rb
+++ b/Formula/imagemagick@6.rb
@@ -29,6 +29,8 @@ class ImagemagickAT6 < Formula
   deprecated_option "enable-hdri" => "with-hdri"
   deprecated_option "with-jp2" => "with-openjpeg"
 
+  depends_on "automake" => :build
+  depends_on "autoconf" => :build
   depends_on "pkg-config" => :build
   depends_on "libtool" => :run
   depends_on "xz"
@@ -56,7 +58,11 @@ class ImagemagickAT6 < Formula
 
   skip_clean :la
 
+  patch :DATA
+
   def install
+    system "autoreconf", "-fiv"
+
     args = %W[
       --disable-osx-universal-binary
       --prefix=#{prefix}
@@ -125,3 +131,18 @@ class ImagemagickAT6 < Formula
     end
   end
 end
+
+__END__
+diff --git a/configure.ac b/configure.ac
+index f72b90b..f0d693f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -3881,7 +3881,7 @@ fi
+ if test "$build_modules" != 'no'; then
+     MAGICK_DEP_LIBS="$USER_LIBS $LCMS_LIBS $FREETYPE_LIBS $RAQM_LIBS $LQR_LIBS $FFTW_LIBS $FLIF_LIBS $FONTCONFIG_LIBS $XEXT_LIBS $IPC_LIBS $X11_LIBS $XT_LIBS $LZMA_LIBS $BZLIB_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
+ else
+-    MAGICK_DEP_LIBS="$USER_LIBS $JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $RAQM_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FLIF_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBPMUX_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $LIBOPENJP2_LIBS $PANGO_LIBS $RAW_R_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
++    MAGICK_DEP_LIBS="$USER_LIBS $JBIG_LIBS $LCMS_LIBS $TIFF_LIBS $FREETYPE_LIBS $RAQM_LIBS $JPEG_LIBS $GS_LIBS $LQR_LIBS $PNG_LIBS $AUTOTRACE_LIBS $DJVU_LIBS $FFTW_LIBS $FLIF_LIBS $FPX_LIBS $FONTCONFIG_LIBS $WEBPMUX_LIBS $WEBP_LIBS $WMF_LIBS $DPS_LIBS $XEXT_LIBS $XT_LIBS $IPC_LIBS $X11_LIBS $LZMA_LIBS $BZLIB_LIBS $OPENEXR_LIBS $LIBOPENJP2_LIBS $PANGO_LIBS $RAW_R_LIBS $RSVG_LIBS $XML_LIBS $GVC_LIBS $ZLIB_LIBS $LTDL_LIBS $GDI32_LIBS $MATH_LIBS $GOMP_LIBS $CL_LIBS $UMEM_LIBS $JEMALLOC_LIBS $THREAD_LIBS"
+ fi
+ AC_SUBST(MAGICK_DEP_LIBS)
+ 
@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

@jeroen so the real question is why they cannot reproduce the issue, but it seems clear this is an upstream bug given they're not including $LTDL_LIBS in the no modules case but then go and use it anyway.

Contributor

ilovezfs commented Dec 3, 2017

@jeroen so the real question is why they cannot reproduce the issue, but it seems clear this is an upstream bug given they're not including $LTDL_LIBS in the no modules case but then go and use it anyway.

@jeroen

This comment has been minimized.

Show comment
Hide comment
@jeroen

jeroen Dec 3, 2017

Contributor

OK thanks for debugging. Can you copy your patch in the upstream issue that I linked?

Contributor

jeroen commented Dec 3, 2017

OK thanks for debugging. Can you copy your patch in the upstream issue that I linked?

@jeroen

This comment has been minimized.

Show comment
Hide comment
@jeroen

jeroen Dec 3, 2017

Contributor

Ah it looks like upstream just incorporated your fix already :)

Contributor

jeroen commented Dec 3, 2017

Ah it looks like upstream just incorporated your fix already :)

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

🎉

I'd love to know why they couldn't reproduce it to begin with. It would be nice for everyone to be on the same page :)

Contributor

ilovezfs commented Dec 3, 2017

🎉

I'd love to know why they couldn't reproduce it to begin with. It would be nice for everyone to be on the same page :)

@jeroen

This comment has been minimized.

Show comment
Hide comment
@jeroen

jeroen Dec 3, 2017

Contributor

Awesome thanks!

Contributor

jeroen commented Dec 3, 2017

Awesome thanks!

@jeroen jeroen closed this Dec 3, 2017

@ilovezfs

This comment has been minimized.

Show comment
Hide comment
@ilovezfs

ilovezfs Dec 3, 2017

Contributor

You're welcome :)

Contributor

ilovezfs commented Dec 3, 2017

You're welcome :)

@jeroen

This comment has been minimized.

Show comment
Hide comment
@jeroen

jeroen Dec 3, 2017

Contributor

Looks like upstream has tagged a new release for this patch, so we can upgrade it soon.

Contributor

jeroen commented Dec 3, 2017

Looks like upstream has tagged a new release for this patch, so we can upgrade it soon.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.