Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 536916 - media-libs/mesa-10.3.7[abi_x86_32] - ../../../../src/gallium/auxiliary/.libs/libgallium.a(tgsi_exec.o): In function `micro_imsb': tgsi_exec.c:(.text+0x1ac3): undefined reference to `__clrsbsi2'
Summary: media-libs/mesa-10.3.7[abi_x86_32] - ../../../../src/gallium/auxiliary/.libs/...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Matt Turner
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 530652
  Show dependency tree
 
Reported: 2015-01-17 21:22 UTC by cache
Modified: 2015-02-18 06:34 UTC (History)
2 users (show)

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


Attachments
build.log.tar.xz (build.log.tar.xz,43.28 KB, application/x-xz-compressed-tar)
2015-01-17 21:25 UTC, cache
Details
clr.c (clr.c,98 bytes, text/plain)
2015-01-19 21:41 UTC, Matt Turner
Details
objdump output after clr.c compiling (clr.objdump,8.35 KB, text/plain)
2015-01-20 03:46 UTC, cache
Details
patch (0001-mesa-Check-for-__builtin_clrsb.patch,1.74 KB, patch)
2015-01-23 22:52 UTC, Matt Turner
Details | Diff
objdump output after clr.c compiling with -m32 (clr.objdump.bz2,1.94 KB, application/x-bzip2)
2015-01-24 15:54 UTC, cache
Details

Note You need to log in before you can comment on or make changes to this bug.
Description cache 2015-01-17 21:22:29 UTC
Tried with Mesa 10.3.5, 10.3.5-r1, 10.3.7, gcc 4.8.4 and 4.9.2. If abi_x86_32 use flag disabled, all ok. But I need this use for some x86 binaries.

Reproducible: Always




build log attached



equery u mesa-10.3.7
+abi_x86_32
-bindist
-classic
-debug
+dri3
+egl
+gallium
+gbm
+gles1
+gles2
+llvm
+nptl
+opencl
+openmax
+openvg
+osmesa
-pax_kernel
-pic
+r600-llvm-compiler
+udev
+vdpau
-video_cards_i915
-video_cards_i965
+video_cards_ilo
-video_cards_intel
-video_cards_nouveau
-video_cards_r100
-video_cards_r200
-video_cards_r300
+video_cards_r600
+video_cards_radeon
-video_cards_radeonsi
-video_cards_vmware
+wayland
+xa
+xvmc



emerge --info
Portage 2.2.15 (python 3.4.2-final-0, default/linux/amd64/13.0/no-emul-linux-x86/desktop, gcc-4.9.2, glibc-2.20-r1, 3.18.2-gentoo-b0 x86_64)
=================================================================
System uname: Linux-3.18.2-gentoo-b0-x86_64-Intel-R-_Core-TM-_i7-2820QM_CPU_@_2.30GHz-with-gentoo-2.2
KiB Mem:    16340256 total,   4922020 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Thu, 15 Jan 2015 17:00:01 +0000
sh bash 4.3_p33
ld GNU ld (Gentoo 2.24 p1.4) 2.24
app-shells/bash:          4.3_p33
dev-java/java-config:     2.2.0
dev-lang/perl:            5.20.1-r4
dev-lang/python:          2.7.9-r1, 3.3.5-r1, 3.4.2
dev-util/cmake:           3.0.2
dev-util/pkgconfig:       0.28-r2
sys-apps/baselayout:      2.2
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6-r1, 1.12.6, 1.14.1, 1.15
sys-devel/binutils:       2.24-r3
sys-devel/gcc:            4.9.2
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.4
sys-devel/make:           4.1-r1
sys-kernel/linux-headers: 3.18 (virtual/os-headers)
sys-libs/glibc:           2.20-r1
Repositories: gentoo wavilen sunrise mozilla calculate science bitcoin rion perl-experimental sabayon zugaina x-portage
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA Intel-SDP skype-4.0.0.7-copyright LOKI-EULA Oracle-BCLA-JavaSE cadsoft"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7-avx -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /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"
CPPFLAGS="-march=corei7-avx -O2 -pipe"
CXXFLAGS="-march=corei7-avx -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="ru_RU.UTF-8"
LC_ALL="ru_RU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
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"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/wavilen /var/lib/layman/sunrise /var/lib/layman/mozilla /var/lib/layman/calculate /var/lib/layman/science /var/lib/layman/bitcoin /var/lib/layman/rion /var/lib/layman/perl-experimental /var/lib/layman/sabayon /var/lib/layman/zugaina /usr/local/portage"
USE="7zip X a52 aac acl acpi adns aio alac alsa amd64 ape avahi avx bash-completion berkdb bluetooth bluray boost branding bzip2 cairo cdda cdr cli colord cracklib crypt cryptsetup cups curl custom-cflags custom-optimization cxx dbus dconf development dri dts dvd dvdr emboss encode espeak exif fam ffmpeg fftw firefox flac fontconfig fortran gallium gallium3d gconf gdbm geoip gif gimp glamor gnome gnutls gphoto2 gpm gps gstreamer gtk gtk3 iconv icu idn iec61883 ieee1394 inotify introspection ipc ipv6 jack jemalloc jpeg jpeg2k kerberos lapack laptop lcms ldap libass libcanberra libnotify libsexy libv4l libv4l2 lirc llvm lm_sensors lua lzma mac mad mmx mng modemmanager modplug modules mp3 mp4 mpeg mpi multilib musepack ncurses network networkmanager nls nptl nss ogg opencl openexr opengl openmp openssl openvg pam pango pcre pdf perl pgo pkcs11 png policykit ppds pulseaudio python python3 qt3support quvi readline samba session shorten smi spell spice sse sse2 sse3 sse4 sse4_2 ssh ssl ssse3 startup-notification svg system-cairo system-icu system-jpeg system-libvpx system-sqlite systemd theora threads tiff tls truetype tta udev udisks unicode upower usb v4l v4l2 vaapi vdpau vorbis wavpack wayland webgl wifi wxwidgets x264 xattr xcb xinerama xml xrandr xv xvid xvmc zlib" ABI_X86="64" ALSA_CARDS="hda-intel" 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="adc65 agfa_cl20 aox barbie canon casio_qv clicksmart310 digigr8 digita dimagev dimera3500 directory enigma13 fuji gsmart300 hp215 iclick jamcam jd11 jl2005a kodak_dc120 kodak_dc210 kodak_dc240 kodak_dc3200 kodak_ez200 konica konica_qm150 largan lg_gsm mars mustek panasonic_coolshot panasonic_dc1000 panasonic_dc1580 panasonic_l859 pccam300 pccam600 polaroid_pdc320 polaroid_pdc640 polaroid_pdc700 ptp2 ricoh ricoh_g3 samsung sierra sipix_blink sipix_blink2 sipix_web2 smal sonix sony_dscf1 sony_dscf55 soundvision spca50x sq905 stv0674 stv0680 sx330z template topfield toshiba_pdrm11 ax203 st2205" 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 ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev multitouch" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="nlpsolver presenter-minimizer scripting-beanshell" LINGUAS="ru" LIRC_DEVICES="macmini" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python3_4 python2_7" QEMU_SOFTMMU_TARGETS="x86_64 i386 aarch64 alpha arm cris lm32 m68k microblaze microblazeel mips mips64 mips64el mipsel moxie or32 ppc ppc64 ppcemb s390x sh4 sh4eb sparc sparc64 unicore32 xtensa xtensaeb" QEMU_USER_TARGETS="i386 x86_64 aarch64 alpha arm armeb cris m68k microblaze microblazeel mips mips64 mips64el mipsel mipsn32 mipsn32el or32 ppc ppc64 ppc64abi32 s390x sh4 sh4eb sparc sparc32plus sparc64 unicore32" RUBY_TARGETS="ruby20" SANE_BACKENDS="abaton agfafocus apple artec artec_eplus48u as6e avision bh canon canon630u canon_dr cardscan coolscan coolscan2 coolscan3 dell1600n_net epjitsu epson epson2 fujitsu genesys gt68xx hp hp3500 hp3900 hp4200 hp5400 hp5590 hpljm1005 hpsj5s hs2p ibm kodakaio kvs20xx kvs40xx magicolor leo lexmark ma1509 matsushita microtek microtek2 mustek mustek_usb mustek_usb2 nec niash pie pixma plustek plustek_pp ricoh rts8891 s9036 sceptre sharp sm3600 sm3840 SnapScan sp15c st400 tamarack teco1 teco2 teco3 u12 umax umax1220u umax_pp unsupported xerox_mfp dc210 dc240 dc25 dmc kodak kvs1025 net p5 qcam snapscan stv680" USERLAND="GNU" VIDEO_CARDS="intel ilo radeon r600" 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:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC, USE_PYTHON
Comment 1 cache 2015-01-17 21:25:37 UTC
Created attachment 394220 [details]
build.log.tar.xz
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2015-01-19 07:45:46 UTC
Comment on attachment 394220 [details]
build.log.tar.xz

Why did you put a single file in a tar archive? It's entirely possible to compress a file without doing that.
Comment 3 Chí-Thanh Christopher Nguyễn gentoo-dev 2015-01-19 08:53:31 UTC
Can you try mesa-10.4.2?
Comment 4 cache 2015-01-19 14:53:21 UTC
(In reply to Chí-Thanh Christopher Nguyễn from comment #3)
> Can you try mesa-10.4.2?

I tried it. Same error. Anyway, mesa-10.4.2 from main tree do not have "openvg" USE and thus unusable for me as I am using BricsCAD 13 which want this library.
Comment 5 Matt Turner gentoo-dev 2015-01-19 21:41:13 UTC
Created attachment 394360 [details]
clr.c

The code in question is

static INLINE unsigned
util_last_bit_signed(int i)
{
#if defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 407) && !defined(__INTEL_COMPILER)
   return 31 - __builtin_clrsb(i);
#else
   if (i >= 0)
      return util_last_bit(i);
   else
      return util_last_bit(~(unsigned)i);
#endif
}

It's using __builtin_clrsb if gcc is 4.7 or newer. If I compile this code with gcc-4.9.1 or 4.8.2 I see that it adds a __clrsbdi2 function into the linked binary that is called in place of __builtin_clrsb. I don't have gcc-4.7 to test it, but you're not using that either.

Mesa should be using AX_GCC_BUILTIN in configure to test for this builtin, which it isn't. But also, I'm not sure the use of __builtin_clrsb is correct anyway. I'll handle this upstream.

I've attached a C program. Could you compile it with 'gcc -O2 clr.c -o clr' and then attach the output of 'objdump -d clr' to this bug?

(In reply to cache from comment #4)
> (In reply to Chí-Thanh Christopher Nguyễn from comment #3)
> > Can you try mesa-10.4.2?
> 
> I tried it. Same error. Anyway, mesa-10.4.2 from main tree do not have
> "openvg" USE and thus unusable for me as I am using BricsCAD 13 which want
> this library.

Wow, I didn't know anything actually used that. I'll pass that information along.

The application only uses OpenVG? It can't use OpenGL?
Comment 6 cache 2015-01-20 03:44:13 UTC
> I've attached a C program. Could you compile it with 'gcc -O2 clr.c -o clr'
> and then attach the output of 'objdump -d clr' to this bug?
No problem, attached.

> The application only uses OpenVG? It can't use OpenGL?

It uses OpenGL. My fail, sorry. Wrong interpretation of ldd output. But emerging mesa-10.4.2 failed with same error anyway as I wrote.
Comment 7 cache 2015-01-20 03:46:09 UTC
Created attachment 394372 [details]
objdump output after clr.c compiling
Comment 8 Matt Turner gentoo-dev 2015-01-23 22:52:53 UTC
Created attachment 394734 [details, diff]
patch

Whoops, I should have told you to compile clr.c with -m32. Could you post the objdump output of that?

Also, could you try this patch, either by adding it to your portage tree and modifying the ebuild to apply it, or by

ebuild mesa-10.4.2.ebuild prepare

<manually apply patch to /var/tmp/portage/media-libs/mesa/work/...>

ebuild mesa-10.4.2.ebuild compile
Comment 9 cache 2015-01-24 15:54:49 UTC
Created attachment 394768 [details]
objdump output after clr.c compiling with -m32
Comment 10 cache 2015-01-24 16:02:01 UTC
(In reply to Matt Turner from comment #8)

> Whoops, I should have told you to compile clr.c with -m32. Could you post
> the objdump output of that?

Yep. Attached.

> Also, could you try this patch, either by adding it to your portage tree and
> modifying the ebuild to apply it, or by
> 
> ebuild mesa-10.4.2.ebuild prepare
> 
> <manually apply patch to /var/tmp/portage/media-libs/mesa/work/...>
> 
> ebuild mesa-10.4.2.ebuild compile

I'm doing this right now. Will send a reply after compiling end.
Comment 11 Anthony Basile gentoo-dev 2015-01-27 11:58:26 UTC
pacho asked me to look at this bug wrt powerpc.  I tested clr.c on ppc and ppc64 with gcc-4.8.3 and it works fine there.  Do I need to check for pre 4.7?

Rather than using the gcc builting, its probably safer for mesa to just code this function.  According to the doc, it takes and int (signed) and "Returns the number of leading redundant sign bits in x, i.e. the number of bits following the most significant bit that are identical to it. There are no special cases for 0 or other values."  This seems easy enough and would future proof the code against gcc's ever changing builtings.  No need for AX_GCC_BUITLIN.
Comment 12 Anthony Basile gentoo-dev 2015-01-27 12:02:52 UTC
(In reply to Anthony Basile from comment #11)
> pacho asked me to look at this bug wrt powerpc.  I tested clr.c on ppc and
> ppc64 with gcc-4.8.3 and it works fine there.  Do I need to check for pre
> 4.7?
> 

Never mind.  pacho wanted me to look at another bug on ppc --- I was wondering why he wanted this?

> Rather than using the gcc builting, its probably safer for mesa to just code
> this function.  According to the doc, it takes and int (signed) and "Returns
> the number of leading redundant sign bits in x, i.e. the number of bits
> following the most significant bit that are identical to it. There are no
> special cases for 0 or other values."  This seems easy enough and would
> future proof the code against gcc's ever changing builtings.  No need for
> AX_GCC_BUITLIN.

Ths comment still stands.
Comment 13 cache 2015-01-27 15:15:24 UTC
(In reply to Matt Turner from comment #8)
> Created attachment 394734 [details, diff] [details, diff]
> patch
> 
> Whoops, I should have told you to compile clr.c with -m32. Could you post
> the objdump output of that?
> 
> Also, could you try this patch, either by adding it to your portage tree and
> modifying the ebuild to apply it, or by
> 
> ebuild mesa-10.4.2.ebuild prepare
> 
> <manually apply patch to /var/tmp/portage/media-libs/mesa/work/...>
> 
> ebuild mesa-10.4.2.ebuild compile

Sorry for long delay. Same error after aplying patch on mesa-10.4.2.
Comment 14 Pacho Ramos gentoo-dev 2015-02-02 22:17:43 UTC
@matt, did you had time to contact to upstream? Maybe they could help a bit on this :/ (this is the main blocker for the xorg stabilization and would be interesting to try to handle it or, at least, get help from them). Thanks a lot :)
Comment 15 Matt Turner gentoo-dev 2015-02-03 00:56:06 UTC
(In reply to Pacho Ramos from comment #14)
> @matt, did you had time to contact to upstream? Maybe they could help a bit
> on this :/ (this is the main blocker for the xorg stabilization and would be
> interesting to try to handle it or, at least, get help from them). Thanks a
> lot :)

I am upstream, but without being able to reproduce the issue, I don't know what else I can do. I'll ask around.
Comment 16 Matt Turner gentoo-dev 2015-02-03 01:19:11 UTC
I'm going to send a patch to just remove the use of the built-in. Once it's upstream I'll add it to the ebuild.
Comment 17 Matt Turner gentoo-dev 2015-02-03 21:44:42 UTC
I've added the patch to the 10.3.7 and 10.4.3 ebuilds.

I would really like to understand the cause of this problem though. cache, is there a chance I could SSH into your machine and reproduce the problem?
Comment 18 cache 2015-02-03 23:04:49 UTC
(In reply to Matt Turner from comment #17)
> I've added the patch to the 10.3.7 and 10.4.3 ebuilds.

Where is "right" mesa-10.4.3 available? After layman -S && emerge --sync right now there is only mesa-10.4.2 in portage. 

My overlays are: bitcoin calculate mozilla perl-experimental rion sabayon science sunrise wavilen zugaina.

> I would really like to understand the cause of this problem though. cache,
> is there a chance I could SSH into your machine and reproduce the problem?

Emm… This is my main working machine. Disk clone on KVM virtual machine with ssh access for you acceptable? I can prepare it within 1-2 days.
Comment 19 Chí-Thanh Christopher Nguyễn gentoo-dev 2015-02-03 23:10:44 UTC
The mesa-10.4.3.ebuild was committed Tue Feb 3 21:46:15 2015 UTC
Check the timestamp of your tree according to "emerge --info", if it is earlier then you won't have it.
Comment 20 cache 2015-02-04 00:34:54 UTC
(In reply to Matt Turner from comment #17)
> I've added the patch to the 10.3.7 and 10.4.3 ebuilds.
> 
> I would really like to understand the cause of this problem though. cache,
> is there a chance I could SSH into your machine and reproduce the problem?

mesa-10.4.3 compiled OK. Thank you.
Comment 21 Matt Turner gentoo-dev 2015-02-04 00:39:41 UTC
(In reply to cache from comment #18)
> > I would really like to understand the cause of this problem though. cache,
> > is there a chance I could SSH into your machine and reproduce the problem?
> 
> Emm… This is my main working machine. Disk clone on KVM virtual machine with
> ssh access for you acceptable? I can prepare it within 1-2 days.

Sure, that would work fine. I'll email you with my SSH key.
Comment 22 cache 2015-02-04 00:48:02 UTC
(In reply to Matt Turner from comment #21)
> Sure, that would work fine. I'll email you with my SSH key.

Still need it after succesfull compiling mesa-10.4.3?
Comment 23 Matt Turner gentoo-dev 2015-02-04 01:01:37 UTC
(In reply to cache from comment #22)
> (In reply to Matt Turner from comment #21)
> > Sure, that would work fine. I'll email you with my SSH key.
> 
> Still need it after succesfull compiling mesa-10.4.3?

Yes, the patch is 10.4.3 just disables the use of the __builtin, avoiding the problem but not fixing it.
Comment 24 cache 2015-02-04 01:07:18 UTC
(In reply to Matt Turner from comment #23)
> 
> Yes, the patch is 10.4.3 just disables the use of the __builtin, avoiding
> the problem but not fixing it.

Ok, I'll prepare VM ASAP.
Comment 25 Matt Turner gentoo-dev 2015-02-18 06:34:04 UTC
(In reply to cache from comment #24)
> (In reply to Matt Turner from comment #23)
> > 
> > Yes, the patch is 10.4.3 just disables the use of the __builtin, avoiding
> > the problem but not fixing it.
> 
> Ok, I'll prepare VM ASAP.

Friendly reminder :)