[MacPorts] #57009: ImageMagick @6.9.9-40_1: inserts -lgomp into pkgconfig files, which breaks build when using clang

MacPorts noreply at macports.org
Thu Sep 12 06:38:03 UTC 2019


#57009: ImageMagick @6.9.9-40_1: inserts -lgomp into pkgconfig files, which breaks
build when using clang
--------------------------+------------------------
  Reporter:  kencu        |      Owner:  ryandesign
      Type:  defect       |     Status:  assigned
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:
      Port:  ImageMagick  |
--------------------------+------------------------

Comment (by kencu):

 The `libomp` notes say that `-fopenmp` needs to be added to the link
 flags. Perhaps that lets the software find the link libraries
 automatically, but it doesn't find `-lomp` with that flag. This is going
 to take some sorting out.

 Newer versions of MacPorts' `clang`, for some reason, pass the `-lgomp`
 test, and so stick that into the link flags, and this breaks builds when
 software uses the full `pkg-config` flags like `virtuoso-7` does.

 I notice that if you build `ImageMagick` on Mojave using `clang-8.0` or
 similar, the exact same error happens, and you wind up with a broken
 setup, with `-lgomp` in the `ImageMagick` link flags:
 {{{
 MAGICK_LIBS=' -L/opt/local/lib -llcms2 -L/opt/local/lib -lfreetype
 -L/opt/local/lib -lfftw3  -L/opt/local/lib -lxml2 -L/opt/local/lib
 -lfontconfig -lfreetype -lXext   -lSM -lICE -lX11  -lXt -L/opt/local/lib
 -llzma -lbz2 -L/opt/local/lib -lz -lltdl  -lm -lgomp    '
 }}}

 So `ImageMagick` would be just as broken on Mojave, if you built it with
 one of macports newer clang compilers (anything newer than 4.0, I would
 think).

 I think that in the end, enabling `openmp` right now by default would be a
 mess. Some compilers support it, others don't. The flags in ImageMagick
 need to match the ones the compiler that is building software against
 ImageMagick might be able to support. At the very least, we'd need to fix
 the `-lomp` detection with the patch above, and also sort out how to pass
 in the `libomp` library location if we're going to leave it with `-lomp`
 (but I doubt that is the right way to do it).


 For now, I'm voting we just turn `openmp` explicitly **off**...then nobody
 gets it (nobody does now anyway) but when `ImageMagick` is built with a
 newer `clang` compiler, at least it won't be serving up broken `pkg-
 config` files.

 That way we at least get the same behaviour on all systems. Then, over
 time, we can sort out the right way of invoking it in `pkg-config`.
 That'll be more important once Apple's clang starts supporting it.

 `ImageMagick's` detection right now is just broken (although you can force
 it to work by passing the `libomp` link libraries explicitly yourself, if
 the compiler you're using can support openmp.

-- 
Ticket URL: <https://trac.macports.org/ticket/57009#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list