Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 644170 - dev-haskell/libxml-sax-0.7.5 - ld: -r and -pie may not be used together
Summary: dev-haskell/libxml-sax-0.7.5 - ld: -r and -pie may not be used together
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
: 642018 644004 646994 647960 691074 691078 691082 691154 702556 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-11 00:58 UTC by Anton Kochkov
Modified: 2021-04-28 18:37 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
libxml-sax_build.log (libxml-sax_build.log,5.74 KB, text/plain)
2018-01-11 00:58 UTC, Anton Kochkov
Details
emerge --info output (emerge-info.log,5.17 KB, text/plain)
2018-01-11 01:00 UTC, Anton Kochkov
Details
dev-haskell/curl-1.3.8 failed build log (dev-haskell:curl-1.3.8:20180908-104724.log.gz,2.89 KB, application/gzip)
2018-09-08 11:09 UTC, Zentoo
Details
dev-haskell/hackage-security-0.5.2.2 failed build log (dev-haskell:hackage-security-0.5.2.2:20180908-104638.log.gz,4.35 KB, application/gzip)
2018-09-08 11:10 UTC, Zentoo
Details
dev-haskell/hslua-0.3.6.1 failed build log (dev-haskell:hslua-0.3.6.1:20180908-104808.log.gz,2.70 KB, application/gzip)
2018-09-08 11:10 UTC, Zentoo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Kochkov 2018-01-11 00:58:55 UTC
Created attachment 514200 [details]
libxml-sax_build.log

After updating to 17.0 profile and during "emerge -e @world"
Comment 1 Anton Kochkov 2018-01-11 01:00:57 UTC
Created attachment 514202 [details]
emerge --info output
Comment 2 Anton Kochkov 2018-01-11 01:01:44 UTC
[1 of 1] Compiling Text.XML.LibXML.SAX ( lib/Text/XML/LibXML/SAX.hs, dist/build/Text/XML/LibXML/SAX.o )

lib/Text/XML/LibXML/SAX.hs:19:1: warning: [-Wtabs]
    Tab character found here, and in 345 further locations.
    Please use spaces instead.

lib/Text/XML/LibXML/SAX.hs:77:16: warning: [-Wunused-top-binds]
    Defined but not used: data constructor ‘Context’
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status

<no location info>: error:
    `x86_64-pc-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)
Comment 3 Zentoo 2018-01-11 07:45:20 UTC
 I got similar problems with these haskell ebuilds:

dev-haskell/hackage-security
dev-haskell/curl
dev-haskell/hslua

And I think all haskell ebuild that depends on external compiled objects should have the same problem.


A temporary solution to solve these emerge is to use no-pie flags with portage env feature:

/etc/portage/package.env
------------------------
dev-haskell/hackage-security	nopie.conf
dev-haskell/curl		nopie.conf
dev-haskell/hslua		nopie.conf

/etc/portage/env/nopie.conf
---------------------------
CFLAGS="${CFLAGS} -no-pie" 
CXXFLAGS="${CXXFLAGS} -no-pie" 
LDFLAGS="${LDFLAGS} -no-pie"
Comment 4 Zentoo 2018-01-11 08:00:24 UTC
>(In reply to Zentoo from comment #3)
> 
> A temporary solution to solve these emerge is to use no-pie flags with
> portage env feature:
> 
> /etc/portage/package.env
> ------------------------
> dev-haskell/hackage-security	nopie.conf
> dev-haskell/curl		nopie.conf
> dev-haskell/hslua		nopie.conf
> 
> /etc/portage/env/nopie.conf
> ---------------------------
> CFLAGS="${CFLAGS} -no-pie" 
> CXXFLAGS="${CXXFLAGS} -no-pie" 
> LDFLAGS="${LDFLAGS} -no-pie"

Based on bug #60666 only LDFLAGS="-no-pie" is needed.
So:

/etc/portage/package.env
------------------------
dev-haskell/hackage-security	ld-nopie.conf
dev-haskell/curl		ld-nopie.conf
dev-haskell/hslua		ld-nopie.conf

/etc/portage/env/ld-nopie.conf
---------------------------
LDFLAGS="${LDFLAGS} -no-pie"
Comment 5 Zentoo 2018-01-11 08:01:42 UTC
(In reply to Zentoo from comment #4)
> Based on bug #60666 only LDFLAGS="-no-pie" is needed.
ERRATA: it's bug #606666
Comment 6 Anton Kochkov 2018-01-11 14:55:20 UTC
Yes, also, just for the record, same problem for dev-haskell/x11-1.8-r1 (xmonad dependency)

>>> Compiling source in /var/tmp/portage/dev-haskell/x11-1.8-r1/work/X11-1.8 ...
./setup build
Building X11-1.8...
Preprocessing library X11-1.8...
[01m[KXF86.hsc:711:27:[m[K [01;35m[Kwarning: [m[Kextra tokens at end of #ifdef directive
[01m[KXF86.hsc:[m[K In function ‘[01m[Kmain[m[K’:
[01m[KXF86.hsc:711:27:[m[K [01;35m[Kwarning: [m[Kextra tokens at end of #ifdef directive
[01m[KXF86.hsc:711:27:[m[K [01;35m[Kwarning: [m[Kextra tokens at end of #ifdef directive
[ 1 of 28] Compiling Graphics.X11.Xlib.Internal ( dist/build/Graphics/X11/Xlib/Internal.hs, dist/build/Graphics/X11/Xlib/Internal.o )
[ 2 of 28] Compiling Graphics.X11.Types ( dist/build/Graphics/X11/Types.hs, dist/build/Graphics/X11/Types.o )
[ 3 of 28] Compiling Graphics.X11.Xlib.Types ( dist/build/Graphics/X11/Xlib/Types.hs, dist/build/Graphics/X11/Xlib/Types.o )
[ 4 of 28] Compiling Graphics.X11.Xlib.Atom ( dist/build/Graphics/X11/Xlib/Atom.hs, dist/build/Graphics/X11/Xlib/Atom.o )
[ 5 of 28] Compiling Graphics.X11.Xlib.Color ( Graphics/X11/Xlib/Color.hs, dist/build/Graphics/X11/Xlib/Color.o )
[ 6 of 28] Compiling Graphics.X11.Xlib.Context ( Graphics/X11/Xlib/Context.hs, dist/build/Graphics/X11/Xlib/Context.o )
[ 7 of 28] Compiling Graphics.X11.Xlib.Display ( Graphics/X11/Xlib/Display.hs, dist/build/Graphics/X11/Xlib/Display.o )
[ 8 of 28] Compiling Graphics.X11.Xlib.Event ( dist/build/Graphics/X11/Xlib/Event.hs, dist/build/Graphics/X11/Xlib/Event.o )
[ 9 of 28] Compiling Graphics.X11.Xlib.Font ( dist/build/Graphics/X11/Xlib/Font.hs, dist/build/Graphics/X11/Xlib/Font.o )
[10 of 28] Compiling Graphics.X11.Xlib.Cursor ( dist/build/Graphics/X11/Xlib/Cursor.hs, dist/build/Graphics/X11/Xlib/Cursor.o )
[11 of 28] Compiling Graphics.X11.Xlib.Image ( Graphics/X11/Xlib/Image.hs, dist/build/Graphics/X11/Xlib/Image.o )
[12 of 28] Compiling Graphics.X11.Xlib.Misc ( dist/build/Graphics/X11/Xlib/Misc.hs, dist/build/Graphics/X11/Xlib/Misc.o )
[13 of 28] Compiling Graphics.X11.Xlib.Region ( Graphics/X11/Xlib/Region.hs, dist/build/Graphics/X11/Xlib/Region.o )
[14 of 28] Compiling Graphics.X11.Xlib.Screen ( Graphics/X11/Xlib/Screen.hs, dist/build/Graphics/X11/Xlib/Screen.o )
[15 of 28] Compiling Graphics.X11.Xlib.Window ( Graphics/X11/Xlib/Window.hs, dist/build/Graphics/X11/Xlib/Window.o )
[16 of 28] Compiling Graphics.X11.Xlib ( Graphics/X11/Xlib.hs, dist/build/Graphics/X11/Xlib.o )
[17 of 28] Compiling Graphics.X11.XScreenSaver ( dist/build/Graphics/X11/XScreenSaver.hs, dist/build/Graphics/X11/XScreenSaver.o )
[18 of 28] Compiling Graphics.X11.Xrandr ( dist/build/Graphics/X11/Xrandr.hs, dist/build/Graphics/X11/Xrandr.o )
[19 of 28] Compiling Graphics.X11.Xlib.Extras ( dist/build/Graphics/X11/Xlib/Extras.hs, dist/build/Graphics/X11/Xlib/Extras.o )
/usr/lib/gcc/x86_64-pc-linux-gnu/6.4.0/../../../../x86_64-pc-linux-gnu/bin/ld: -r and -pie may not be used together
collect2: error: ld returned 1 exit status

<no location info>: error:
    `x86_64-pc-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-11 23:08:57 UTC
(In reply to Anton Kochkov from comment #6)
> Yes, also, just for the record, same problem for dev-haskell/x11-1.8-r1
> (xmonad dependency)

> ld: -r and -pie may not be used together
> collect2: error: ld returned 1 exit status
> 
> <no location info>: error:
>     `x86_64-pc-linux-gnu-gcc' failed in phase `Linker'. (Exit code: 1)

Does your ghc report no-pie support?

$ ghc --info | grep pie
 ,("C compiler supports -no-pie","YES")
Comment 8 Anton Kochkov 2018-01-12 01:26:07 UTC
It reports "NO" for "C compiler supports -no-pie"
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-12 07:12:02 UTC
(In reply to Anton Kochkov from comment #8)
> It reports "NO" for "C compiler supports -no-pie"

Did you rebuild ghc after switch to gcc[pie]? Or maybe you use USE=binary ghc?
Comment 10 Zentoo 2018-01-12 07:56:50 UTC
As far as I understand this problem seems to appear when a haskell module is linked against an external library as curl for example.

With gentoo profile 17.0, libraries are compiled with PIE and it seems that these particular haskell modules are generating relocatable output.
Relocatable and PIE are not compatible for ld. 
That's why to force LD_FLAGS=-no-pie works to be able to emerge these ebuilds.

I suppose that it would be better to do not use relocatable code and keep PIE to stay consistent but I'm not an expert about how haskell/cabal generates libraries.
Comment 11 Anton Kochkov 2018-01-12 17:11:58 UTC
(In reply to Sergei Trofimovich from comment #9)
> (In reply to Anton Kochkov from comment #8)
> > It reports "NO" for "C compiler supports -no-pie"
> 
> Did you rebuild ghc after switch to gcc[pie]? Or maybe you use USE=binary
> ghc?

Yes, it was rebuilt as a part of "emerge -e @world". But probably somehow in a wrong way. After explicitly rebuilding of ghc again, everything seem to work ok - it reports of "-no-pie" support and also dev-haskell/libxml-sax builds just fine.
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2018-01-16 17:36:29 UTC

*** This bug has been marked as a duplicate of bug 644004 ***
Comment 13 Larry the Git Cow gentoo-dev 2018-01-22 00:01:20 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf8f136b40a11d047b6281970753ededfca09b04

commit bf8f136b40a11d047b6281970753ededfca09b04
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-01-22 00:01:07 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-01-22 00:01:07 +0000

    dev-lang/ghc: rebuild ghc against gcc-6 (PIE support), bug #644170
    
    Refresh binaries for amd64 and x86 to support -no-pie option by default.
    
    Reported-by: Anton Kochkov
    Bug: https://bugs.gentoo.org/644170
    Package-Manager: Portage-2.3.19, Repoman-2.3.6

 dev-lang/ghc/Manifest         | 4 ++--
 dev-lang/ghc/ghc-8.0.2.ebuild | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)}
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-22 23:10:10 UTC
Pushed rebuilt binaries at least for amd64 and x86. These should work as-is for gcc-6.
Comment 15 Sergei Trofimovich (RETIRED) gentoo-dev 2018-02-08 19:38:57 UTC
*** Bug 646994 has been marked as a duplicate of this bug. ***
Comment 16 Sergei Trofimovich (RETIRED) gentoo-dev 2018-02-18 21:04:13 UTC
*** Bug 647960 has been marked as a duplicate of this bug. ***
Comment 17 Sergei Trofimovich (RETIRED) gentoo-dev 2018-02-18 21:04:38 UTC
*** Bug 644004 has been marked as a duplicate of this bug. ***
Comment 18 Zentoo 2018-09-06 16:13:35 UTC
It seems some duplicates of this bug have been resolved but there are still ebuilds that don't compile and need the packange.env workaround:


/etc/portage/package.env

dev-haskell/hackage-security	nopie.conf
dev-haskell/curl		nopie.conf
dev-haskell/hslua		nopie.conf


/etc/portage/env/nopie.conf 

LDFLAGS="${LDFLAGS} -no-pie"



These ebuilds don't compile with:
dev-lang/ghc-7.10.3
sys-devel/gcc-7.3.0-r3
Comment 19 Sergei Trofimovich (RETIRED) gentoo-dev 2018-09-06 18:27:49 UTC
(In reply to Zentoo from comment #18)
> It seems some duplicates of this bug have been resolved but there are still
> ebuilds that don't compile and need the packange.env workaround

Please provide a build log for example failure. It's not a specific ebuild problem but a lack of rebuild of one of dependencies that managed to persist old LDFLAGS.
Comment 20 Zentoo 2018-09-08 11:09:47 UTC
Created attachment 546266 [details]
dev-haskell/curl-1.3.8 failed build log
Comment 21 Zentoo 2018-09-08 11:10:23 UTC
Created attachment 546268 [details]
dev-haskell/hackage-security-0.5.2.2 failed build log
Comment 22 Zentoo 2018-09-08 11:10:49 UTC
Created attachment 546270 [details]
dev-haskell/hslua-0.3.6.1 failed build log
Comment 23 Zentoo 2018-09-08 11:13:33 UTC
(In reply to Sergei Trofimovich from comment #19)
> (In reply to Zentoo from comment #18)
> > It seems some duplicates of this bug have been resolved but there are still
> > ebuilds that don't compile and need the packange.env workaround
> 
> Please provide a build log for example failure. It's not a specific ebuild
> problem but a lack of rebuild of one of dependencies that managed to persist
> old LDFLAGS.

Please find failed builds logs as attachments for:
- dev-haskell/curl-1.3.8
- dev-haskell/hackage-security-0.5.2.2
- dev-haskell/curl-1.3.8

Note: whole world have been rebuild before generate these builds.
Comment 24 Sergei Trofimovich (RETIRED) gentoo-dev 2018-09-08 11:23:18 UTC
Please post output of 'ghc --info' as well.
Comment 25 Zentoo 2018-09-10 08:54:37 UTC
(In reply to Sergei Trofimovich from comment #24)
> Please post output of 'ghc --info' as well.

# ghc --info
 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("GCC extra via C opts"," -fwrapv")
 ,("C compiler command","x86_64-pc-linux-gnu-gcc")
 ,("C compiler flags"," -fno-stack-protector")
 ,("C compiler link flags","")
 ,("Haskell CPP command","x86_64-pc-linux-gnu-gcc")
 ,("Haskell CPP flags","-E -undef -traditional ")
 ,("ld command","/usr/bin/x86_64-pc-linux-gnu-ld")
 ,("ld flags","")
 ,("ld supports compact unwind","YES")
 ,("ld supports build-id","YES")
 ,("ld supports filelist","NO")
 ,("ld is GNU ld","YES")
 ,("ar command","/usr/bin/x86_64-pc-linux-gnu-ar")
 ,("ar flags","q")
 ,("ar supports at file","YES")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("libtool command","libtool")
 ,("readelf command","/usr/bin/x86_64-pc-linux-gnu-readelf")
 ,("perl command","/usr/bin/perl")
 ,("cross compiling","NO")
 ,("target os","OSLinux")
 ,("target arch","ArchX86_64")
 ,("target word size","8")
 ,("target has GNU nonexec stack","True")
 ,("target has .ident directive","True")
 ,("target has subsections via symbols","False")
 ,("Unregisterised","NO")
 ,("LLVM llc command","llc")
 ,("LLVM opt command","opt")
 ,("Project version","7.10.3")
 ,("Project Git commit id","97e7c293abbde5223d2bf0516f8969bdd1a9a7a2")
 ,("Booter version","7.10.3")
 ,("Stage","2")
 ,("Build platform","x86_64-unknown-linux")
 ,("Host platform","x86_64-unknown-linux")
 ,("Target platform","x86_64-unknown-linux")
 ,("Have interpreter","YES")
 ,("Object splitting supported","YES")
 ,("Have native code generator","YES")
 ,("Support SMP","YES")
 ,("Tables next to code","YES")
 ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn")
 ,("Support dynamic-too","YES")
 ,("Support parallel --make","YES")
 ,("Support reexported-modules","YES")
 ,("Support thinning and renaming package flags","YES")
 ,("Uses package keys","YES")
 ,("Dynamic by default","NO")
 ,("GHC Dynamic","YES")
 ,("Leading underscore","NO")
 ,("Debug on","False")
 ,("LibDir","/usr/lib64/ghc-7.10.3")
 ,("Global Package DB","/usr/lib64/ghc-7.10.3/package.conf.d")
 ]
Comment 26 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-25 19:40:51 UTC
*** Bug 642018 has been marked as a duplicate of this bug. ***
Comment 27 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-25 19:41:08 UTC
*** Bug 702556 has been marked as a duplicate of this bug. ***
Comment 28 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-25 19:41:57 UTC
*** Bug 691074 has been marked as a duplicate of this bug. ***
Comment 29 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-25 19:42:04 UTC
*** Bug 691078 has been marked as a duplicate of this bug. ***
Comment 30 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-25 19:42:10 UTC
*** Bug 691082 has been marked as a duplicate of this bug. ***
Comment 31 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-25 19:42:17 UTC
*** Bug 691154 has been marked as a duplicate of this bug. ***
Comment 32 Sergei Trofimovich (RETIRED) gentoo-dev 2021-04-28 18:37:41 UTC
All old ghcs were removed from the tree. All current ones should work as is.