Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 299061 - dev-lang/ocaml: fail to build with pie enabled gcc.
Summary: dev-lang/ocaml: fail to build with pie enabled gcc.
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Team for the ML programming language family
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-31 08:28 UTC by Hongjiu Zhang
Modified: 2021-01-17 17:39 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---
sping: Bugday+


Attachments
Full build.log (dev-lang:ocaml-3.11.1:20091230-123724.log,226.32 KB, text/plain)
2009-12-31 08:29 UTC, Hongjiu Zhang
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hongjiu Zhang 2009-12-31 08:28:59 UTC
part of build.log:

i686-pc-linux-gnu-gcc -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_i386 -DSYS_linux_elf  -O -O2 -march=native -pipe  -D_FILE_OFFSET_BITS=64 -D_REENTRANT   -c -o natdynlink.o natdynlink.c
i686-pc-linux-gnu-gcc -c -DSYS_linux_elf -o i386.o i386.S || \
        { echo "If your assembler produced syntax errors, it is probably unhappy with the"; echo "preprocessor. Check your assembler, or try producing i386.o by hand."; exit 2; }
rm -f libasmrun.a
ar rc libasmrun.a startup.o main.o fail.o roots.o globroots.o signals.o signals_asm.o misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o lexing.o printexc.o callback.o weak.o compact.o finalise.o custom.o unix.o backtrace.o natdynlink.o i386.o
ranlib libasmrun.a
i686-pc-linux-gnu-gcc -c -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_i386 -DSYS_linux_elf  -pg -O -DPROFILING -O2 -march=native -pipe  -D_FILE_OFFSET_BITS=64 -D_REENTRANT startup.c
i686-pc-linux-gnu-gcc: -pie and -pg|p|profile are incompatible
make[2]: *** [startup.p.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/dev-lang/ocaml-3.11.1/work/ocaml-3.11.1/asmrun'
make[1]: *** [runtimeopt] Error 2
make[1]: Leaving directory `/var/tmp/portage/dev-lang/ocaml-3.11.1/work/ocaml-3.11.1'
make: *** [opt] Error 2
 * ERROR: dev-lang/ocaml-3.11.1 failed:
 *   make opt failed!
 *
 * Call stack:
 *     ebuild.sh, line  54:  Called src_compile
 *   environment, line 2948:  Called die
 * The specific snippet of code:
 *           emake -j1 opt || die "make opt failed!";
 *
 * If you need support, post the output of 'emerge --info =dev-lang/ocaml-3.11.1',
 * the complete build log and the output of 'emerge -pqv =dev-lang/ocaml-3.11.1'.
 * This ebuild used the following eclasses from overlays:
 *   /var/cache/portage/ebuilds/hardened-development/eclass/flag-o-matic.eclass
 * The complete build log is located at '/var/log/portage/dev-lang:ocaml-3.11.1:20091230-123724.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-lang/ocaml-3.11.1/temp/environment'.
 * S: '/var/tmp/portage/dev-lang/ocaml-3.11.1/work/ocaml-3.11.1'

There is a workaround to gcc-config setting nopie as the native compiler and build it, but it should be fixed in the ebuild.

Reproducible: Always




Portage 2.1.7.16 (hardened/linux/x86/10.0, gcc-4.4.2-hardenednopie, glibc-2.11-r1, 2.6.31-zen9 i686)
=================================================================                                   
System uname: Linux-2.6.31-zen9-i686-Genuine_Intel-R-_CPU_T2050_@_1.60GHz-with-gentoo-2.0.1         
Timestamp of tree: Thu, 31 Dec 2009 04:45:02 +0000                                                  
app-shells/bash:     4.0_p35                                                                        
dev-lang/python:     2.6.4, 3.1.1-r1                                                                
dev-util/cmake:      2.8.0                                                                          
sys-apps/baselayout: 2.0.1                                                                          
sys-apps/openrc:     0.6.0                                                                          
sys-apps/sandbox:    2.1                                                                            
sys-devel/autoconf:  2.65                                                                           
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1                                                       
sys-devel/binutils:  2.20                                                                           
sys-devel/gcc-config: 1.4.1                                                                         
sys-devel/libtool:   2.2.6b                                                                         
virtual/os-headers:  2.6.30-r1                                                                      
ACCEPT_KEYWORDS="x86 ~x86"                                                                          
ACCEPT_LICENSE="* -@EULA"                                                                           
CBUILD="i686-pc-linux-gnu"                                                                          
CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"                                               
CHOST="i686-pc-linux-gnu"                                                                           
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"                                          
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/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"                                                     
CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"                                                                                                      
DISTDIR="/var/cache/portage/distfiles"                                                                                                                       
EMERGE_DEFAULT_OPTS="--ask-enter-invalid --nospinner --quiet-build --with-bdeps y"                                                                           
FEATURES="assume-digests buildpkg distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox"                                                                                                                                             
GENTOO_MIRRORS="http://mirrors.163.com/gentoo http://gentoo.aditsu.net"                                                                                      
LANG="zh_TW.UTF-8"                                                                                                                                           
LC_ALL="C"                                                                                                                                                   
LDFLAGS="-Wl,-O1 -Wl,--as-needed"                                                                                                                            
LINGUAS="zh_TW zh af am ar as as_IN ast az be be_BY bg bn bn_BD bn_IN bo br brx bs ca crh cs csb cy da de de_FR dgo dz el en en_CA en_GB en_US en_ZA eo es es_AR es_CL es_CR es_ES es_LA es_MX et et_EE eu fa fi fo fr fr_CA fy fy_NL ga ga_IE gl gu gu_IN he hi hi_IN hne hr hsb hu hy id is it ja ka kk km kn kn_IN ko ko_KR kok ks ku la lb lo lt lv mai mk ml ml_IN mn mni mr mr_IN ms mt my nb nb_NO nds ne nl nn nn_NO no nr ns nso oc or or_IN pa pa_IN pl pt pt_BR pt_PT rm ro ru rw sa_IN sat sd se sh sh_YU si sk sl sq sr sr@latin sr@Latn sr_CS ss st sv sv_SE sw sw_TZ ta ta_IN ta_LK te te_IN tg th ti_ER tk tl tn tr ts uk ur_IN ur_PK uz uz@cyrillic ve vi wa xh zh_CN zh_HK zh_TW zu"                                                                                                           
MAKEOPTS="-j3"                                                                                                                                               
PKGDIR="/var/cache/portage/packages"                                                                                                                         
PORTAGE_COMPRESS=""                                                                                                                                          
PORTAGE_CONFIGROOT="/"                                                                                                                                       
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"                                                                                                                            
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/var/cache/portage/ebuilds/gentoo"
PORTDIR_OVERLAY="/var/cache/portage/ebuilds/gentoo-china /var/cache/portage/ebuilds/kde /var/cache/portage/ebuilds/gentoo-china /var/cache/portage/ebuilds/haskell /var/cache/portage/ebuilds/hardened-development /var/cache/portage/ebuilds/sunrise /var/cache/portage/ebuilds/oss-overlay /var/cache/portage/ebuilds/local"
SYNC="rsync://mirror.averse.net/gentoo-portage"
USE="X a52 aac acl acpi bash-completion berkdb bluetooth branding bzip2 cdr cli consolekit cracklib crypt cscope cups cxx dbus doc dri dts dvd dvdr encode faac fam ffmpeg flac gdbm gif gpm graphite gstreamer hal hardened hscolour iconv ipv6 jpeg jpeg2k kde latex ldap lzma mad mmx mmxext mng modules mp3 mp4 mpeg mplayer mudflap ncurses nls nptl nptlonly nsplugin ogg openexr opengl openmp oss pam pcre pdf perl pic png policykit ppds pppd python qt4 quicktime readline reflection samba sdl semantic-desktop session spell spl sse sse2 ssl startup-notification svg sysfs syslog tcpd theora tiff truetype unicode urandom v4l2 vim-syntax vorbis webkit win32codecs x264 x86 xcomposite xml xorg xv xvid zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="zh_TW zh af am ar as as_IN ast az be be_BY bg bn bn_BD bn_IN bo br brx bs ca crh cs csb cy da de de_FR dgo dz el en en_CA en_GB en_US en_ZA eo es es_AR es_CL es_CR es_ES es_LA es_MX et et_EE eu fa fi fo fr fr_CA fy fy_NL ga ga_IE gl gu gu_IN he hi hi_IN hne hr hsb hu hy id is it ja ka kk km kn kn_IN ko ko_KR kok ks ku la lb lo lt lv mai mk ml ml_IN mn mni mr mr_IN ms mt my nb nb_NO nds ne nl nn nn_NO no nr ns nso oc or or_IN pa pa_IN pl pt pt_BR pt_PT rm ro ru rw sa_IN sat sd se sh sh_YU si sk sl sq sr sr@latin sr@Latn sr_CS ss st sv sv_SE sw sw_TZ ta ta_IN ta_LK te te_IN tg th ti_ER tk tl tn tr ts uk ur_IN ur_PK uz uz@cyrillic ve vi wa xh zh_CN zh_HK zh_TW zu" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="intel"
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Hongjiu Zhang 2009-12-31 08:29:42 UTC
Created attachment 214703 [details]
Full build.log
Comment 2 Magnus Granberg gentoo-dev 2009-12-31 13:32:11 UTC
The compiler hit a check for -pg and -pie in the gcc spec for
-pg mess up the hardened start and endfiles when linking.
A filter-flags -pie in the ebuild should fix tht error.
Comment 3 Mike Williams 2010-01-26 22:36:04 UTC
I've tried adding a "filter-flags -pie", directly after the "append-ldflags -nopie", but it's made no difference.
Neither has the newer version in portage.

It builds fine with the stable hardened gcc (4.3.4), but with gcc-4.4.2-r2 from the hardened-dev overlay it won't.


x86_64-pc-linux-gnu-gcc -c -DSYS_linux -o amd64.o amd64.S || \                                                                                               
        { echo "If your assembler produced syntax errors, it is probably unhappy with the"; echo "preprocessor. Check your assembler, or try producing amd64.o by hand."; exit 2; }                                                                                                                                       
rm -f libasmrun.a                                                                                                                                            
ar rc libasmrun.a startup.o main.o fail.o roots.o globroots.o signals.o signals_asm.o misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o lexing.o printexc.o callback.o weak.o compact.o finalise.o custom.o unix.o backtrace.o natdynlink.o amd64.o                                                                                                      
ranlib libasmrun.a                                                                                                                                           
x86_64-pc-linux-gnu-gcc -c -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE -DTARGET_amd64 -DSYS_linux  -pg -O -DPROFILING -march=opteron -O2 -pipe  -D_FILE_OFFSET_BITS=64 -D_REENTRANT startup.c                                                                                                                            
x86_64-pc-linux-gnu-gcc: -pie and -pg|p|profile are incompatible                                                                                             
make[2]: *** [startup.p.o] Error 1                                                                                                                           
make[2]: Leaving directory `/var/tmp/portage/dev-lang/ocaml-3.11.1/work/ocaml-3.11.1/asmrun'                                                                 
make[1]: *** [runtimeopt] Error 2                                                                                                                            
make[1]: Leaving directory `/var/tmp/portage/dev-lang/ocaml-3.11.1/work/ocaml-3.11.1'                                                                        
make: *** [opt] Error 2                                                                                                                                      



Portage 2.1.6.13 (hardened/linux/amd64/10.0, gcc-4.4.2, glibc-2.10.1-r1, 2.6.21-xen x86_64)
=================================================================                          
System uname: Linux-2.6.21-xen-x86_64-Dual-Core_AMD_Opteron-tm-_Processor_2214-with-gentoo-1.12.13
Timestamp of tree: Sun, 24 Jan 2010 19:00:01 +0000                                                
ccache version 2.4 [disabled]                                                                     
app-shells/bash:     4.0_p35                                                                      
dev-java/java-config: 2.1.9-r2                                                                    
dev-lang/python:     2.6.4                                                                        
dev-util/ccache:     2.4-r7                                                                       
dev-util/cmake:      2.6.4-r3                                                                     
sys-apps/baselayout: 1.12.13                                                                      
sys-apps/sandbox:    1.6-r2                                                                       
sys-devel/autoconf:  2.63-r1                                                                      
sys-devel/automake:  1.9.6-r2, 1.10.2                                                             
sys-devel/binutils:  2.18-r3                                                                      
sys-devel/gcc-config: 1.4.1                                                                       
sys-devel/libtool:   2.2.6b                                                                       
virtual/os-headers:  2.6.27-r2                                                                    
ACCEPT_KEYWORDS="amd64"                                                                           
CBUILD="x86_64-pc-linux-gnu"                                                                      
CFLAGS="-march=opteron -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind /var/qmail/alias /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/eselect/postgresql /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/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 /etc/udev/rules.d"
CXXFLAGS="-march=opteron -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="buildpkg distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages/opteron"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/comodo /usr/portage/local/layman/hardened-development"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl amd64 apache2 bash-completion berkdb bzip2 calendar ccache cgi cjk cli cracklib crypt ctype curl cxx dbm dri expat extraengine fastcgi flv force-cgi-redirect ftp gd gdbm gencertdaily geoip gmp gocr gpm hardened hash hpn hvm iconv idn imagemagick imap ioemu iproute2 ipv6 ithreads jpeg json justify ldap ldirectord logrotate logwatch lvm math memlimit mmx modules mpm-worker mudflap multilib mysql mysqli ncurses nls noauthcram nptl nptlonly ocrad odbc openct openmp pam pcre pdo perl pic png posix postgres pppd pygrub python readline reflection restrict rsync ruby screen server session simplexml smartcard snmp soap sockets spell spl sqlite sse sse2 ssl static-gzip status subversion svg sysfs tcpd tesseract threads tidy tiff tokenizer truetype unicode urandom usb vhosts xattr xen xml xmlreader xmlrpc xmlwriter xorg xsl zip zlib" 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" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="alias auth_basic auth_digest authn_alias authn_anon authn_default authn_file authz_groupfile authz_host authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_connect proxy_http rewrite setenvif so status unique_id usertrack" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 4 Magnus Granberg gentoo-dev 2010-04-04 14:57:01 UTC
Adding filter-flags -fPIE to the ebuild before the append-ldflags -nopie
works fine for me.

laptop1 / # emerge --info
Portage 2.2_rc62 (hardened/linux/amd64/10.0, gcc-4.4.3, glibc-2.11-r0, 2.6.32-gentoo-r3 x86_64)
=================================================================                              
System uname: Linux-2.6.32-gentoo-r3-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7700_@_2.40GHz-with-gentoo-2.0.1
Timestamp of tree: Wed, 31 Mar 2010 13:15:01 +0000                                                      
ccache version 2.4 [disabled]                                                                           
app-shells/bash:     4.0_p33                                                                            
dev-java/java-config: 2.1.9-r1                                                                          
dev-lang/python:     2.5.4-r3, 2.6.3, 3.1.1-r1                                                          
dev-util/ccache:     2.4-r8                                                                             
dev-util/cmake:      2.6.4-r3                                                                           
sys-apps/baselayout: 2.0.1                                                                              
sys-apps/openrc:     0.5.1-r1                                                                           
sys-apps/sandbox:    2.2                                                                                
sys-devel/autoconf:  2.13, 2.63-r1                                                                      
sys-devel/automake:  1.5, 1.8.5-r3, 1.9.6-r2, 1.10.2, 1.11                                              
sys-devel/binutils:  2.20                                                                               
sys-devel/gcc:       3.4.6-r2, 4.3.4-r2, 4.4.3                                                          
sys-devel/gcc-config: 1.4.1                                                                             
sys-devel/libtool:   2.2.6b                                                                             
virtual/os-headers:  2.6.30-r1  
Comment 5 Alexis Ballier gentoo-dev 2010-05-25 11:36:32 UTC
(In reply to comment #3)
> x86_64-pc-linux-gnu-gcc -c -I../byterun -DCAML_NAME_SPACE -DNATIVE_CODE
> -DTARGET_amd64 -DSYS_linux  -pg -O -DPROFILING -march=opteron -O2 -pipe 
> -D_FILE_OFFSET_BITS=64 -D_REENTRANT startup.c                                   
> x86_64-pc-linux-gnu-gcc: -pie and -pg|p|profile are incompatible                

I see no -pie here so that's probably your gcc specs that are broken because of that new check, these should be updated and are not related to ocaml.
Comment 6 Xake 2010-05-25 12:20:27 UTC
(In reply to comment #5)
> I see no -pie here so that's probably your gcc specs that are broken because of
> that new check, these should be updated and are not related to ocaml.
> 

Eh, you should still filter pie in cflags, because both GCC and ld assumes that pic/pie is used both while compiling and linking, else unexpected behaviours can appere (textrels on x86 and failing compilation on amd64). Currently I cannot make this build on my amd64 system without filtering pie from cflags (and the same seems to go for zorry).


(In reply to comment #3)
> I've tried adding a "filter-flags -pie", directly after the "append-ldflags
> -nopie", but it's made no difference.
> Neither has the newer version in portage.
> 

When did you last resync your portage tree and your overlay and have you retried since that?
Comment 7 Magnus Granberg gentoo-dev 2010-05-27 13:45:19 UTC
It should work now with the new updated pie patches and specs in the overlay.
Comment 8 Alexey Kretov 2015-04-25 06:46:33 UTC
Probably 
 ocaml-4.02.1.ebuild
37c37
<               append-ldflags -nopie
---
>               append-cflags -nopie
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-01-17 17:39:56 UTC
This should be fine now. Let us know if it's not.