Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 313729

Summary: media-sound/mpg123-1.10.1 doesn't honor sse,mmx,3dnow USE flag
Product: Gentoo Linux Reporter: Shark <shark>
Component: New packagesAssignee: Gentoo Sound Team <sound>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: mpg123 ebuild with enabled asm optimizations

Description Shark 2010-04-07 19:03:32 UTC
I've always compiled mpg123 with USE="3dnow 3dnowext alsa mmx sse" but today i've noticed that the list of builtin decoders only shows "generic_fp" instead of SSE,3dnow. Seems that the ebuild will set --with-cpu= to generic even if the USE flags are set. 

Reproducible: Always
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2010-04-07 19:08:24 UTC
Works fine here on amd64, the logic is similar on x86, so don't see how that could fail. Post `emerge --info`, emerge -pv mpg123, and full build.log

Example of working setup,

[ebuild   R   ] media-sound/mpg123-1.10.1  USE="alsa ipv6 network sdl sse (-3dnow) (-3dnowext) (-altivec) -jack (-mmx) -nas -oss -portaudio -pulseaudio" 0 kB

./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu 
[ .. ]
default-audio=alsa --with-cpu=x86-64 --enable-network --enable-ipv6
Comment 2 Shark 2010-04-07 22:59:32 UTC
I was looking quickly at the ebuild, 

46     if [[ ${ABI} = x86 ]]; then
47         _cpu=i586
48         use mmx && _cpu=mmx
49         use 3dnow && _cpu=3dnow
50         use sse && _cpu=x86
51         use 3dnowext && _cpu=x86

Maybe _cpu should be set to sse and not x86 on line 50? Same goes for 3dnowext in the next line. Tomorrow i will post the emerge --info and the other logs as requested.
Comment 3 Shark 2010-04-08 10:33:17 UTC
With the correct _cpu in the ebuild, mpg123 compiles with the correct optimizations:
config.status: executing libtool commands

  mpg123 1.10.1

  Install path ............ /usr
  CPU Optimisation......... sse
  Compiler Optimization ... 0
...

The only problem with the ebuild is that mpg123 will be compiled with only one cpu-type even if multiple USE flags has been set. In may case (athlon-xp) sse is faster than 3dnowext so i've moved sse to the last line. 
Comment 4 Shark 2010-04-08 10:35:18 UTC
Created attachment 226983 [details]
mpg123 ebuild with enabled asm optimizations
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2010-04-08 10:43:09 UTC
"--with-cpu=x86   Pack all x86 opts into one binary"

so with USE "sse" or "3dnowext" all of the optimizations are enabled, your patch would reduce the opts, rather than add them. I chose this method over one single "enable-all-optimizations" USE flag because if you have a CPU with 3dnowext or sse, you also have 3dnow and mmx, so it makes sense to grab them all then.
Comment 6 Shark 2010-04-08 10:57:01 UTC
You're 100% right, i've noticed that ${ABI} isn't set here, only ${ARCH}, i think it's the origin of my problem. Who should exports ${ABI}?   
Comment 7 Samuli Suominen (RETIRED) gentoo-dev 2010-04-25 13:33:04 UTC
reopen, too many bugs for same issue
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2010-04-25 13:33:23 UTC

*** This bug has been marked as a duplicate of bug 295075 ***