Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 412043 - dev-games/ogre-1.7.4: OgreXMLConverter segfaults when enabling the threads USE flag
Summary: dev-games/ogre-1.7.4: OgreXMLConverter segfaults when enabling the threads US...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Games
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 412675
  Show dependency tree
 
Reported: 2012-04-15 01:34 UTC by vax456
Modified: 2013-03-14 16:19 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vax456 2012-04-15 01:34:54 UTC
Enabling the threads USE flag and any of the boost, poco, or tbb USE flags breaks OgreXMLConverter.  

When threads IS NOT enabled, OgreXMLConverter works fine.  Otherwise, it segfaults.

Note that enabling the boost USE flag without the threads USE flag works fine.


Reproducible: Always

Steps to Reproduce:
1. Enable threads with any of the boost, poco, or tbb and recompile.
2. Run OgreXMLConverter on an Ogre XML file.
3. Smash head on keyboard when OgreXMLConverter segfaults.
Actual Results:  
OgreXMLConverter segfaults without converting the XML file to a mesh.

Expected Results:  
OgreXMLConverter should convert the XML file to a mesh.


Portage 2.1.10.49 (default/linux/amd64/10.0/desktop/gnome, gcc-4.5.3, glibc-2.13-r4, 3.2.1-zen+ x86_64)
=================================================================
System uname: Linux-3.2.1-zen+-x86_64-Intel-R-_Core-TM-2_CPU_4400_@_2.00GHz-with-gentoo-2.0.3
Timestamp of tree: Fri, 13 Apr 2012 17:05:01 +0000
ccache version 3.1.6 [enabled]
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.2-r3, 3.2.2-r1
dev-util/ccache:          3.1.6
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.9.9.3
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.10.3, 1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.3 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo gamerlay-stable seden dustin powerman poly-c mistafunk alice rainyday paddymac sunrise x-portage x-gentoo-ogre3d-tools
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/openvpn/easy-rsa"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
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/gamerlay /var/lib/layman/seden /var/lib/layman/dustin /var/lib/layman/powerman /var/lib/layman/poly-c /var/lib/layman/mistafunk /var/lib/layman/alice /var/lib/layman/rainyday /var/lib/layman/paddymac /var/lib/layman/sunrise /usr/local/portage /var/lib/layman/gentoo-ogre3d-tools"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 apm avahi bash-completion berkdb bluetooth branding bzip2 cairo calendar cdda cdr cli colord consolekit cracklib crypt cups cxx dbus declarative dga directfb dri dts dvd dvdr eds emboss encode evo exif extras fam fbcon ffmpeg firefox flac fortran gdbm gdu gif gnome gnome-keyring gnome-online-accounts gnome3 gnutls gpm gstreamer gtk gtk3 iconv introspection ipv6 jack java java6 jpeg jpeg2k lame lcms ldap libgda libnotify lm_sensors mad mmx mng modules mozilla mp3 mp4 mpeg mudflap multilib mysql nautilus ncurses networkmanager nls nptl nptlonly nsplugin ogg openal opengl openmp pam pango pcmcia pcre pdf png policykit ppds pppd pulseaudio python qt3support qt4 readline samba sdl semantic-desktop session smp socialweb spell sql sse sse2 ssl ssse3 startup-notification svg sysfs syslog systemd tcpd theora tiff truetype udev unicode usb vim-syntax vorbis webkit wxwidgets x264 xcb xcomposite xml xorg xscreensaver xulrunner xv xvid 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="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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" DRACUT_MODULES="lvm gensplash plymouth 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" GRUB_PLATFORMS="pc efi-32" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" QEMU_SOFTMMU_TARGETS="i386 x86_64 ppc ppc64" QEMU_USER_TARGETS="i386 x86_64 ppc ppc64" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Vitaly 2012-05-03 18:56:21 UTC
got same thing with +threads.

backtrace:
0x00007ffff77eac60 in Ogre::EdgeListBuilder::buildTrianglesEdges(Ogre::EdgeListBuilder::Geometry const&) () from /usr/lib64/libOgreMain.so.1.7.4
(gdb) bt
#0  0x00007ffff77eac60 in Ogre::EdgeListBuilder::buildTrianglesEdges(Ogre::EdgeListBuilder::Geometry const&) () from /usr/lib64/libOgreMain.so.1.7.4
#1  0x00007ffff77eb4ef in Ogre::EdgeListBuilder::build() ()
   from /usr/lib64/libOgreMain.so.1.7.4
#2  0x00007ffff78af992 in Ogre::Mesh::buildEdgeList() ()
   from /usr/lib64/libOgreMain.so.1.7.4
#3  0x000000000041dc2f in XMLToBinary(XmlOptions) ()
#4  0x0000000000420821 in main ()
Comment 2 Azamat H. Hackimov 2012-05-29 11:58:15 UTC
According Ogre documentation (http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CMake+Quick+Start+Guide&tikiversion=Linux), in Linux available only two threading models:
0 - Threading is disabled
2 - Threading with background resource preparation

Mode 1 (Threading with full background resource loading) in Linux is NOT SUPPORTED. 

OGRE_CONFIG_THREADS is threestate variable. Meantime, in ebuild switch threading only with two - 0 or 1. So we need change this to 0 or 2:

    if use threads ; then
        local f
        for f in poco tbb boost ; do
            use ${f} || continue
            mycmakeargs+=( -DOGRE_CONFIG_THREADS=2 -DOGRE_CONFIG_THREAD_PROVIDER=${f} )
            break
        done
    else
        mycmakeargs+=( -DOGRE_CONFIG_THREADS=0 )
    fi
Comment 3 Azamat H. Hackimov 2012-05-29 15:32:49 UTC
Additionly, error mentonied here http://www.ogre3d.org/mantis/view.php?id=425 is cause of wrong choiced threading model. Patch ogre-1.7.4-threading.patch is useless there.
Comment 4 Julian Ospald 2012-05-30 16:06:00 UTC
(In reply to comment #2)
> According Ogre documentation
> (http://www.ogre3d.org/tikiwiki/tiki-index.
> php?page=CMake+Quick+Start+Guide&tikiversion=Linux), in Linux available only
> two threading models:
> 0 - Threading is disabled
> 2 - Threading with background resource preparation
> 
> Mode 1 (Threading with full background resource loading) in Linux is NOT
> SUPPORTED. 
> 
> OGRE_CONFIG_THREADS is threestate variable. Meantime, in ebuild switch
> threading only with two - 0 or 1. So we need change this to 0 or 2:
> 
>     if use threads ; then
>         local f
>         for f in poco tbb boost ; do
>             use ${f} || continue
>             mycmakeargs+=( -DOGRE_CONFIG_THREADS=2
> -DOGRE_CONFIG_THREAD_PROVIDER=${f} )
>             break
>         done
>     else
>         mycmakeargs+=( -DOGRE_CONFIG_THREADS=0 )
>     fi

Right, that would definitely be cleaner/safer. However I cannot confirm that threading is _ever_ set to "1", meaning "full".

look at the code:
#####
if (OGRE_CONFIG_THREADS EQUAL 0)
	set(_threads "none")
elseif (OGRE_CONFIG_THREADS EQUAL 1)
	set(_threads "full (${OGRE_CONFIG_THREAD_PROVIDER})")
else ()
	set(_threads "background (${OGRE_CONFIG_THREAD_PROVIDER})")
endif ()
#####
since "OGRE_CONFIG_THREADS" is either "ON" or "OFF" it results in one of these:
Threading support:               background (none)
Threading support:               background (boost)
Threading support:               background (poco)
Threading support:               background (tbb)

however that seems to break the following snippet because "ON" does not suffice "GREATER 0":
#####
  if (OGRE_CONFIG_THREADS GREATER 0)
    set(OGRE_CFLAGS "-pthread")
    set(OGRE_ADDITIONAL_LIBS "${OGRE_ADDITIONAL_LIBS} -lpthread")
  endif ()
#####

And that again breaks the pkgconfig files which are missing e.g. "-pthread". Seems no one noticed.
This should do for that particular problem:

-		$(cmake-utils_use threads OGRE_CONFIG_THREADS)
+		$(usex threads "-DOGRE_CONFIG_THREADS=2" "-DOGRE_CONFIG_THREADS=0")

Didn't check the other issue yet.
Comment 5 Julian Ospald 2012-05-30 16:59:11 UTC
plz check if your OgreXMLConverter issue is related to bug

https://bugs.gentoo.org/show_bug.cgi?id=418269
Comment 6 Julian Ospald 2012-05-30 17:51:31 UTC
nah, seems not. OgreXMLConverter is just internal anyway.

I can confirm that issue. Also on mesh -> xml
Comment 7 Mr. Bones. (RETIRED) gentoo-dev 2012-11-01 20:10:49 UTC
still broken with 1.8.1?
Comment 8 Mr. Bones. (RETIRED) gentoo-dev 2013-03-14 04:13:00 UTC
No reply.
Comment 9 Julian Ospald 2013-03-14 16:19:49 UTC
for the book: does not happen with 1.8.1