ocaml fails to emerge. Note that I'm not having trouble with any other packages. Reproducible: Always Steps to Reproduce: 1. emerge ocaml Actual Results: ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/findlib.cmx ocamlbuild/findlib.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/ocaml_tools.cmx ocamlbuild/ocaml_tools.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/fda.cmx ocamlbuild/fda.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/ocaml_specific.cmx ocamlbuild/ocaml_specific.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/plugin.cmx ocamlbuild/plugin.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/report.cmx ocamlbuild/report.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/exit_codes.cmx ocamlbuild/exit_codes.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/hooks.cmx ocamlbuild/hooks.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/main.cmx ocamlbuild/main.ml touch ocamlbuild/ocamlbuild_pack.mli ; if ../ocamlcompopt.sh -nostdlib -pack -g -I ocamlbuild ocamlbuild/discard_printf.cmx ocamlbuild/signatures.cmi ocamlbuild/my_std.cmx ocamlbuild/my_unix.cmx ocamlbuild/tags.cmx oc$ x86_64-pc-linux-gnu-ld: -f may not be used without -shared File "ocamlbuild/ocamlbuild_pack.cmx", line 1: Error: Error during partial linking Exit code 1 while executing this command: touch ocamlbuild/ocamlbuild_pack.mli ; if ../ocamlcompopt.sh -nostdlib -pack -g -I ocamlbuild ocamlbuild/discard_printf.cmx ocamlbuild/signatures.cmi ocamlbuild/my_std.cmx ocamlbuild/my_unix.cmx ocamlbuild/tags.cmx $ make[1]: *** [ocamlbuildlib.native] Error 1 make[1]: Leaving directory `/var/tmp/portage/dev-lang/ocaml-4.00.1/work/ocaml-4.00.1' make: *** [opt] Error 2 emake failed Expected Results: emerge succeeds. # emerge --info Portage 2.1.11.31 (default/linux/amd64/10.0, gcc-4.7.2, glibc-2.16.0, 3.6.2-gentoo x86_64) ================================================================= System uname: Linux-3.6.2-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9550_@_2.83GHz-with-gentoo-2.2 Timestamp of tree: Mon, 05 Nov 2012 00:45:01 +0000 ld GNU ld (GNU Binutils) 2.23 distcc 3.1 x86_64-pc-linux-gnu [disabled] ccache version 3.1.8 [enabled] app-shells/bash: 4.2_p39 dev-java/java-config: 2.1.12 dev-lang/python: 2.7.3-r2, 3.2.3-r1 dev-util/ccache: 3.1.8 dev-util/cmake: 2.8.9-r1 dev-util/pkgconfig: 0.27.1 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.11.2 sys-apps/sandbox: 2.6 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.10.3, 1.11.6, 1.12.4 sys-devel/binutils: 2.23 sys-devel/gcc: 4.7.2 sys-devel/gcc-config: 1.7.3 sys-devel/libtool: 2.4.2 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.6 (virtual/os-headers) sys-libs/glibc: 2.16.0 Repositories: gentoo openrc webapp-experimental sabayon sunrise x-portage ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA Intel-SDP" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -flto" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.0/conf /var/spool/munin-async/.ssh" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer -flto" DISTDIR="/usr/portage/distfiles" EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=4.5" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs ccache config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch parallel-install protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch usersandbox webrsync-gpg xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed -flto" LINGUAS="en" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/var/lib/layman/openrc /var/lib/layman/webapps-experimental /var/lib/layman/sabayon /var/lib/layman/sunrise /usr/local/portage" SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage" USE="X a52 aac aacs acl acpi aiglx alsa amd64 amr amrnb amrwb animation apache2 apng artworkextra asf aspnet2 asyncns authdaemond avahi avi bash-completion bcmath berkdb bitmap-fonts bluetooth bluray bmp bonjour bzip2 cairo caps ccache cdda cddb cdparanoia cdr chm cli consolekit cracklib crypt cryptsetup css cups curl cxx daap dbus device-mapper dga dhclient dirac divx4linux dlloader dovecot-sasl dpms dri dts dv dvb dvd dvdr dvdread egl enca encode exif faac fam fame fat fbcondecor fbsplash ffmpeg fftw firefox flac fontconfig foomaticdb fortran freetype ftp gaim gd gdbm geoip gif gimpprint glamor gles glib glibc-omitfp glitz glut gnome gphoto2 gpm gsm gstreamer gstreamer10 gtk gtk2 hardenedphp hbci howl howl-compat https iconv idn imagemagick imap imlib innodb ipv6 java java5 jbig joystick jpeg jpeg2k junit kdehiddenvisibility kvm lapack lcms libfame libkms libnotify libsamplerate libusb lirc live lm_sensors lzma lzo mad maildir mdnsresponder-compat mjpeg mmap mms mmx mmxext mng modules mono motif mozilla mozsvg mp3 mpeg mpeg2 mplayer mudflap multilib musepack mysql mythtv ncurses nemesi network networkmanager nls nptl nptlonly ntfs offensive ofx ogg oggvorbis openal opencl openexr opengl openmp openvg pam pango pcre pdf pdflib perl phonon pic pie png pnp policykit ppd ppds pppd pulseaudio python qt qt3 qt3support qt4 quicktime rar readline resolvconf rtc rtmp samba schroedinger screensaver sctp sdl session sftp sharedmem shout smp sna sni snmp sox speex spell sqlite sse sse2 sse3 ssh ssl ssse3 suspend2 svg tcpd theora threads tiff tls transcode truetype truetype-fonts type-fonts udev udisks unicode unzip upnp ups usb uxa v4l2 vaapi vcd vdpau videos vorbis vpx wayland webdav webkit webservices wifi wmf wv x264 xa xanim xattr xcb xcomposite xinerama xml xml2 xpm xprint xrandr xv xvid xvmc zeroconf zip zlib" ALSA_CARDS="hda-intel" 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 auth_digest proxy proxy_ajp proxy_connect proxy_http reqtimeout cgi" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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 ubx" INPUT_DEVICES="evdev joystick keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" LIRC_DEVICES="userspace" PHP_TARGETS="php5-4" PYTHON_TARGETS="python3_2 python2_7" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="jruby ruby19" USERLAND="GNU" VIDEO_CARDS="intel" 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.2" Unset: CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Created attachment 328388 [details] dev-lang:ocaml-4.00.1:20121105-013322.log
flto is fairly new and might be the cause of this problem as you are experiencing this problem during linking. Please try the following one-line command: FLAGS="${CFLAGS} -fno-lto" CXXFLAGS="${CXXFLAGS} -fno-lto" LDFLAGS="${LDFLAGS} -fno-lto" emerge ocaml
(In reply to comment #2) > flto is fairly new and might be the cause of this problem as you are > experiencing this problem during linking. Please try the following one-line > command: > > FLAGS="${CFLAGS} -fno-lto" CXXFLAGS="${CXXFLAGS} -fno-lto" > LDFLAGS="${LDFLAGS} -fno-lto" emerge ocaml Made no difference - the error is the same. Thanks for the suggestion, though!
and removing flto from all your flags ?
Created attachment 328464 [details] build.log for lto-less CFLAGS and LDFLAGS Removing -flto from LDFLAGS and CFLAGS completely results in a different failure CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer" CHOST="x86_64-pc-linux-gnu" CXXFLAGS="${CFLAGS}" this time, the message is: ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/hooks.cmx ocamlbuild/hooks.ml ../ocamlcompopt.sh -nostdlib -c -g -annot -warn-error A -w L -w R -w Z -I ../otherlibs/unix -for-pack Ocamlbuild_pack -I ocamlbuild -I stdlib -o ocamlbuild/main.cmx ocamlbuild/main.ml touch ocamlbuild/ocamlbuild_pack.mli ; if ../ocamlcompopt.sh -nostdlib -pack -g -I ocamlbuild ocamlbuild/discard_printf.cmx ocamlbuild/signatures.cmi ocamlbuild/my_std.cmx ocamlbuild/my_unix.cmx ocamlbuild/tags.cmx ocamlbuild/display.cmx ocamlbuild/log.cmx ocamlbuild/shell.cmx ocamlbuild/bool.cmx ocamlbuild/glob_ast.cmx ocamlbuild/glob_lexer.cmx ocamlbuild/glob.cmx ocamlbuild/lexers.cmx ocamlbuild/param_tags.cmx ocamlbuild/command.cmx ocamlbuild/ocamlbuild_Myocamlbuild_config.cmx ocamlbuild/ocamlbuild_where.cmx ocamlbuild/slurp.cmx ocamlbuild/options.cmx ocamlbuild/pathname.cmx ocamlbuild/configuration.cmx ocamlbuild/flags.cmx ocamlbuild/hygiene.cmx ocamlbuild/digest_cache.cmx ocamlbuild/resource.cmx ocamlbuild/rule.cmx ocamlbuild/solver.cmx ocamlbuild/report.cmx ocamlbuild/tools.cmx ocamlbuild/fda.cmx ocamlbuild/findlib.cmx ocamlbuild/ocaml_arch.cmx ocamlbuild/ocaml_utils.cmx ocamlbuild/ocaml_dependencies.cmx ocamlbuild/ocaml_compiler.cmx ocamlbuild/ocaml_tools.cmx ocamlbuild/ocaml_specific.cmx ocamlbuild/plugin.cmx ocamlbuild/exit_codes.cmx ocamlbuild/hooks.cmx ocamlbuild/main.cmx -o ocamlbuild/ocamlbuild_pack.cmx ; then rm -f ocamlbuild/ocamlbuild_pack.mli ; else rm -f ocamlbuild/ocamlbuild_pack.mli ; exit 1; fi x86_64-pc-linux-gnu-ld: -f may not be used without -shared File "ocamlbuild/ocamlbuild_pack.cmx", line 1: Error: Error during partial linking Exit code 1 while executing this command: build log attached.
options for compiling..... -O2 -march=native -pipe -fno-lto -D_FILE_OFFSET_BITS=64 -D_REENTRANT options for linking....... -Wl,-O1 -Wl,--as-needed -fno-lto -lm I really meant do not pass anything lto related, neither -flto nor -fno-lto
(In reply to comment #6) > options for compiling..... -O2 -march=native -pipe -fno-lto > -D_FILE_OFFSET_BITS=64 -D_REENTRANT > options for linking....... -Wl,-O1 -Wl,--as-needed -fno-lto -lm > > > > I really meant do not pass anything lto related, neither -flto nor -fno-lto I'm sorry - I thought I did just that, but clearly I did not. After really removing the -flo/-fno-lto options, ocaml emerges successfully. So while I know that -flto isn't supported by Gentoo or much of anyone else (yet), and I don't want to reported an issue against it, but ocaml should emerge with -fno-lto, and if -flto is specified, it should fail for that reason - and not for some other reason. Is the problem in some kind of flag parsing that the ocaml build system is doing, that it probably shouldn't be doing or is doing wrong?
the problem is the raw-ldflags function from flag-o-matic.eclass: it is supposed to transform your LDFLAGS in something than can be passed directly to ld. It does that well for -Wl,* flags, but -flto gets passed as-is, which is not recognized by ld and thus exits with an error.
http://sources.gentoo.org/eclass/flag-o-matic.eclass?r1=1.179&r2=1.180
(In reply to comment #9) > http://sources.gentoo.org/eclass/flag-o-matic.eclass?r1=1.179&r2=1.180 + case ${x} in + -Wl*,) isnt this a typo ? -Wl,* rather ? By the way, the ldflags stuff for ocaml was added not only to respect ldflags, but also because hardened required -nopie, maybe this requirement has changed but now -nopie will also be stripped.
(In reply to comment #10) yes, fixed: http://sources.gentoo.org/eclass/flag-o-matic.eclass?r1=1.180&r2=1.181 hardening in the toolchain is done at the compiler driver level, not binutils. so if you invoke the linker directly (which is wrong, but anyways...), the nopie flag doesn't matter because that's the default ld behavior.
*** Bug 426892 has been marked as a duplicate of this bug. ***