When installing soya with CFLAGS including "-O2" I get module that imports without problem, but all it does is showing black screen/window without actual rendering. Reproducible: Always Steps to Reproduce: 1. Add "-O2" to CFLAGS 2. emerge =dev-python/soya-0.14 3. Run python program that uses soya (e.g. official tutorial) Actual Results: Black window Expected Results: Window with rendered graphics I propose this small patch to ebuild: --- /usr/portage/dev-python/soya/soya-0.14.ebuild 2010-12-26 19:15:01.000000000 +0200 +++ /usr/local/portage/dev-python/soya/soya-0.14-r1.ebuild 2011-03-19 16:17:08.260000004 +0200 @@ -7,7 +7,7 @@ SUPPORT_PYTHON_ABIS="1" RESTRICT_PYTHON_ABIS="3.* *-jython" -inherit distutils eutils +inherit distutils eutils flag-o-matic MY_PV="${PV/_}" MY_P="Soya-${MY_PV}" @@ -45,6 +45,10 @@ epatch "${FILESDIR}/${P}-glu.patch" } +src_configure() { + use amd64 && replace-flags -O[23] -O1 +} + src_install() { distutils_src_install
Here is emerge --info: Portage 2.1.9.42 (default/linux/amd64/10.0/desktop/gnome, gcc-4.4.5, glibc-2.11.3-r0, 2.6.36-gentoo-r5 x86_64) ================================================================= System uname: Linux-2.6.36-gentoo-r5-x86_64-Intel-R-_Core-TM-_i5_CPU_750_@_2.67GHz-with-gentoo-1.12.14 Timestamp of tree: Fri, 11 Mar 2011 21:30:01 +0000 app-shells/bash: 4.1_p9 dev-java/java-config: 2.1.11-r3 dev-lang/python: 2.6.6-r2, 3.1.3-r1 dev-util/cmake: 2.8.4 sys-apps/baselayout: 1.12.14-r1 sys-apps/sandbox: 2.4 sys-devel/autoconf: 2.13, 2.65-r1 sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1 sys-devel/binutils: 2.20.1-r1 sys-devel/gcc: 4.3.4, 4.4.5 sys-devel/gcc-config: 1.4.1 sys-devel/libtool: 2.2.10 sys-devel/make: 3.81-r2 virtual/os-headers: 2.6.36.1 (sys-kernel/linux-headers) ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -march=native -msse4 -mfpmath=sse -mcx16 -msahf -fomit-frame-pointer -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /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 -msse4 -mfpmath=sse -mcx16 -msahf -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="assume-digests binpkg-logs distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" FFLAGS="" GENTOO_MIRRORS="http://mirror.isoc.org.il/pub/gentoo/ ftp://mirror.isoc.org.il/gentoo/ http://files.gentoo.gr ftp://files.gentoo.gr" LANG="C" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LINGUAS="en ru he" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" 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="/var/lib/layman/science /var/lib/layman/gamerlay /usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X a52 aac acl acpi alsa amd64 archive automount bash-completion berkdb blas branding bzip2 cairo cdr cli consolekit cracklib crypt cxx dbus dri dts dvd dvdr emboss encode evo exif fam ffmpeg fftw firefox flac fontconfig fortran gdbm gdu gif gimp git gnome gnome-keyring gnu-plot gpm gstreamer gtk iconv ipv6 java java6 jpeg lapack latex lcms ldap libnotify lm_sensors mad mercurial mikmod mmx mng modules mozilla mp3 mp4 mpeg mpi mudflap multilib nautilus ncurses nls nptl nptlonly nsplugin ogg openal opengl openmp pam pango pcre pdf perl png policykit ppds pppd python readline samba sasl schroedinger sdl session spell sqlite sqlite3 sse sse2 sse3 sse4 sse4a sse4b ssl ssse3 startup-notification subversion svg sysfs tcpd theora threads tiff truetype udev unicode usb v4l v4l2 vim-syntax vorbis x264 xcb xcomposite xemacs xml xorg xulrunner xv xvid 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 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ru he" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fglrx v4l" 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: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Here it works. Maybe the compiler is different (4.5.2), even the architecture is (AMD_Athlon_64 while you have intel). So I can't help really. Maybe you could isolate what is the file in soya that make the difference, between working or not. And maybe you can check what precise optimize option is doing that. Disabling the optimization level without knowing what is, is not serious.
(In reply to comment #2) passing "-O2 -fno-strict-aliasing" produces working code, while "-O2" fails. In fact "-O1 -fstrict-aliasing" also works, so it is some combination of flags. Still strict aliasing seems to be known as causing troubles. I've found this for example: http://www.python.org/dev/peps/pep-3123/ , it describes some way of avoiding the problem in python3. I tried appending "-Wstrict-aliasing" to track down the problem, but this gives endless lines of warnings about breaking strict aliasing.
In many ebuilds I see line: PYTHON_CFLAGS=("2.* + -fno-strict-aliasing") Looks like it does the work
if core python code is broken, core python code should be fixed
Fixed.
Thanks