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

Bug 555590

Summary: sys-apps/coreutils-8.23[static] fails to compile: src/libstdbuf.so link throws PIC errors
Product: Gentoo Linux Reporter: Attila Tóth <atoth>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal CC: rene.rheaume
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Attila Tóth 2015-07-22 08:05:16 UTC
CCLD     src/libstdbuf.so
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbeginT.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:7718: recipe for target 'src/libstdbuf.so' failed

I suppose it's hardened related.

Reproducible: Always




Portage 2.2.20 (python 2.7.10-final-0, hardened/linux/amd64/no-multilib, gcc-4.9.3, glibc-2.21-r1, 4.0.8-hardened x86_64)
=================================================================
System uname: Linux-4.0.8-hardened-x86_64-Intel-R-_Core-TM-_i7-2630QM_CPU_@_2.00GHz-with-gentoo-2.2
KiB Mem:     7926812 total,   2035120 free
KiB Swap:   17070076 total,  17070076 free
Timestamp of repository gentoo: Tue, 21 Jul 2015 18:30:01 +0000
sh bash 4.3_p39
ld GNU ld (Gentoo 2.25 p1.2) 2.25
ccache version 3.1.9 [disabled]
app-shells/bash:          4.3_p39::gentoo
dev-java/java-config:     2.2.0::gentoo
dev-lang/perl:            5.22.0::gentoo
dev-lang/python:          2.7.10::gentoo, 3.2.5-r6::gentoo, 3.3.5-r1::gentoo, 3.4.3::gentoo
dev-util/ccache:          3.1.9-r4::gentoo
dev-util/cmake:           3.2.3::gentoo
dev-util/pkgconfig:       0.28-r3::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.6-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.9.6-r4::gentoo, 1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25-r1::gentoo
sys-devel/gcc:            4.7.4::gentoo, 4.8.4::gentoo, 4.9.3::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 3.18::gentoo (virtual/os-headers)
sys-libs/glibc:           2.21-r1::gentoo
Repositories:

dwokfur_local
    location: /usr/local/portage
    masters: gentoo
    priority: 3
    eclass-overrides: hardened-development

dwokfur_public
    location: /home/atoth/public_html/overlay
    masters: gentoo
    priority: 4
    eclass-overrides: hardened-development

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: 5
    eclass-overrides: hardened-development

anarchy
    location: /var/lib/layman/anarchy
    masters: gentoo
    priority: 6
    eclass-overrides: hardened-development

hardened-development
    location: /var/lib/layman/hardened-development
    masters: gentoo
    priority: 7
    eclass-overrides: hardened-development

science
    location: /var/lib/layman/science
    masters: gentoo
    priority: 8
    eclass-overrides: hardened-development

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=native -pipe"
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/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="-O2 -march=native -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://ftp.fsn.hu/pub/linux/distributions/gentoo/ http://gentoo.inode.at/"
LANG="hu_HU.utf8"
LC_ALL="hu_HU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3 -l8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="-4"
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"
PORTAGE_TMPDIR="/var/tmp"
USE="64bit 7zip GNU R X X509 Xaw3d a52 aac aalib acl acpi action_modeswitch addbookmarks adobe-cff aiglx aio airdrop-ng airgraph-ng aisleriot alsa amd64 amr analitza ansi aotuv apache2 apng applet archive ares argyllcms arping asf asm asn1 atahpt atmo attica audio audiofile autoconf-archive automount autoreplace avcodec avformat avs avx awt bash-completion battstat bazaar bcmath bdf beautifulsoup3 berkdb bfio binfilter bitbang_spi bitmap-fonts bittorrent blas bluetooth bogofilter bonobo boost botan branding browserplugin bugzilla buspirate_spi bzip2 bzr cacert cairo calendar canberra canvas caps cblas-external cdaudio cdda cddax cddb cdio cdparanoia cdr cdrom celt chappa chardet charmap checkpath cheese chm cholmod chromaprint clamav clamdtop clang cli client clipboard clockdiff clutter cmdmon coinmp collada color colord combination-explosion-check command-not-found contactnotes context contrib convert convert-mozilla-cookies corefonts coverage cpufreq_bench cracklib cramfs crash-reporter crashreporter crnl-as-line-terminator cron crypt cryptsetup crywrap css cue cups curl cvs cxx datahub dba dbm dbus dcmtk ddate declarative dediprog designer designer-plugin deskbar desktopglobe detex devhelp device-mapper dga dhcp dia dicom dii dirac discard-path divx divx4linux djbfft djvu dlloader dmi dns dot downloads-monitor doxysearch dpi drawing dri dri3 drkaiser dselect dtmf dts dv dvbpsi dvd dvdnav dvdr dvdread dvi dvi2tty dvipdfm eap-sim ebook edd editor eds egl eglfs eigen elfutils emerald enca enchant encode epiphany epspdf epub equalizer evdev evo ewf exif expat exporter extensions extra extraengine extrafilters extras faac faad facebook fallback fam fame fat fax fbosd fcitx fdformat fdk ffmpeg fftw filecaps filter-aaaa finger firefox firefox-bookmarks firmware firmware-loader fits flac flash flashback flatfile flickr floppy fltk fontconfig fontforge fonts foomaticdb force-cgi-redirect fortran fpx freerdp ftdi ftp fuse g3dvl g726 gadu gajim galago gallium gbm gcj gconf gcrypt gd gdal gdata gdb gdbm gdk-pixbuf gdl gdm gdu geany gedit geoloc gif gimp gimpprint ginac git glade glchess gles gles1 glibc glpk gltf gme gmedia gmp gnet gnome gnome-keyring gnome-online-accounts gnome-screensaver gnumeric gnuplot gnutls gold google gopher gpac gpg gphoto2 gpm graph graphics graphviz groupwise grp gs gsf gsl gsm gstreamer gtalk gtk gtk2 gtk3 gtkhtml gtkstyle gudev gui guile h224 h281 h323 handbook hardened hdaps hdf hdf5 hdfview hid2hci highlight history hpack-tools hpcups hpijs hs2-0 html http http2 httpd hub hwdb ibus icedtea7 iconv icu id3tag idle idn iec61883 ieee1394 ilbc imagemagick imaging imap imlib inherit-graph inkjar inotify int-quality int64 internal introspection iodbc ipc iplayer iplsrc iprint iptc ipv6 irc irda ivr jabber jadetex java java6 javascript jbootstrap jce jemalloc jemalloc3 jingle jpeg jpeg2k jrtplib json juju justify kate kde kdepim kdrive keybinder keymap kipi kms kontact kpathsea ktp l10n ladspa lame lapack laptop latex latex3 lcms ldb ldns leaps_timezone lensfun libass libburn libcaca libcanberra libffi libgda libindicate libkms liblockfile libnl libnotify libopts libplot libsamplerate libsecret libssh2 libtar libtiger libv4l2 libvisual lightning live llvm llvm-shared-libs lm_sensors lock log4j logger logitech-mouse loop-aes lto lxde lxpanel lyx lz4 lzma lzo lzw m17n-lib mad map math mathml matio matroska mbim mbox mcal mclib md5sum mdev meanwhile mediawiki memlimit mercurial metapost metis midi mikmod mime miner-fs mjpeg mktemp mmap mmx mmxext mng mobi mobipocket mod mode-owner modplug modules motif mozbranding mozcalendar mp2 mp3 mp4 mpeg mpeg1 mpeg2 mplayer msn mta mtp mudflap mumps musepack mxit mysql mysqli nat native-headset natspec nautilus ncat ncurses ndiff nemesi nepomuk netifrc netlink network networking networkmanager nic3com nicintel nicintel_spi nicnatsemi nicrealtek nifti nls nmap-update nntp nokia nopop3d notification nowlistening nping nptl nsplugin nss nss-pem ntfs ntfsdecrypt ntlm nullok numpy nut nuv oauth oav obex ocr odbc odk office offlinehelp ofx ogg oggvorbis ogm ogp_spi oil okular onaccess oniguruma openal opencore-amr openct opencv openexr opengl openmax openmp openpty openssl optimisememory optreg opus oqgraph orbit oscar osmesa otr pam pam_chroot pam_ssh pam_timestamp pango passwdqc paste64 pasteafter patented pax_kernel pbxt pccts pcmcia pcre pcre16 pcre32 pcsc-lite pda pdf pear perl pgp phc phonon php physfs pic pidgin pie pipes pkcs11 plasma playlist plotutils plugin-autowep plugin-btscan plugin-checksum plugin-doat plugin-dot15d4 plugin-fishlim plugin-ptw plugin-spectools plugin-sysinfo plugins png pnm policykit pony_spi posix postproc postscript ppds pps pptx prevent-removal prison privacy projectm pstricks ptpax publishers pulseaudio pvr pwquality python python2 qalculate qhull qml qpak qt3support qt4 quicktime quotas qwt r600-llvm-compiler rar rarpd raw rawio rc5 rcs rdesktop rdisc rdp readline realmedia reencrypt refclock reiserfs remote remoteosd rendering replytolist review rle rss rtc rtf rtmp ruby19 ruby20 ruby21 ruby22 rule_generator samba sasl satamv satasii sbc sbsms scanner scenarios schroedinger science scim screen script scripting scripttools scsi sdl sdl-sound sdlgfx seccomp secure secure-delete seed semantic-desktop sendmail sendto sensord serprog servletapi session sftp sftplogging shapefile shared shared-dricore shared-glapi shm short-touchpad-timeout showtabbar sid sidebar silc sip sipe sipim skins skype slang smbsharemodes smime smp sms smtp snappy sndfile soap socialweb sockets softstore solver soprano sound soundex soundtouch sourceview sox spam-report spamassassin sparse speex spell spf sql sqlite3 srt srtp sse sse2 sse2check sse3 sse4_1 ssh ssl ssp ssse3 startup-notification static-analyzer statistics stats steam stemmer stun subtitles subversion sudoku sunec svg swat switcher swscale sysgccxml syslog system-cairo system-icu system-jpeg system-libvpx system-sqlite systemd systemd-units systray sysvipc szip t1lib taglib tagsoup tagwriting tbb tcl tcltk tcmalloc tcpd tdls telepathy templates terminal tetex tex4ht texi2html texteffect tftpd tga themes theora thetvdb thin threads threadsafe thumbnail thunar thunderbird tiff tilepath timidity tk tlen tls-heartbeat tokenizer toolame toolbar tools totem tracepath tracker transcode translator trayicon tremor truetype truetype-fonts trust tts tty-helpers twolame type1-fonts type3 udev udis86 udisks umfpack uncommon-eap-types underscores unicode units_cur unlock-notify unstable update-alternatives upnp-av upower urandom urlpicpreview usb userlocales utils uuid v4l v4l2 vaapi vala valgrind vcd vcdinfo vcdx vdpau verify-file video views virus-scan visio vista visualization vlc vlm vnc voice volpack vorbis vpx vtk vxml wad wallpapers wav wavpack wavplay webgl webkit webm webp webphoto webrtc-aec wifi wiki wimax wma wma-fixed wmf wmp wpg wps wxwidgets wxwindows x264 x265 xa xattr xblas xcap xcb xchat xchatdccserver xcos xdm-auth xdmf2 xephyr xetex xface xforms xft xine xkb xlib-xcb xmedcon xml xml2 xmlrpc xmp xmpp xnest xorg xosd xpm xps xscreensaver xsl xtpax xulrunner xv xvfb xvid xvmc yahoo zeitgeist zenmap zip zlib zvbi" ABI_X86="64" ALSA_CARDS="hda-intel" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 sse4_1 sse4_2 avx" CURL_SSL="nss" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc emu" INPUT_DEVICES="keyboard mouse acecad evdev roccat_kone roccat_koneplus roccat_konepure roccat_konextd roccat_kovaplus roccat_pyra roccat_savu roccat_konepureoptical roccat_ryosmk synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer nlpsolver pdfimport" LINGUAS="hu en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby19 ruby20 ruby21 ruby22" SANE_BACKENDS="epson epson2 gt68xx ma1509 mustek mustek_usb mustek_usb2 plustek snapscan umax pnm" USERLAND="GNU" VIDEO_CARDS="radeon r600" XFCE_PLUGINS="battery brightness clock power trash" 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"
USE_PYTHON="2.7 3.4"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Comment 1 Attila Tóth 2015-07-22 08:13:36 UTC
Also: sys-apps/coreutils-8.22-r1 compiles with sys-devel/gcc-4.9.3
Comment 2 René Rhéaume 2015-10-20 01:20:54 UTC
Our fellow vapier had an issue with setbuf some years ago:

http://coreutils.gnu.narkive.com/FUwMO7lI/stdbuf-util-prevents-easy-static-building-of-coreutils
Comment 3 Attila Tóth 2015-10-20 07:58:51 UTC
(In reply to René Rhéaume from comment #2)
> Our fellow vapier had an issue with setbuf some years ago:
> 
> http://coreutils.gnu.narkive.com/FUwMO7lI/stdbuf-util-prevents-easy-static-
> building-of-coreutils

There are workarounds available:
http://askubuntu.com/questions/530617/how-to-make-a-static-binary-of-coreutils
referring to this:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/640734

with an interesting note:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/640734/comments/8
Comment 4 René Rhéaume 2015-11-21 13:43:05 UTC
(In reply to Attila Tóth from comment #3)
> (In reply to René Rhéaume from comment #2)
> 
> There are workarounds available:
> http://askubuntu.com/questions/530617/how-to-make-a-static-binary-of-
> coreutils
> referring to this:
> https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/640734
> 
> with an interesting note:
> https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/640734/comments/8

There is also this bug report, about static linking and PIC, rejected by Jakub Jelinek: https://bugzilla.redhat.com/show_bug.cgi?id=214465
Comment 5 René Rhéaume 2015-11-21 13:57:01 UTC
(In reply to Attila Tóth from comment #3)
> (In reply to René Rhéaume from comment #2)
> 
> There are workarounds available:
> http://askubuntu.com/questions/530617/how-to-make-a-static-binary-of-
> coreutils
> referring to this:
> https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/640734
> 
> with an interesting note:
> https://bugs.launchpad.net/ubuntu/+source/gcc-4.4/+bug/640734/comments/8

There is also this bug report, about static linking and PIC, rejected by Jakub Jelinek: https://bugzilla.redhat.com/show_bug.cgi?id=214465
Comment 6 Magnus Granberg gentoo-dev 2015-11-21 17:49:21 UTC
x86_64-pc-linux-gnu-gcc -std=gnu99   -pipe -O2 -march=core2 -Wl,--as-needed -Wl,-O1 -Wl,--as-needed -static -o src/make-prime-list src/make-prime-list.o  
x86_64-pc-linux-gnu-gcc -std=gnu99 -fPIC   -pipe -O2 -march=core2 -shared -Wl,-O1 -Wl,--as-needed -static -o src/libstdbuf.so src/src_libstdbuf_so-libstdbuf.o  
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbeginT.o: relocation R_X86_64_32 against `__TMC_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/crtbeginT.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
The problem here is that it pass static when it try to build a shared lib (.so)
so it looks like bug in the build system and not a hardened one