Bug 200734

Summary: graphics/libkdcraw-kde4 : broken with update to graphics/libraw (breaks all KDE4 on F8, F9, DF)
Product: Ports & Packages Reporter: John Marino <marino>
Component: Individual Port(s)Assignee: freebsd-kde (group) <kde>
Status: Closed FIXED    
Severity: Affects Only Me CC: alonso, bahlgren, kde
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Enable C++ exceptions on GCC none

Description John Marino freebsd_committer freebsd_triage 2015-06-09 15:50:25 UTC
graphics/libkdcraw-kde4 will not build on gcc anymore:

cd /wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/.build/libkdcraw && /usr/bin/c++   -DKDE4_CMAKE_TOPLEVEL_DIR_LENGTH=47 -DKDE_DEFAULT_DEBUG_AREA=51002 -DKDE_DEPRECATED_WARNINGS -DMAKE_KDCRAW_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_STL -D_REENTRANT -O2 -pipe -fstack-protector -fno-strict-aliasing -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common -Woverloaded-virtual -fvisibility=hidden -Werror=return-type -fvisibility-inlines-hidden -O2 -DNDEBUG -DQT_NO_DEBUG -fPIC -I/wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/.build/libkdcraw -I/wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/libkdcraw-4.14.3/libkdcraw -I/wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/libkdcraw-4.14.3 -I/wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/.build -I/usr/local/include -I/usr/local/include/KDE -I/usr/local/include/qt4/phonon -I/usr/local/include/qt4/QtXmlPatterns -I/usr/local/include/qt4/QtXml -I/usr/local/include/qt4/QtWebKit -I/usr/local/include/qt4/QtTest -I/usr/local/include/qt4/QtSvg -I/usr/local/include/qt4/QtSql -I/usr/local/include/qt4/QtScript -I/usr/local/include/qt4/QtOpenGL -I/usr/local/include/qt4/QtNetwork -I/usr/local/include/qt4/QtDeclarative -I/usr/local/include/qt4/QtDBus -I/usr/local/include/qt4/Qt3Support -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/Qt -I/usr/local/share/qt4/mkspecs/default -I/usr/local/include/qt4 -I/usr/local/include/libraw     -D_LARGEFILE64_SOURCE -o CMakeFiles/kdcraw.dir/kdcraw.o -c /wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/libkdcraw-4.14.3/libkdcraw/kdcraw.cpp
In file included from /usr/local/include/libraw/libraw.h:40,
                 from /wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/libkdcraw-4.14.3/libkdcraw/kdcraw_p.h:39,
                 from /wrkdirs/usr/ports/graphics/libkdcraw-kde4/work/libkdcraw-4.14.3/libkdcraw/kdcraw.cpp:31:
/usr/local/include/libraw/libraw_datastream.h: In member function 'virtual int LibRaw_buffer_datastream::get_char()':
/usr/local/include/libraw/libraw_datastream.h:154: error: exception handling disabled, use -fexceptions to enable
*** [libkdcraw/CMakeFiles/kdcraw.dir/kdcraw.o] Error code 1


It is caused by this change in libraw:

https://github.com/LibRaw/LibRaw/commit/22921dd7afdb8439627726531eae935eeab8d602


Simply adding CXXFLAGS+=-fexceptions before CMAKE_ARGS  *** WILL NOT WORK ***


I think it's because of these flags: -fno-exceptions -DQT_NO_EXCEPTIONS

These come after -fexceptions and cancel it out.

I don't know what the fix is (other than to revert graphics/libraw).

by the way, this port should have been bumped as a result of libraw update but it wasn't.
Comment 1 Alonso Schaich freebsd_committer freebsd_triage 2015-06-11 12:57:21 UTC
Created attachment 157640 [details]
Enable C++ exceptions on GCC

area51 revision 10784, see http://src.mouf.net/area51/revision/?rev=10784 for more info
Comment 2 Alonso Schaich freebsd_committer freebsd_triage 2015-06-11 12:59:07 UTC
Hi,

Rebuilding x11/kdelibs4 after applying the attached patch should fix libkdcraw and it's consumers, however it might introduce new issues.

Can you try it and provide feedback?
Comment 3 John Marino freebsd_committer freebsd_triage 2015-06-11 13:25:53 UTC
what would be considered success?

If kde4libs is rebuilt and everything that depends on it (somewhere) is rebuilt, is that considered a success?

I can only test that on DF, by the way.
Comment 4 Alonso Schaich freebsd_committer freebsd_triage 2015-06-11 15:07:57 UTC
Now that I think of it there either is no unwinding information because exception handling is not supported - or there is no unwinding information because there's no exception handling in the code (would violate fno-exceptions and previously have broken the build), so the result is the same: no unwinding information and throw statements result in ABORT(3).

Therefore I guess you won't even have to rebuild the kdelibs consumers (other than libkdcraw), because there's no runtime/ABI changes, just a new way to call ABORT(3) at this time.
Comment 5 Bengt Ahlgren 2015-06-14 15:47:12 UTC
Alonso, thanks for the patch!

I've tried the patch on 9.3-REL and it works as far as I have tested.  I built everything depending on kdelibs with poudriere and did pkg install -fR kdelibs just to be sure. I also tested displaying some raw images with showfoto and gwenview - that worked too.
Comment 6 commit-hook freebsd_committer freebsd_triage 2015-06-15 17:15:15 UTC
A commit references this bug:

Author: rakuco
Date: Mon Jun 15 17:15:01 UTC 2015
New revision: 389739
URL: https://svnweb.freebsd.org/changeset/ports/389739

Log:
  Add upstream patch to fix the GCC build after r388490.

  libraw 0.16.1 started shipping some code that uses C++ exceptions. KDE code,
  on the other hand, disables exceptions by default, and users must opt-in in
  CMake to use them. clang is the exception and exceptions are always enabled
  when using it, which is why the build did not break with it.

  Import an upstream commit that does exactly that.

  Bump PORTREVISION to make sure that all users build the port with exception
  support.

  Done in collaboration with alonso@.

  PR:		200734

Changes:
  head/graphics/libkdcraw-kde4/Makefile
  head/graphics/libkdcraw-kde4/files/
  head/graphics/libkdcraw-kde4/files/patch-git_46898ec9