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

Bug 609624

Summary: dev-haskell/socks-0.5.5 - should link to rts/libHSrts-ghc8.0.2.so
Product: Gentoo Linux Reporter: Helmut Jarausch <jarausch>
Component: Current packagesAssignee: Gentoo's Haskell Language team <haskell>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: build log
build log with HCFLAGS=-v
new build log with HCFLAGS=-v

Description Helmut Jarausch 2017-02-17 10:19:43 UTC
Created attachment 464094 [details]
build log

dev-haskell/socks-0.5.5 has lots of missing symbols which seem to be contained in
rts/libHSrts-ghc8.0.2.so or a similar library

A similar problem exists with 
dev-haskell/streaming-commons-0.1.16
dev-haskell/tls-1.3.9
dev-haskell/http-4000.3.5
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2017-02-17 21:45:17 UTC
All haskell libraries are intentionally underlinked against rts.

Such mechanism allows picking vanilla/threaded/debug/eventlog runtimes at final executable linkage stage.

What I don't understand is you should have seen linker errors in every haskell library including ghc itself. Yet these are high-level libraries. Perhaps it's only the ordering issue as arguments are passed to final linking stage.

Do you run ld.gold by chance?

What does `ld --version` report for you?

What does `emerge --info` report?

Try to build one of the packages with 'HCFLAGS=-v'.
It should provide more info on actually failed run of a linker.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2017-02-17 21:48:36 UTC
*** Bug 609580 has been marked as a duplicate of this bug. ***
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2017-02-17 21:53:25 UTC
*** Bug 609576 has been marked as a duplicate of this bug. ***
Comment 4 Helmut Jarausch 2017-02-18 10:48:11 UTC
(In reply to Sergei Trofimovich from comment #1)
> All haskell libraries are intentionally underlinked against rts.
> 
> Such mechanism allows picking vanilla/threaded/debug/eventlog runtimes at
> final executable linkage stage.
> 
> What I don't understand is you should have seen linker errors in every
> haskell library including ghc itself. Yet these are high-level libraries.
> Perhaps it's only the ordering issue as arguments are passed to final
> linking stage.
> 
> Do you run ld.gold by chance?

NO

> What does `ld --version` report for you?

GNU ld (Gentoo 2.27 p1.0) 2.27

> What does `emerge --info` report?

4 # emerge --info dev-haskell/socks
Portage 2.3.3 (python 3.5.2-final-0, default/linux/amd64/13.0/desktop, gcc-6.3.0, glibc-2.25, 4.10.0-rc8 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.10.0-rc8-x86_64-AMD_Phenom-tm-_II_X4_940_Processor-with-gentoo-2.3
KiB Mem:     7903724 total,    101144 free
KiB Swap:    4194300 total,   4193640 free
Timestamp of repository gentoo: Sat, 18 Feb 2017 09:45:01 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.27 p1.0) 2.27
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1::gentoo
dev-lang/python:          2.7.12::gentoo, 3.5.2::gentoo, 3.6.0::gentoo
dev-util/ccache:          3.3.4::gentoo
dev-util/cmake:           3.7.2::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.23.2::gentoo
sys-apps/sandbox:         2.10-r3::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.9.6-r4::gentoo, 1.10.3-r2::gentoo, 1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.4.0-r3::gentoo, 6.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.9::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.informatik.rwth-aachen.de/gentoo-portage
    priority: -1000

java
    location: /usr/local/portage/layman/java
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/java.git
    masters: gentoo
    priority: 50

lisp
    location: /usr/local/portage/layman/lisp
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/lisp.git
    masters: gentoo
    priority: 50

mv
    location: /usr/local/portage/layman/mv
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/user/mv.git
    masters: gentoo
    priority: 50

octave
    location: /usr/local/portage/layman/octave
    sync-type: laymansync
    sync-uri: git://github.com/rafaelmartins/octave-overlay.git
    masters: gentoo
    priority: 50

palemoon
    location: /usr/local/portage/layman/palemoon
    sync-type: laymansync
    sync-uri: https://github.com/deuiore/palemoon-overlay.git
    masters: gentoo
    priority: 50

science
    location: /usr/local/portage/layman/science
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/sci.git
    masters: gentoo
    priority: 50

sunrise
    location: /usr/local/portage/layman/sunrise
    sync-type: laymansync
    sync-uri: git://anongit.gentoo.org/proj/sunrise-reviewed.git
    masters: gentoo
    priority: 50

local
    location: /usr/local/portage
    masters: gentoo
    priority: 99

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-mtune=native -O2 -msse3 -pipe -fPIC"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php7.1/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-mtune=native -O2 -msse3 -pipe -fPIC"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo "
LANG="en_US.iso88591"
LC_ALL=""
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="3dnow 3dnowext 3dnowprefetch X a52 aac acl acpi alsa amd64 avahi berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam ffmpeg fftw firefox flac fortran fuse gcj gdbm gfortran gif gimp glamor gpm gtk gtk3 iconv ipv6 jpeg lapack lcms libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf png policykit ppds python qt qt3support qt4 qt5 readline sdl seccomp session smp spell sqlite sqlite3 sse sse2 sse3 sse4a ssl startup-notification svg tcl tcpd threads tiff tk truetype udev udisks unicode upower usb vorbis wxwidgets x264 xattr xcb xml xulrunner xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow mmx 3dnowext mmxext popcnt sse sse2 sse3 sse4a" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc multiboot" INPUT_DEVICES="keyboard mouse evdev wacom" KERNEL="linux" L10N="en de" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="radeon radeonsi r600" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON



> 
> Try to build one of the packages with 'HCFLAGS=-v'.
> It should provide more info on actually failed run of a linker.

I have attached the corresponding build log
Comment 5 Helmut Jarausch 2017-02-18 10:49:13 UTC
Created attachment 464208 [details]
build log with HCFLAGS=-v
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2017-02-18 12:32:20 UTC
Oh, I see: it's hardened '-no-pie' patch
    https://gitweb.gentoo.org/repo/gentoo.git/commit/dev-lang/ghc?id=8274b84fb061ddcb1318f1ba5625b41b197e6987
that broke shared library support.

Last '-no-pie' occurence cancels '-shared' flag by attempting to build an executable.

Hopefully fixed in ghc as: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c007515ecb55f7791845c59a3b49bd7ee8aa792f

You can either rebuild ghc or edit /usr/bin/ghc and remove 2 options from there:
    '-optc-no-pie -optl-no-pie'

Let's see if it's enough to get you socks-0.5.5 building.
Comment 7 Helmut Jarausch 2017-02-18 20:01:24 UTC
Unfortunately, it still fails.
I have re-emerged ghc. cat /usr/bin/ghc gives
#!/bin/sh
exedir="/usr/lib64/ghc-8.0.2/bin"
exeprog="ghc-stage2"
executablename="$exedir/$exeprog"
datadir="/usr/share"
bindir="/usr/bin"
topdir="/usr/lib64/ghc-8.0.2"
executablename="$exedir/ghc"
exec "$executablename" -B"$topdir"  ${1+"$@"}

Then I have rebuilt packages on which socks depends,
but then building socks fails again.
I have replaced the build log by the current one.
Comment 8 Helmut Jarausch 2017-02-18 20:02:08 UTC
Created attachment 464262 [details]
new build log with HCFLAGS=-v
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2017-02-18 21:59:54 UTC
(In reply to Helmut Jarausch from comment #8)
> Created attachment 464262 [details]
> new build log with HCFLAGS=-v

It means '-no-pie' got persisted somewhere else as well.

Let's try to check rest of haskell packages first:
    fgrep -R 'no-pie' $(ghc --print-global-package-db)/

And gcc PIC/PIE target:
    gcc -dM -E - </dev/null | egrep -i 'pic|pie'
Comment 10 Helmut Jarausch 2017-02-19 11:40:22 UTC
Many thanks, that solved my problems.
 fgrep -R 'no-pie' $(ghc --print-global-package-db)/
showed that dev-haskell/network hasn't been reinstalled with the "new" ghc
from yesterday (2017/02/18).

Having re-emerged this package enables the other packages to emerge without any problems.

Thanks again,
Helmut
Comment 11 Sergei Trofimovich (RETIRED) gentoo-dev 2017-02-19 12:55:09 UTC
Cool!

network is one of rare packages sticking LDFLAGS into .conf files: 
https://github.com/haskell/network/commit/137ed398893523f4d59884ed646f6d3fa79d06b9

Ideally it should not do that but Cabal makes it
a bit hard to pass only a subset of LDFLAGS (-L<...> and -l<...>) cleanly.

My system has only 3 ~bad packages:

$ fgrep -R as-needed .
./network-2.6.3.1-ABFtZSq90Z9BfMXNiqgBoe.conf:ld-options: "-Wl,-O1" "-Wl,--as-needed" "-Wl,--hash-style=gnu"
./cufft-0.1.2.2-HXcV2cGO0Z6FgPdBRhdaKo.conf:ld-options: "-Wl,-O1" "-Wl,--as-needed" "-Wl,--hash-style=gnu"
./X11-1.8-KCXuJxzYJCz57Ju2Daz1Tk.conf:ld-options: "-Wl,-O1" "-Wl,--as-needed" "-Wl,--hash-style=gnu"

None of them has anything substantial in ld-options. I've fixed those two:

network fix: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=45812b2834d5a1b6ed6c81fbb857c57f61a8ef96
x11 fix: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb5ff9547395e9e40536474fa8005ade25528684

Thank you!