Bug 194760 - graphics/inkscape linking fails when ImageMagick was compiled with openmp
Summary: graphics/inkscape linking fails when ImageMagick was compiled with openmp
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: Normal Affects Many People
Assignee: freebsd-gnome mailing list
URL:
Keywords:
: 195993 200579 201655 228358 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-11-02 16:10 UTC by Neel Chauhan
Modified: 2018-11-05 15:59 UTC (History)
15 users (show)

See Also:
neel: maintainer-feedback? (gnome)


Attachments
ImageMagick build log with openmp enabled (729.75 KB, text/plain)
2015-10-29 10:49 UTC, rocky
no flags Details
ImageMagick build log with all options except openmp enabled (708.55 KB, text/plain)
2015-10-29 10:50 UTC, rocky
no flags Details
inkscape-0.92.2 poudriere build log (37.27 KB, application/x-xz)
2017-11-29 21:33 UTC, VK
no flags Details
ImageMagick and OpenMP cause GLIB to disappear? (10.96 KB, text/plain)
2018-11-05 12:16 UTC, Michael Danilov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Neel Chauhan 2014-11-02 16:10:01 UTC
If I try to compile graphics/inkscape 0.48.5 on a FreeBSD 10.0-RELEASE amd64 system, I get this error:

  AR       libinkversion.a
  AR       libinkscape.a
  AR       dom/libdom.a
  AR       libcroco/libcroco.a
  AR       libavoid/libavoid.a
  AR       libgdl/libgdl.a
  AR       libcola/libcola.a
  AR       libvpsc/libvpsc.a
  AR       livarot/libvarot.a
1 warning generated.
  AR       2geom/lib2geom.a
  CXXLD    inkview
  CXXLD    inkscape
libinkscape.a(imagemagick.o): In function `Inkscape::Extension::Internal::Bitmap::ImageMagickDocCache::readImage(char const*, Magick::Image*)':
extension/internal/bitmap/imagemagick.cpp:(.text+0x262): undefined reference to `Magick::Blob::base64(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)'
extension/internal/bitmap/imagemagick.cpp:(.text+0x2ca): undefined reference to `Magick::Image::read(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
libinkscape.a(imagemagick.o): In function `Inkscape::Extension::Internal::Bitmap::ImageMagickDocCache::readImage(char const*, Magick::Image*)':
extension/internal/bitmap/imagemagick.cpp:(.text+0x262): undefined reference to `Magick::Blob::base64(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)'
extension/internal/bitmap/imagemagick.cpp:(.text+0x2ca): undefined reference to `Magick::Image::read(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:5056: recipe for target 'inkview' failed
gmake[4]: *** [inkview] Error 1
gmake[4]: *** Waiting for unfinished jobs....
c++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:5052: recipe for target 'inkscape' failed
gmake[4]: *** [inkscape] Error 1
gmake[4]: Leaving directory '/usr/ports/graphics/inkscape/work/inkscape-0.48.5/src'
Makefile:1024: recipe for target 'all-recursive' failed
gmake[3]: *** [all-recursive] Error 1
gmake[3]: Leaving directory '/usr/ports/graphics/inkscape/work/inkscape-0.48.5'
Makefile:718: recipe for target 'all' failed
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory '/usr/ports/graphics/inkscape/work/inkscape-0.48.5'
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/graphics/inkscape
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/inkscape

I get this error even if I try to use MAKE_JOBS_UNSAFE=yes. I tried GCC, and got the same thing. I even went to uninstalling graphics/inkscape and then rebuilding and still got this error.

I'd appreciate to know what's the reason for this problem and how can this problem can be solved?
Comment 1 Bugzilla Automation freebsd_committer 2014-11-02 16:10:01 UTC
Auto-assigned to maintainer gnome@FreeBSD.org
Comment 2 martin.dieringer 2014-11-19 15:59:54 UTC
same problem here, 10.1-PRERELEASE
Comment 3 Koop Mast freebsd_committer 2014-11-22 18:19:00 UTC
Fix by limiting to kerberos from base.
Comment 4 commit-hook freebsd_committer 2014-11-22 18:19:32 UTC
A commit references this bug:

Author: kwm
Date: Sat Nov 22 18:18:39 UTC 2014
New revision: 373083
URL: https://svnweb.freebsd.org/changeset/ports/373083

Log:
  We currently only support kerberos from base. Make sure it disabled and
  not accidently picked up by configure.

  PR:		194760
  Submitted by:	Neel Chauhan <neel@neelc.org>

Changes:
  head/databases/evolution-data-server/Makefile
Comment 5 Koop Mast freebsd_committer 2014-11-22 18:19:54 UTC
woops closed wrong PR.
Comment 6 Koop Mast freebsd_committer 2014-11-22 20:54:27 UTC
Sorry about the spam.

I can't reproduce this. Do you have any non-default settings in inkscape or another port? and could you list your /etc/make.conf?
Comment 7 Koop Mast freebsd_committer 2014-11-27 15:52:55 UTC
Did you build ImageMagick with the OPENMP option enabled? That uses gcc and would explain the c++ linking issues.
Comment 8 Friedrich Volkmann 2015-02-25 16:19:26 UTC
I had the same problem. Linking to ImageMagic failed with the cited error message, although the .so files are in place. It does not matter if the OPENMP option is checked for Inkscape. It only matters if the OPENMP option is checked for ImageMagick. When I build Imagemagic with Tests and OPENMP options checked, all of the tests within Magic++ run into segmentation faults upon execution of the compiled test binaries. When I uncheck OPENMP, all of the tests succeed, and Inkscape subsequently builds and runs flawlessly even with the OPENMP option checked. So this is solely an ImageMagick problem, not an Inkscape problem.

Importance should be raised to "Affects Many People", because multi-core processors have become standard.

#195993 is a duplicate of this bug.
Comment 9 martin.dieringer 2015-10-07 14:30:07 UTC
It compiles with clang despite OPENMP is checked and there are messages about unused -fopenmp.. But using GCC it breaks at 

  CXX      libvpsc/generate-constraints.o
In file included from libvpsc/generate-constraints.cpp:22:0:
libvpsc/generate-constraints.cpp: In member function 'bool vpsc::CmpNodePos::operator()(const vpsc::Node*, const vpsc::Node*) const':
./2geom/math-utils.h:113:30: error: 'isnan' was not declared in this scope
 # define IS_NAN(_a) (isnan(_a))  /* GNU definition */
                              ^
Comment 10 Kurt Jaeger freebsd_committer 2015-10-28 20:04:39 UTC
*** Bug 195993 has been marked as a duplicate of this bug. ***
Comment 11 Kurt Jaeger freebsd_committer 2015-10-28 20:06:06 UTC
For additional reports, see the duplicate bug 195993.
Comment 12 Kurt Jaeger freebsd_committer 2015-10-29 09:08:10 UTC
*** Bug 201655 has been marked as a duplicate of this bug. ***
Comment 13 rocky 2015-10-29 10:49:30 UTC
Created attachment 162560 [details]
ImageMagick build log with openmp enabled
Comment 14 rocky 2015-10-29 10:50:37 UTC
Created attachment 162561 [details]
ImageMagick build log with all options except openmp enabled
Comment 15 rocky 2015-10-29 10:55:58 UTC
(In reply to Friedrich Volkmann from comment #8)
I can verify this in latest ports tree. With openmp enabled half the tests fail. Without only 3 fail.

Could this be an ImageMagick bug rather than inkscape?

I've tried with default options in both ImageMagick and inkscape, inkscape builds fine.
Tried openmp enabled in ImageMagick, inkscape won't build.
Then tried openmp enabled in inkscape too, won't build.
Then tried all options enabled except openmp in ImageMagick, inkscape default, builds fine.
Comment 16 Walter Schwarzenfeld 2015-10-30 02:04:41 UTC
I deinstalled ImageMagick (don't know if it is really needed to deinstall) and installed ImageMagick and inkscape successful with clang37.
Comment 17 Kubilay Kocak freebsd_committer freebsd_triage 2016-02-01 16:56:47 UTC
Can't be In Progress without an Assignee.

@Koop, could you take this, we have more reports of the same issue:

https://lists.freebsd.org/pipermail/freebsd-ports/2016-February/101757.html
Comment 18 rkoberman 2016-02-02 01:10:09 UTC
See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=191193

This is the same issue with ImageMagick and OpenMP. From the other ticket:
I have tracked this down and it is not directly tied to the OPENMP option.

These symbols should be provided by libgomp, the GNU OpenMP library, but it's not a part of OpenMP, it is a part of gcc. 

I see that there are two libgomp.so.1 libs on the system. One is in the base system (/usr/lib) and the other is from lang/gcc (/usr/local/lib). While the one installed by the port has the required symbols, the base library does not have any symbols (at least as reportd by (objdump). I guess it is a stub. Looks like IamgeMagick links to the "real" library, but emacs finds the stub when configuring, so it dies.

and:
I have confirmed the problem by moving the stub library (and symlink) in /usr/lib out of the way. emacs builds cleanly at this point.

From config.log:
configure:10699: cc -o conftest -I/usr/local/include -O2 -pipe -fno-strict-aliasing -I/usr/local/include/librsvg-2.0 -I/usr/local/include/gdk-pixbuf-2.0 -pthread -I/usr/local/include/cairo -I/usr/local/include/glib-2.0 -I/usr/local/include/pixman-1  -I/usr/local/include/freetype2 -I/usr/local/include/libpng15 -D_THREAD_SAFE -I/usr/local/include   -I/usr/local/include/ImageMagick-6 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16   -I/usr/local/include/gtk-2.0 -I/usr/local/include/gio-unix-2.0/ -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pixman-1 -D_THREAD_SAFE -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/pango-1.0 -pthread  -I/usr/local/include/freetype2 -I/usr/local/include/libpng15 -I/usr/local/include/harfbuzz -I/usr/local/include/glib-2.0 -I/usr/local/include   -I/usr/local/include   -I/usr/local/include  -L/usr/local/lib -Wl,-rpath=/usr/lib:/usr/local/lib -Wl,-znocombreloc -L/usr/local/lib conftest.c -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -lXext -lXrender -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lXfixes -lX11 -latk-1.0 -lcairo -pthread -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lfontconfig -lfreetype -L/usr/local/lib -lglib-2.0 -lintl   -lMagickWand-6.Q16 -L/usr/local/lib -lMagickCore-6.Q16   -lrsvg-2 -lm -lgio-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -L/usr/local/lib -lcairo -pthread   -lX11 -lpthread -lutil  >&5 

Note the -rpath=/usr/lib:/usr/local/lib which results in the stub being used instead of the real library.
Comment 19 Kubilay Kocak freebsd_committer freebsd_triage 2016-02-02 07:24:59 UTC
*** Bug 200579 has been marked as a duplicate of this bug. ***
Comment 20 tigersharke 2016-02-02 07:26:45 UTC
I have also encountered the not very obvious "ImageMagick openmp enabled" build malfunction for Inkscape. I must have changed the options for ImageMagick without realizing there would be a conflict, the options sound compatible but I wasn't aware of the difference until I read prior comment(s). 

FreeBSD ichigo.underworld 10.2-STABLE FreeBSD 10.2-STABLE #0 r293903: Thu Jan 14 05:25:12 CST 2016     tigersharke@ichigo.underworld:/usr/obj/usr/src/sys/ICHIGO  amd64
Comment 21 Michael Danilov 2016-02-02 14:57:52 UTC
Hello,

This issue might be related, but there were other options enabled during the build:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=204119
Comment 22 bye 2016-09-07 22:12:51 UTC
I also have this same issue with inkscape not linking and erroring out with glibxx

I've tried with -DMAKE_BUILD_UNSAFE still no go.

I am on FreeBSD 11.0-RC2
Comment 23 VK freebsd_triage 2017-11-29 21:33:47 UTC
Created attachment 188410 [details]
inkscape-0.92.2 poudriere build log

I have the same issue. Inkscape won't build if ImageMagick has OPENMP option on it.

My build log attached (compressed because it's over 1MB and Bugzilla complains), Poudriere on 11.1, amd64.
Comment 24 Jan Beich freebsd_committer 2018-10-28 10:59:33 UTC
*** Bug 228358 has been marked as a duplicate of this bug. ***
Comment 25 Michael Danilov 2018-11-05 01:54:31 UTC
The problem is, now graphics/ImageMacick won't build with OPENMP disabled because it still requires -lomp. So we _can't have_ inkscape anymore.
Comment 26 Michael Danilov 2018-11-05 03:25:55 UTC
Desperate googling result, might be relevant:

https://github.molgen.mpg.de/mariux64/pkg-scripts/blob/master/inkscape-0.92.1-0.build.sh
Comment 27 rkoberman 2018-11-05 04:29:39 UTC
(In reply to Michael Danilov from comment #25)
But you do have libomp.so. Or, at least you do if you have lang/llvm6 installed. The problems is that it is installed in /usr/local/lib/llvm60/lib which is not in hte library search path so that it does not get linked.

I do an ugly "fix" of symlinking /usr/local/lib/libomp.so to /usr/local/llvm60/lib/libomp.so. This is not really a good solution as, once llvm7 becomes the default, the link needs to updated.

I cant honestly recommend this as it may have some bad side effects, but it is working for me.
Comment 28 Michael Danilov 2018-11-05 11:49:35 UTC
(In reply to rkoberman from comment #27)

My problem is I use Poudriere to build my packages, and from what I get the symlink must be present on both build and run systems.

But why does uncommenting the OPENMP switch and adding

OPENMP_LDFLAGS+=        -L${LOCALBASE}/llvm60/lib

not work?
Comment 29 Michael Danilov 2018-11-05 12:12:51 UTC
In fact I just commented out everything compiler-related and added

USES+=          compiler:openmp
LDFLAGS+=       -L${LOCALBASE}/llvm60/lib
CMAKE_ARGS+=            -DWITH_OPENMP:BOOL=YES

and now it dies with pages of linker vomit related to GLIB.

I'm really starting to believe that guy's post I found about GLIB and ImageMagick ABIs not matching.
Comment 30 Michael Danilov 2018-11-05 12:16:34 UTC
Created attachment 198964 [details]
ImageMagick and OpenMP cause GLIB to disappear?
Comment 31 Michael Danilov 2018-11-05 15:59:52 UTC
Ah. It turns out https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222731 caused ImageMagick to fail the build without OpenMP, which in turn blocked inkscape from compiling. Disabling OPENMP in all 3 of them does the trick.