Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 531120

Summary: dev-haskell/cairo-0.12.5.0-r1: fails to build with no ABI matched
Product: Gentoo Linux Reporter: Pacho Ramos <pacho>
Component: Current packagesAssignee: Gentoo's Haskell Language team <haskell>
Status: RESOLVED FIXED    
Severity: normal CC: multilib+disabled
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build.log

Description Pacho Ramos gentoo-dev 2014-11-29 10:39:20 UTC
Created attachment 390572 [details]
build.log

./setup build
Building cairo-0.12.5.0...
Preprocessing library cairo-0.12.5.0...

In file included from ./Graphics/Rendering/Cairo.hs:9:0: 

/usr/include/cairo/cairo-features.h:43:3:
     error: #error "No ABI matched, please report a bug to bugs.gentoo.org"
     # error "No ABI matched, please report a bug to bugs.gentoo.org"
       ^
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2014-11-29 12:17:31 UTC
Yeah, ghc calls gcc's preprocessor with '-undef':

> x86_64-pc-linux-gnu-gcc -E -undef -traditional -include dist/build/autogen/cabal_macros.h -I dist/build -I dist/build -I dist/build/autogen -I dist/build -I dist/build/autogen -I dist/build -I . -I /usr/include/cairo -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/pixman-1 -I /usr/include/freetype2 -I /usr/include/libdrm -I /usr/include/libpng16 -I /usr/lib64/ghc-7.8.3.20141119/bytestring-0.10.4.0/include -I /usr/lib64/ghc-7.8.3.20141119/base-4.7.0.2/include -I /usr/lib64/ghc-7.8.3.20141119/integer-gmp-0.5.1.0/include -I /usr/lib64/ghc-7.8.3.20141119/include -I /usr/lib64/libffi-3.1/include '-D__GLASGOW_HASKELL__=708' '-Dlinux_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' '-D__SSE__=1' '-D__SSE2__=1' -x assembler-with-cpp ./Graphics/Rendering/Cairo.hs -o /tmp/ghc24899_0/ghc24899_1.hscpp

Would be nice if multilib eclass would export what '-Dwhatever=it-wants' to be set for current ABI.
Or would have another #ifdef in wrapped header for platform checks so we could skip it.

Currently we use this non-worker:
https://github.com/gentoo-haskell/gentoo-haskell/blob/master/dev-haskell/cairo/cairo-0.13.0.4.ebuild#L33
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-11-29 14:20:58 UTC
(In reply to Sergei Trofimovich from comment #1)
> Yeah, ghc calls gcc's preprocessor with '-undef':
> 
> > x86_64-pc-linux-gnu-gcc -E -undef -traditional -include dist/build/autogen/cabal_macros.h -I dist/build -I dist/build -I dist/build/autogen -I dist/build -I dist/build/autogen -I dist/build -I . -I /usr/include/cairo -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/pixman-1 -I /usr/include/freetype2 -I /usr/include/libdrm -I /usr/include/libpng16 -I /usr/lib64/ghc-7.8.3.20141119/bytestring-0.10.4.0/include -I /usr/lib64/ghc-7.8.3.20141119/base-4.7.0.2/include -I /usr/lib64/ghc-7.8.3.20141119/integer-gmp-0.5.1.0/include -I /usr/lib64/ghc-7.8.3.20141119/include -I /usr/lib64/libffi-3.1/include '-D__GLASGOW_HASKELL__=708' '-Dlinux_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' '-D__SSE__=1' '-D__SSE2__=1' -x assembler-with-cpp ./Graphics/Rendering/Cairo.hs -o /tmp/ghc24899_0/ghc24899_1.hscpp
> 
> Would be nice if multilib eclass would export what '-Dwhatever=it-wants' to
> be set for current ABI.

I doubt it would be nice. GCC macros are to be exported by GCC :). If ghc is doing something really, really stupid, it's ghc's fault. How can one expect packages to compile sanely if they are ran in randomly wiped environment?

> Or would have another #ifdef in wrapped header for platform checks so we
> could skip it.

Any suggestion what to depend on? __GLASGOW_HASKELL__?
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2014-11-29 16:52:28 UTC
(In reply to Michał Górny from comment #2)
> (In reply to Sergei Trofimovich from comment #1)
> > Yeah, ghc calls gcc's preprocessor with '-undef':
> > 
> > > x86_64-pc-linux-gnu-gcc -E -undef -traditional -include dist/build/autogen/cabal_macros.h -I dist/build -I dist/build -I dist/build/autogen -I dist/build -I dist/build/autogen -I dist/build -I . -I /usr/include/cairo -I /usr/include/glib-2.0 -I /usr/lib64/glib-2.0/include -I /usr/include/pixman-1 -I /usr/include/freetype2 -I /usr/include/libdrm -I /usr/include/libpng16 -I /usr/lib64/ghc-7.8.3.20141119/bytestring-0.10.4.0/include -I /usr/lib64/ghc-7.8.3.20141119/base-4.7.0.2/include -I /usr/lib64/ghc-7.8.3.20141119/integer-gmp-0.5.1.0/include -I /usr/lib64/ghc-7.8.3.20141119/include -I /usr/lib64/libffi-3.1/include '-D__GLASGOW_HASKELL__=708' '-Dlinux_BUILD_OS=1' '-Dx86_64_BUILD_ARCH=1' '-Dlinux_HOST_OS=1' '-Dx86_64_HOST_ARCH=1' '-D__SSE__=1' '-D__SSE2__=1' -x assembler-with-cpp ./Graphics/Rendering/Cairo.hs -o /tmp/ghc24899_0/ghc24899_1.hscpp
> > 
> > Would be nice if multilib eclass would export what '-Dwhatever=it-wants' to
> > be set for current ABI.
> 
> I doubt it would be nice. GCC macros are to be exported by GCC :). If ghc is
> doing something really, really stupid, it's ghc's fault. How can one expect
> packages to compile sanely if they are ran in randomly wiped environment?

GHC uses gcc's cpp to preprocess haskell sources. It translates .hs to .hs
with help of cpp and then strips off what came from #includes.
The result is as original .hs file, but without #directives.
Then GHC compiles final .hs file without help of gcc.

Example use:
http://hackage.haskell.org/package/cairo-0.12.0/docs/src/Graphics-Rendering-Cairo.html

It only tries to settle with those #ifdef bits.

I agree that piggybacking on cpp a bad idea (cpp can't parse full set of haskell for example, thus why -traditionla is used). We will try to remove -undef in the long run, but the hack in use for like 10 years.

> > Or would have another #ifdef in wrapped header for platform checks so we
> > could skip it.
> 
> Any suggestion what to depend on? __GLASGOW_HASKELL__?

I'd propose someting more awkward to ease grep for uses like '__GENTOO_FOR_CPP_UNDEF_'. And our use of workaround in "bad" ebuilds would be:

    HCFLAGS+=" -optP-D__GENTOO_FOR_CPP_UNDEF_=1"
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-11-29 23:42:34 UTC
Ah, so it's including the header file to get CPP macros from it? Very ugly, I dare say.

So I've got another solution for ya:

+*cairo-1.12.16-r4 (29 Nov 2014)
+
+  29 Nov 2014; Michał Górny <mgorny@gentoo.org> +cairo-1.12.16-r4.ebuild:
+  Stop wrapping cairo-features.h. Now that we pass consistent configure options,
+  it should be the same on all ABIs. Fixes compatibility with dev-haskell/cairo
+  hackery, bug #531120.

Now you just need a proper dep (and maybe an update to the stablereq).