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

Bug 585698

Summary: dev-lang/perl fails to build with musl and gcc-6
Product: Gentoo Linux Reporter: Felix Janda <felix.janda>
Component: Current packagesAssignee: Gentoo musl team <musl>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 430702, 582084    
Attachments: build.log
Patch for perl-5.22

Description Felix Janda 2016-06-12 13:46:29 UTC
Created attachment 437254 [details]
build.log

dev-lang/perl fails to build with gcc-6.1 (gcc-4.9.3 is ok) on musl
profiles and at least the arm architecture. See attached build.log.

Portage 2.2.28 (python 2.7.11-final-0, hardened/linux/musl/arm/armv7a, gcc-6.1.0, musl-1.1.14-r1, 4.6.0-rc6-00001-gcdfa89d-dirty armv7l)
=================================================================
System uname: Linux-4.6.0-rc6-00001-gcdfa89d-dirty-armv7l-with-gentoo-2.2
KiB Mem:     2034892 total,   1079136 free
KiB Swap:          0 total,         0 free
sh bash 4.3_p42-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p42-r1::gentoo
dev-lang/perl:            5.20.2::gentoo
dev-lang/python:          2.7.11-r2::gentoo, 3.4.3-r7::gentoo
dev-util/cmake:           3.3.1-r1::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.19.1::gentoo
sys-apps/sandbox:         2.10-r99::musl
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.3-r99::musl, 6.1.0::musl
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.3-r99::musl (virtual/os-headers)
sys-libs/musl:            1.1.14-r1::gentoo
Repositories:

tox-overlay
    location: /var/lib/layman/gentoo-overlay-tox
    sync-type: git
    sync-uri: https://github.com/Tox/gentoo-overlay-tox.git
    masters: gentoo
    priority: 2

gentoo
    location: /usr/portage
    sync-type: git
    sync-uri: https://github.com/gentoo/gentoo.git
    priority: 5

musl
    location: /home/felix/Downloads/gentoo-musl
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/proj/musl.git
    masters: gentoo
    priority: 8

local
    location: /home/felix/.usr/portage
    masters: gentoo
    priority: 10

ACCEPT_KEYWORDS="arm"
ACCEPT_LICENSE="* -@EULA"
CBUILD="armv7a-hardfloat-linux-musleabi"
CFLAGS="-O2 -pipe -march=armv7-a -mfloat-abi=hard"
CHOST="armv7a-hardfloat-linux-musleabi"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /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 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
FEATURES="assume-digests binpkg-logs collision-protect 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 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
GENTOO_MIRRORS="http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://mirror.switch.ch/ftp/mirror/gentoo"
INSTALL_MASK="charset.alias /etc/init.d /etc/conf.d /etc/runit /etc/runlevels /usr/lib/systemd /usr/share/locale /usr/share/doc /usr/share/gtk-doc /usr/share/applications"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/portage.exclude"
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="arm armv7l cli cracklib crypt cxx dri fortran hardened iconv libressl minimal modules nptl openmp pax_kernel pcre pic readline seccomp session ssl tcpd threads unicode xattr zlib" 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" ELIBC="musl" 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" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" QEMU_USER_TARGETS="i386 m68k sparc x86_64" RUBY_TARGETS="ruby20 ruby21" SANE_BACKENDS="net" USERLAND="GNU" VIDEO_CARDS="fbdev nouveau" 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, USE_PYTHON
Comment 1 Felix Janda 2016-06-12 13:56:22 UTC
Created attachment 437256 [details, diff]
Patch for perl-5.22

After some debugging it seems that the code violates the strict aliasing
rules (gv and *svp are of different types but point to the same memory.)
so that gcc is allowed to do some optimization leading to the reference
counter being just decremented instead of incremented and subsequently
decremented. This hacky patch makes perl compile for me.

The relevant code is still identical in perl git. I wonder why noone
else seems to have hit this.
Comment 2 Felix Janda 2016-10-16 21:58:55 UTC
With perl-2.24.0-r1 the patch no longer seems necessary.
Comment 3 Felix Janda 2016-10-17 00:56:57 UTC
Actually I cannot reproduce this bug at all with in tree gcc-6.2.0.

perl is supposed to build with -fno-strict-aliasing when non-acient
gcc is detected. For some reason, the compiler I've used before was
not correctly detected by perl's Configure script.