Migrate OS X port of Inkscape to lcms2

Bug #1024344 reported by su_v
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Unassigned

Bug Description

Color management in current trunk builds on OS X 10.7.4 (Xcode 4.3.2, MacPorts 2.1.1) is broken ever since libffi in MacPorts was upgraded to 3.0.11. This affects two independent build setups equally (one MacPorts tree with custom ${prefix} used for GTK+/X11, one for GTK+/Quartz).

$ port installed libffi
The following ports are currently installed:
  libffi @3.0.10_2
  libffi @3.0.11_0 (active)
$ port installed lcms*
The following ports are currently installed:
  lcms @1.19_2
  lcms @1.19_3+debug_symbols (active)
  lcms2 @2.2_0
  lcms2 @2.3_0
  lcms2 @2.3_1+debug_symbols (active)
$ pkg-config --modversion lcms
1.19
$ pkg-config --modversion lcms2
2.3
$

Inkscape trunk links to both lcms and lcms2 (lcms2 pulled in via ImageMagick):
$ otool -L /Volumes/cyan/src/inkscape/inkscape-repo/mp-debug/build/src/inkscape | grep lcms
 /Volumes/cyan/mp-test/with-a-long-long-long-directory-name/lib/liblcms2.2.dylib (compatibility version 3.0.0, current version 3.3.0)
 /Volumes/cyan/mp-test/with-a-long-long-long-directory-name/lib/liblcms.1.dylib (compatibility version 2.0.0, current version 2.19.0)
$ otool -L /Volumes/cyan/src/inkscape/inkscape-repo/mp-debug/build/src/inkscape | grep -i magick
 /Volumes/cyan/mp-test/with-a-long-long-long-directory-name/lib/libMagick++.5.dylib (compatibility version 6.0.0, current version 6.0.0)
 /Volumes/cyan/mp-test/with-a-long-long-long-directory-name/lib/libMagickWand.5.dylib (compatibility version 6.0.0, current version 6.0.0)
 /Volumes/cyan/mp-test/with-a-long-long-long-directory-name/lib/libMagickCore.5.dylib (compatibility version 6.0.0, current version 6.0.0)
$

As mentioned in related bug #682357, Inkscape "randomly" uses functions from either of the two linked lcms library versions (if ImageMagick was detected by configure). After the upgrade of libffi to 3.0.11, this triggers issues like
- unable to read profile info from installed ICC profiles (affects preferences for soft proofing as well as linking of color profiles into documents: the profile selectors in the preferences pane are empty, in the document properties it lists all available profiles with the generic label '{no name}')
- crashes when using the CMS tab in 'Fill and Stroke' (both with old files which use the correct profile name and new files which use the string '-no-name-' for the name of the linked color profile)
and probably others I simply haven't detected in my initial tests. I never experienced such issues with stable builds (they do not link directly to libffi, nor to both versions of lcms), and earlier trunk builds (linking to the previous version of libffi).

Steps to reproduce the crash:
1) open attached SVG file in current trunk build on 64bit OS X
2) select the rectangle
3) open 'Fill & Stroke'
--> crash

The attached backtrace (both lcms versions had been installed with debug symbols)
indicates that the crash in
> cmsSetAlarmCodes (NewAlarm=0xff) at cmsxform.c:56
> 56 Alarm[i] = NewAlarm[i];
is happening in lcms2, despite the configure magic to disable lcms2 on Mac OS X:

a) cmsxform.c:56 in lcms v1.19
<http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/lcms/quantal/view/head:/src/cmsxform.c#L56>

b) cmsxform.c:56 in lcms2 v 2.3
<http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/lcms2/quantal/view/head:/src/cmsxform.c#L56>
or
<https://github.com/mm2/Little-CMS/blob/master/src/cmsxform.c#L56>

Only workaround I'm aware of at the moment:
use the patch from bug #682357 and configure Inkscape without ImageMagick++
(not really an acceptable solution IMHO)

Tags: color crash osx
Revision history for this message
su_v (suv-lp) wrote :
Revision history for this message
su_v (suv-lp) wrote :

Note: link to color profile uses hardcoded absolute path to
  $XDG_DATA_HOME/color/icc/Fogra27L.icm
Please adjust as needed for testing on other systems.

Revision history for this message
su_v (suv-lp) wrote :

Diff used with r11547 to disable ImageMagick++ via configure option (in order to prevent Inkscape from linking to both versions of lcms).

Revision history for this message
su_v (suv-lp) wrote :

Update for Quartz-based trunk builds:
After upgrading poppler from 0.18.4 to 0.20.2 (poppler 0.20 migrated from lcms to lcms2), color management seems to be working again in latest Inkscape trunk builds (although the binary still links to both versions of lcms, and lcms2 support is not enabled for osx builds in configure).

Note: These findings need yet to be verified/reproduced with the X11-based build environment (poppler not yet upgraded there), since the Quartz-based build environment also uses newer (unstable) versions of glib2 and glibmm.

Revision history for this message
su_v (suv-lp) wrote :

This is a recurring issue as long as the OS X port of Inkscape is not migrated to lcms2 (this has already happened for linux and win32 builds).

Lately, the issue returned with libvisio which in its pkg-config file requires to link with lcms2:
<http://cgit.freedesktop.org/libreoffice/libcdr/tree/libcdr.pc.in#n9>

After installing libcdr with a modified pkg-config file (moving 'lcms2' to 'Requires.private:'), Inkscape no longer links to both lcms and lcms2 (and thus color management works again as expected, though based on the old version of lcms).

Changing bug summary to reflect the underlying issue (migrate OS X port of Inkscape to lcms2).

summary: - Color management in trunk broken on OS X after upgrading libffi to
- 3.0.11
+ Migrate OS X port of Inkscape to lcms2
Revision history for this message
su_v (suv-lp) wrote :

See also bug #1239370, comment #12 and later:
test builds on OS X 10.7.5 with lcms2 enabled so far seem to work ok (no errors, no crashes) - even with older versions of lcms2.

Revision history for this message
su_v (suv-lp) wrote :

Attached: diff used to enable LCMS2 on OS X (based on trunk r12738).

Revision history for this message
su_v (suv-lp) wrote :

LCMS2 enabled for all platforms in r13363 of lp:inkscape/experimental

Revision history for this message
su_v (suv-lp) wrote :

r13620

su_v (suv-lp)
no longer affects: inkscape/0.91.x
Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
no longer affects: inkscape/experimental
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.