Help - Search - Members - Calendar
Full Version: processor specific build of lame -- how to?
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
bluesky
I've been trying to compile lame on mingw 3.2.0-rc3 and msys 1.0.11 on my win32 machine. I also added nasmw.exe and ndisasmw.exe to my C:\msys\1.0\mingw\bin dir. Anyway, here is the code I'be been using to get an "athlon xp optimized" build of lame:

CODE
$ ./configure --prefix=/mingw --enable-nasm --disable-gtktest --disable-decoder CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer -fsched-spec-load -fforce-addr -mtune=athlon-xp" CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer-fsched-spec-load -fforce-addr -mtune=athlon-xp"
$ make
$ make install


It gives me lame.exe okay, but when I compare the output to the icl version of lame I got from rarewares.org, mine seems to be lacking the "CPU features: MMX (ASM used), 3DNow! (ASM used), SSE" line that the intel build has... here's the output from my build:

CODE
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding 06_Aint it Fun.wav to 06_Aint it Fun.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3


And here's the output from the ICL build from rarewares.org:

CODE
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE
Using polyphase lowpass filter, transition band: 17249 Hz - 17782 Hz
Encoding 06_Aint it Fun.wav to 06_Aint it Fun.wav.mp3
Encoding as 44.1 kHz 128 kbps j-stereo MPEG-1 Layer III (11x) qval=3


What am I doing wrong?

Thanks!
Yaztromo
Cant answer your main question. But just to note that -ffast-math can cause inaccuarcies in complex calulcations. So may affect audio quality.

See http://www.audiocoding.com/modules/newbb/v..._id=175&forum=3

There are other similar warnings about this flag on the net, have a look around.
Gabriel
I think that ./configure is looking for nasm and not for nasmw.
bluesky
Yeah, I meant to type "nasmw" in there, my mistake in the post. I have nasmw installed in c:\msys\1.0\mingw\bin and I used "nasmw" in my commandline (edited original post). Any other ideas?
Garf
--enable-nasmw won't work --- the options are hardcoded and configure won't magically guess that you mean that your assembler happens to have another name and that you want to enable it

you really want --enable-nasm and rename nasmw.exe to nasm.exe
bluesky
renamed nasmw.exe to nasm.exe and did a:

CODE
$ ./configure --prefix=/mingw --enable-nasm --disable-gtktest --disable-decoder CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer -fsched-spec-load -fforce-addr -mtune=athlon-xp" CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer-fsched-spec-load -fforce-addr -mtune=athlon-xp"


no errors from that. Then I issued a "$ make" and got the following:

CODE
$ make
make  all-recursive
make[1]: Entering directory `/home/squishy/lame-3.96.1'
Making all in mpglib
make[2]: Entering directory `/home/squishy/lame-3.96.1/mpglib'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/squishy/lame-3.96.1/mpglib'
Making all in libmp3lame
make[2]: Entering directory `/home/squishy/lame-3.96.1/libmp3lame'
Making all in i386
make[3]: Entering directory `/home/squishy/lame-3.96.1/libmp3lame/i386'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/squishy/lame-3.96.1/libmp3lame/i386'
make[3]: Entering directory `/home/squishy/lame-3.96.1/libmp3lame'
make[3]: Nothing to be done for `all-am'.
make[3]: Leaving directory `/home/squishy/lame-3.96.1/libmp3lame'
make[2]: Leaving directory `/home/squishy/lame-3.96.1/libmp3lame'
Making all in frontend
make[2]: Entering directory `/home/squishy/lame-3.96.1/frontend'
/bin/sh ../libtool --mode=link gcc  -Wall -pipe -march=athlon-xp -O3 -pipe -fomit-frame-pointer -fsched-spec-load -fforce-addr -mtune=athlon-xp    -static -o lame.exe  main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o ../libmp3lame/libmp3lame.la -lm -lwsock32
gcc -Wall -pipe -march=athlon-xp -O3 -pipe -fomit-frame-pointer -fsched-spec-load -fforce-addr -mtune=athlon-xp -o lame.exe main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o  ../libmp3lame/.libs/libmp3lame.a -lm -lwsock32
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x15b5):util.c: undefined reference to `has_MMX_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x15c5):util.c: undefined reference to `has_3DNow_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x15d5):util.c: undefined reference to `has_SSE_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x15e5):util.c: undefined reference to `has_SSE2_nasm'
../libmp3lame/.libs/libmp3lame.a(takehiro.o)(.text+0x19f2):takehiro.c: undefined reference to `choose_table_MMX'
../libmp3lame/.libs/libmp3lame.a(fft.o)(.text+0x620):fft.c: undefined reference to `fht_3DN'
collect2: ld returned 1 exit status
make[2]: *** [lame.exe] Error 1
make[2]: Leaving directory `/home/squishy/lame-3.96.1/frontend'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/lame-3.96.1'
make: *** [all] Error 2


I don't think it liked that I renamed nasmw.exe to nasm.exe... any ideas?
Garf
Hmm, configure probably *did* find nasm now, and tried to build with assembly, whereas it wasn't doing that before. I don't know why *that* failed, though.
john33
I could be completely wrong here as I know next to nothing about configure, but having had a quick look at it, it seems to me that the nasm options are not set correctly unless you are using this with Cygwin. But, as I say, I could be completely wrong. unsure.gif
bluesky
I have no idea... until now, the only things I've compiled required me to do a simple ./configure make make install.

I figured a lot of people would be building lame with mingw.

Maybe I should download the 30-day trial of ICL? Anyone know where I can d/l it from and if I do, can someone walk me through using it to make processor specific builds of lame?
robert
well, after configuration search for NASMFLAGS in libmp3lame/i386/Makefile and replace -f elf with -f win32 -DWIN32
bluesky
QUOTE(robert @ Jan 28 2005, 01:07 AM)
well, after configuration search for NASMFLAGS in libmp3lame/i386/Makefile and replace -f elf with -f win32 -DWIN32
*



OK... I did my configure:

CODE
$ ./configure --prefix=/mingw --enable-nasm --disable-gtktest --disable-decoder
CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer -fsched-spec-load -ffo
rce-addr -mtune=athlon-xp" CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-po
inter-fsched-spec-load -fforce-addr -mtune=athlon-xp"


Then I looked for "NASMFLAGS" in C:\msys\1.0\home\squishy\lame-3.96.1\mpglib\MakeFile but I didn't find it at all. When I searched for "elf" I found one entry:

CODE
NASM_FORMAT = -f elf


Which I changed to:

CODE
NASM_FORMAT = -f win32 -DWIN32


Then I did my "make" which errored out. Here is the last portion of the log (entire log is very large but I can post if it'll help):

CODE
gcc -Wall -pipe -march=athlon-xp -O3 -pipe -fomit-frame-pointer -fsched-spec-load -fforce-addr -mtune=athlon-xp -o lame.exe main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o  ../libmp3lame/.libs/libmp3lame.a -lm -lwsock32
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x1841):util.c: undefined reference to `has_MMX_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x1851):util.c: undefined reference to `has_3DNow_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x1861):util.c: undefined reference to `has_SSE_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x1871):util.c: undefined reference to `has_SSE2_nasm'
../libmp3lame/.libs/libmp3lame.a(takehiro.o)(.text+0x1ae2):takehiro.c: undefined reference to `choose_table_MMX'
../libmp3lame/.libs/libmp3lame.a(fft.o)(.text+0x70d):fft.c: undefined reference to `fht_3DN'
collect2: ld returned 1 exit status
make[2]: *** [lame.exe] Error 1
make[2]: Leaving directory `/home/squishy/lame-3.96.1/frontend'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/lame-3.96.1'
make: *** [all] Error 2
bluesky
Well, I was able to successfully compile xvid 1.0.3 by using the following:

CODE
$ ./configure CFLAGS="-march=athlon-xp -Wall -fstrength-reduce -finline-functions -freduce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args fprefetch-loop-arrays -mtune=athlon-xp";


So i tried using these set of options on lame. As usual, the configure went just fine. Again, when I did my "make" command, I got errors:

Last part of log:

CODE
fi
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I. -I../mpglib/ -I.. -Wall -pipe -march=athlon-xp -Wall -fstrength-reduce -finline-functions -freduce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -fprefetch-loop-arrays -mtune=athlon-xp -MT mpglib_interface.lo -MD -MP -MF .deps/mpglib_interface.Tpo -c mpglib_interface.c  -DDLL_EXPORT -DPIC -o .libs/mpglib_interface.o
mpglib_interface.c:13:23: interface.h: No such file or directory
mpglib_interface.c:21: error: syntax error before "mp"
mpglib_interface.c:21: warning: type defaults to `int' in declaration of `mp'
mpglib_interface.c:21: warning: data definition has no type or storage class
mpglib_interface.c:22: error: syntax error before '*' token
mpglib_interface.c:22: warning: type defaults to `int' in declaration of `mpg123_pinfo'
mpglib_interface.c:22: warning: data definition has no type or storage class
mpglib_interface.c: In function `lame_decode_exit':
mpglib_interface.c:27: warning: implicit declaration of function `ExitMP3'
mpglib_interface.c: In function `lame_decode_init':
mpglib_interface.c:35: warning: implicit declaration of function `InitMP3'
mpglib_interface.c: At top level:
mpglib_interface.c:72: error: syntax error before "unsigned"
mpglib_interface.c: In function `lame_decode1_headersB_clipchoice':
mpglib_interface.c:106: error: request for member `header_parsed' in something not a structure or union
mpglib_interface.c:106: error: request for member `fsizeold' in something not a structure or union
mpglib_interface.c:106: error: request for member `framesize' in something not a structure or union
mpglib_interface.c:108: error: request for member `fr' in something not a structure or union
mpglib_interface.c:109: error: `freqs' undeclared (first use in this function)
mpglib_interface.c:109: error: (Each undeclared identifier is reported only once
mpglib_interface.c:109: error: for each function it appears in.)
mpglib_interface.c:109: error: request for member `fr' in something not a structure or union
mpglib_interface.c:110: error: request for member `fr' in something not a structure or union
mpglib_interface.c:111: error: request for member `fr' in something not a structure or union
mpglib_interface.c:112: error: request for member `fr' in something not a structure or union
mpglib_interface.c:112: error: request for member `fr' in something not a structure or union
mpglib_interface.c:116: error: request for member `fsizeold' in something not a structure or union
mpglib_interface.c:117: error: request for member `fsizeold' in something not a structure or union
mpglib_interface.c:119: error: request for member `framesize' in something not a structure or union
mpglib_interface.c:120: error: request for member `framesize' in something not a structure or union
mpglib_interface.c:124: error: `tabsel_123' undeclared (first use in this function)
mpglib_interface.c:124: error: request for member `fr' in something not a structure or union
mpglib_interface.c:124: error: request for member `fr' in something not a structure or union
mpglib_interface.c:124: error: request for member `fr' in something not a structure or union
mpglib_interface.c:128: error: request for member `num_frames' in something not a structure or union
mpglib_interface.c:130: error: request for member `num_frames' in something not a structure or union
mpglib_interface.c:131: error: request for member `num_frames' in something not a structure or union
mpglib_interface.c:132: error: request for member `enc_delay' in something not a structure or union
mpglib_interface.c:133: error: request for member `enc_padding' in something not a structure or union
mpglib_interface.c:138: error: `MP3_OK' undeclared (first use in this function)
mpglib_interface.c:139: error: request for member `fr' in something not a structure or union
mpglib_interface.c:146: error: `sample_t' undeclared (first use in this function)
mpglib_interface.c:146: error: `pcm_l' undeclared (first use in this function)
mpglib_interface.c:146: error: syntax error before ')' token
mpglib_interface.c:146: error: `FLOAT8' undeclared (first use in this function)
mpglib_interface.c:146: error: `p_samples' undeclared (first use in this function)
mpglib_interface.c:146: error: syntax error before ')' token
mpglib_interface.c:155: error: syntax error before ')' token
mpglib_interface.c:155: error: syntax error before ')' token
mpglib_interface.c:155: error: `pcm_r' undeclared (first use in this function)
mpglib_interface.c:165: error: `MP3_NEED_MORE' undeclared (first use in this function)
mpglib_interface.c:171: error: `MP3_ERR' undeclared (first use in this function)
mpglib_interface.c: In function `lame_decode1_headersB':
mpglib_interface.c:193: error: `decodeMP3' undeclared (first use in this function)
mpglib_interface.c: At top level:
mpglib_interface.c:201: error: syntax error before "sample_t"
mpglib_interface.c: In function `lame_decode1_unclipped':
mpglib_interface.c:203: error: `FLOAT8' undeclared (first use in this function)
mpglib_interface.c:207: error: `buffer' undeclared (first use in this function)
mpglib_interface.c:207: error: `len' undeclared (first use in this function)
mpglib_interface.c:207: error: `pcm_l' undeclared (first use in this function)
mpglib_interface.c:207: error: `pcm_r' undeclared (first use in this function)
mpglib_interface.c:207: error: `decodeMP3_unclipped' undeclared (first use in this function)
make[3]: *** [mpglib_interface.lo] Error 1
make[3]: Leaving directory `/home/squishy/lame-3.96.1/libmp3lame'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/squishy/lame-3.96.1/libmp3lame'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/lame-3.96.1'
make: *** [all] Error 2


Any what's wrong?
robert
the compiler does not have lame/mpglib in its list for include files. simple fix: edit libmp3lame/mpglib_interface.c line 13 to #include "../mpglib/interface.h"
bluesky
I changed:

CODE
#include "interface.h"

to

CODE
#include "../mpglib/interface.h"


Then did the same configure with options in my last post, followed by a "make" and a "make install".

It work without errors! Thanks for your help trouble-shooting this!

Now... can you explain why my builds lack the "CPU features: MMX (ASM used), 3DNow! (ASM used), SSE" line that the intel build has.

My build:
CODE
D:\Incoming\junk>lame.exe test.wav --alt-preset extreme
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding test.wav to test.wav.mp3
Encoding as 44.1 kHz VBR(q=0) j-stereo MPEG-1 Layer III (ca. 5.7x) qval=3
   Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
10798/10800 (100%)|    0:37/    0:37|    0:37/    0:37|   7.5565x|    0:00
32 [   80] **
128 [   37] %
160 [  386] %%%%%**
192 [ 4135] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%********
224 [ 3741] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%**********
256 [ 1571] %%%%%%%%%%%%%%%%%%%%%%%***
320 [  850] %%%%%%%%%%%%%*
average: 219.9 kbps   LR: 9182 (85.02%)   MS: 1618 (14.98%)

Writing LAME Tag...done
ReplayGain: -6.5dB


ICL from rarewares.org build:

CODE
D:\Incoming\junk>lame-icl4.5 test.wav --alt-preset extreme
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding test.wav to test.wav.mp3
Encoding as 44.1 kHz VBR(q=0) j-stereo MPEG-1 Layer III (ca. 5.7x) qval=3
   Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
10798/10800 (100%)|    0:30/    0:30|    0:30/    0:30|   9.2246x|    0:00
32 [   80] **
128 [   38] %
160 [  406] %%%%%%*
192 [ 4055] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%********
224 [ 3806] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%***********
256 [ 1578] %%%%%%%%%%%%%%%%%%%%%%%***
320 [  837] %%%%%%%%%%%%%*
average: 219.9 kbps   LR: 9182 (85.02%)   MS: 1618 (14.98%)

Writing LAME Tag...done
ReplayGain: -6.5dB
robert
your last post configure lacks the "--enable-nasm" switch
bluesky
True...

I did:

CODE
$ make clean
$ ./configure --enable-nasm CFLAGS="-march=athlon-xp -Wall -fstrength-reduce -finline-functions -freduce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args fprefetch-loop-arrays -mtune=athlon-xp";


No errors there. Then I did the "make" and got erros (last part of log):

CODE
interface.Tpo" \
 -c -o mpglib_interface.lo `test -f 'mpglib_interface.c' || echo './'`mpglib_interface.c; \
then mv -f ".deps/mpglib_interface.Tpo" ".deps/mpglib_interface.Plo"; \
else rm -f ".deps/mpglib_interface.Tpo"; exit 1; \
fi
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I. -I../mpglib/ -I.. -O3 -ffast-math -funroll-loops -maccumulate-outgoing-args -Wall -pipe -MT mpglib_interface.lo -MD -MP -MF .deps/mpglib_interface.Tpo -c mpglib_interface.c  -DDLL_EXPORT -DPIC -o .libs/mpglib_interface.o
mpglib_interface.c:13:23: interface.h: No such file or directory
mpglib_interface.c:21: error: syntax error before "mp"
mpglib_interface.c:21: warning: type defaults to `int' in declaration of `mp'
mpglib_interface.c:21: warning: data definition has no type or storage class
mpglib_interface.c:22: error: syntax error before '*' token
mpglib_interface.c:22: warning: type defaults to `int' in declaration of `mpg123_pinfo'
mpglib_interface.c:22: warning: data definition has no type or storage class
mpglib_interface.c: In function `lame_decode_exit':
mpglib_interface.c:27: warning: implicit declaration of function `ExitMP3'
mpglib_interface.c: In function `lame_decode_init':
mpglib_interface.c:35: warning: implicit declaration of function `InitMP3'
mpglib_interface.c: At top level:
mpglib_interface.c:72: error: syntax error before "unsigned"
mpglib_interface.c: In function `lame_decode1_headersB_clipchoice':
mpglib_interface.c:106: error: request for member `header_parsed' in something not a structure or union
mpglib_interface.c:106: error: request for member `fsizeold' in something not a structure or union
mpglib_interface.c:106: error: request for member `framesize' in something not a structure or union
mpglib_interface.c:108: error: request for member `fr' in something not a structure or union
mpglib_interface.c:109: error: `freqs' undeclared (first use in this function)
mpglib_interface.c:109: error: (Each undeclared identifier is reported only once
mpglib_interface.c:109: error: for each function it appears in.)
mpglib_interface.c:109: error: request for member `fr' in something not a structure or union
mpglib_interface.c:110: error: request for member `fr' in something not a structure or union
mpglib_interface.c:111: error: request for member `fr' in something not a structure or union
mpglib_interface.c:112: error: request for member `fr' in something not a structure or union
mpglib_interface.c:112: error: request for member `fr' in something not a structure or union
mpglib_interface.c:116: error: request for member `fsizeold' in something not a structure or union
mpglib_interface.c:117: error: request for member `fsizeold' in something not a structure or union
mpglib_interface.c:119: error: request for member `framesize' in something not a structure or union
mpglib_interface.c:120: error: request for member `framesize' in something not a structure or union
mpglib_interface.c:124: error: `tabsel_123' undeclared (first use in this function)
mpglib_interface.c:124: error: request for member `fr' in something not a structure or union
mpglib_interface.c:124: error: request for member `fr' in something not a structure or union
mpglib_interface.c:124: error: request for member `fr' in something not a structure or union
mpglib_interface.c:128: error: request for member `num_frames' in something not a structure or union
mpglib_interface.c:130: error: request for member `num_frames' in something not a structure or union
mpglib_interface.c:131: error: request for member `num_frames' in something not a structure or union
mpglib_interface.c:132: error: request for member `enc_delay' in something not a structure or union
mpglib_interface.c:133: error: request for member `enc_padding' in something not a structure or union
mpglib_interface.c:138: error: `MP3_OK' undeclared (first use in this function)
mpglib_interface.c:139: error: request for member `fr' in something not a structure or union
mpglib_interface.c:146: error: `sample_t' undeclared (first use in this function)
mpglib_interface.c:146: error: `pcm_l' undeclared (first use in this function)
mpglib_interface.c:146: error: syntax error before ')' token
mpglib_interface.c:146: error: `FLOAT8' undeclared (first use in this function)
mpglib_interface.c:146: error: `p_samples' undeclared (first use in this function)
mpglib_interface.c:146: error: syntax error before ')' token
mpglib_interface.c:155: error: syntax error before ')' token
mpglib_interface.c:155: error: syntax error before ')' token
mpglib_interface.c:155: error: `pcm_r' undeclared (first use in this function)
mpglib_interface.c:165: error: `MP3_NEED_MORE' undeclared (first use in this function)
mpglib_interface.c:171: error: `MP3_ERR' undeclared (first use in this function)
mpglib_interface.c: In function `lame_decode1_headersB':
mpglib_interface.c:193: error: `decodeMP3' undeclared (first use in this function)
mpglib_interface.c: At top level:
mpglib_interface.c:201: error: syntax error before "sample_t"
mpglib_interface.c: In function `lame_decode1_unclipped':
mpglib_interface.c:203: error: `FLOAT8' undeclared (first use in this function)
mpglib_interface.c:207: error: `buffer' undeclared (first use in this function)
mpglib_interface.c:207: error: `len' undeclared (first use in this function)
mpglib_interface.c:207: error: `pcm_l' undeclared (first use in this function)
mpglib_interface.c:207: error: `pcm_r' undeclared (first use in this function)
mpglib_interface.c:207: error: `decodeMP3_unclipped' undeclared (first use in this function)
make[3]: *** [mpglib_interface.lo] Error 1
make[3]: Leaving directory `/home/squishy/l/libmp3lame'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/squishy/l/libmp3lame'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/l'
make: *** [all] Error 2


Long story short, I did the same edit to /libmp3lame/mpglib_interface.c as you suggested and it worked!

Problem is still no "CPU features: MMX (ASM used), 3DNow! (ASM used), SSE" line in the exe:

CODE
D:\Incoming\junk>lame test.wav --alt-preset extreme
LAME version 3.96.1 (http://lame.sourceforge.net/)
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding test.wav to test.wav.mp3
Encoding as 44.1 kHz VBR(q=0) j-stereo MPEG-1 Layer III (ca. 5.7x) qval=3
   Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
10798/10800 (100%)|    0:38/    0:38|    0:38/    0:38|   7.3444x|    0:00
32 [   80] **
128 [   37] %
160 [  386] %%%%%**
192 [ 4135] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%********
224 [ 3741] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%**********
256 [ 1571] %%%%%%%%%%%%%%%%%%%%%%%***
320 [  850] %%%%%%%%%%%%%*
average: 219.9 kbps   LR: 9182 (85.02%)   MS: 1618 (14.98%)

Writing LAME Tag...done
ReplayGain: -6.5dB
robert
there is your problem at "mpglib_interface.c" line 13 again
bluesky
QUOTE(robert @ Jan 29 2005, 01:57 PM)
there is your problem at "mpglib_interface.c" line 13 again
*



Damn you're fast! I edited my post at the same time you posted reflecting the change and the compile worked (actually figured it out on my own that time)! smile.gif

...but still no "CPU features: MMX (ASM used), 3DNow! (ASM used), SSE" line in my exe sad.gif

I must be missing a switch or switches?
bluesky
1. Fresh tarball of lame source.
2. Edited /lame-3.96.1/libmp3/lame/mpglib_interface.c
Changed #include "interface.h" to #include "../mpglib/interface.h"
3. Same for /lame-3.96.1/mpglib/interface.c

Now I did:
CODE
$ ./configure --enable-nasm CFLAGS="-march=athlon-xp -Wall -fstrength-reduce -finline-functions -freduce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -fprefetch-loop-arrays"


No errors

CODE
$ make


Errored out with:

CODE
gcc -Wall -pipe -march=athlon-xp -Wall -fstrength-reduce -finline-functions -freduce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -fprefetch-loop-arrays -o lame.exe main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o  ../libmp3lame/.libs/libmp3lame.a -lm -lwsock32
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x2855):util.c: undefined reference to `has_MMX_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x285d):util.c: undefined reference to `has_3DNow_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x2865):util.c: undefined reference to `has_SSE_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x286d):util.c: undefined reference to `has_SSE2_nasm'
../libmp3lame/.libs/libmp3lame.a(takehiro.o)(.text+0x521e):takehiro.c: undefined reference to `choose_table_MMX'
../libmp3lame/.libs/libmp3lame.a(fft.o)(.text+0x9e6):fft.c: undefined reference to `fht_3DN'
collect2: ld returned 1 exit status
make[2]: *** [lame.exe] Error 1
make[2]: Leaving directory `/home/squishy/lame-3.96.1/frontend'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/lame-3.96.1'
make: *** [all] Error 2


Please help!
robert
well, after a fresh configure your Makefiles are rewritten. So your modification "-f elf" ->"-f win32 -DWIN32" is lost. Now you'll have to do this change again.
bluesky
You are right again! It works... but still no "CPU features: MMX (ASM used), 3DNow! (ASM used), SSE" line!

Here's what I did:

1. Fresh tarball of lame source.
2. Edited /lame-3.96.1/libmp3/lame/mpglib_interface.c
Changed #include "interface.h" to #include "../mpglib/interface.h"
3. Same for /lame-3.96.1/mpglib/interface.c

4. $ ./configure --enable-nasm CFLAGS="-march=athlon-xp -Wall -fstrength-reduce -finline-functions -freduce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -fprefetch-loop-arrays";

5. I edited /lame-3.96.1/mpglib/MakeFile and changed: NASM_FORMAT = -f elf

To this:

NASM_FORMAT = -f win32 -DWIN32

6. $ make

Which gives errors:

CODE
duce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -pipe -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -fprefetch-loop-arrays -o lame.exe main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o  ../libmp3lame/.libs/libmp3lame.a -lm -lwsock32
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x2855):util.c: undefined reference to `has_MMX_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x285d):util.c: undefined reference to `has_3DNow_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x2865):util.c: undefined reference to `has_SSE_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x286d):util.c: undefined reference to `has_SSE2_nasm'
../libmp3lame/.libs/libmp3lame.a(takehiro.o)(.text+0x521e):takehiro.c: undefined reference to `choose_table_MMX'
../libmp3lame/.libs/libmp3lame.a(fft.o)(.text+0x9e6):fft.c: undefined reference to `fht_3DN'
collect2: ld returned 1 exit status
make[2]: *** [lame.exe] Error 1
make[2]: Leaving directory `/home/squishy/lame-3.96.1/frontend'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/lame-3.96.1'
make: *** [all] Error 2
damaki
Have you tried to remove some optimizations? Because many gcc optimisations makes programs buggy. Futhermore, you command line has some useless things in it :
-mtune=athlon-xp <<< useless for x86 architecture
-pipe <<< implied by -O3
gcc sometimes does some strange things with its optimizations...
bluesky
I just repeated my steps from my last post except, I took out the -pipe switch. No change. Still fails here in the make:

CODE
duce-all-givs -m3dnow -msse -mfpmath=sse -mmmx -O3 -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -falign-functions=4 -maccumulate-outgoing-args -fprefetch-loop-arrays -o lame.exe main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o  ../libmp3lame/.libs/libmp3lame.a -lm -lwsock32
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x2855):util.c: undefined reference to `has_MMX_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x285d):util.c: undefined reference to `has_3DNow_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x2865):util.c: undefined reference to `has_SSE_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x286d):util.c: undefined reference to `has_SSE2_nasm'
../libmp3lame/.libs/libmp3lame.a(takehiro.o)(.text+0x521e):takehiro.c: undefined reference to `choose_table_MMX'
../libmp3lame/.libs/libmp3lame.a(fft.o)(.text+0x9e6):fft.c: undefined reference to `fht_3DN'
collect2: ld returned 1 exit status
make[2]: *** [lame.exe] Error 1
make[2]: Leaving directory `/home/squishy/lame-3.96.1/frontend'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/lame-3.96.1'
make: *** [all] Error 2
bluesky
QUOTE(damaki @ Jan 29 2005, 06:31 PM)
Have you tried to remove some optimizations?
*



What optmizations would you recommend for an athlon-xp build?

Just doing a simple:

$ ./configure --enable-nasm CFLAGS="-march=athlon-xp"
then a "make" will give me the same errors as that entire string of options.

CODE
if gcc -DHAVE_CONFIG_H  -I. -I. -I.. -I../libmp3lame -I../include -I..    -Wall -pipe -march=athlon-xp   -MT brhist.o -MD -MP -MF ".deps/brhist.Tpo" \
 -c -o brhist.o `test -f 'brhist.c' || echo './'`brhist.c; \
then mv -f ".deps/brhist.Tpo" ".deps/brhist.Po"; \
else rm -f ".deps/brhist.Tpo"; exit 1; \
fi
/bin/sh ../libtool --mode=link gcc  -Wall -pipe -march=athlon-xp    -static -o lame.exe  main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o ../libmp3lame/libmp3lame.la -lm -lwsock32
mkdir .libs
gcc -Wall -pipe -march=athlon-xp -o lame.exe main.o get_audio.o lametime.o parse.o portableio.o timestatus.o brhist.o  ../libmp3lame/.libs/libmp3lame.a -lm -lwsock32
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x12ac):util.c: undefined reference to `has_MMX_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x12b9):util.c: undefined reference to `has_3DNow_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x12c6):util.c: undefined reference to `has_SSE_nasm'
../libmp3lame/.libs/libmp3lame.a(util.o)(.text+0x12d3):util.c: undefined reference to `has_SSE2_nasm'
../libmp3lame/.libs/libmp3lame.a(takehiro.o)(.text+0x23a4):takehiro.c: undefined reference to `choose_table_MMX'
../libmp3lame/.libs/libmp3lame.a(fft.o)(.text+0xb31):fft.c: undefined reference to `fht_3DN'
collect2: ld returned 1 exit status
make[2]: *** [lame.exe] Error 1
make[2]: Leaving directory `/home/squishy/lame-3.96.1/frontend'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/squishy/lame-3.96.1'
make: *** [all] Error 2
robert
QUOTE(bluesky @ Jan 29 2005, 07:19 PM)
5. I edited /lame-3.96.1/mpglib/MakeFile and changed: NASM_FORMAT = -f elf

To this:

NASM_FORMAT = -f win32 -DWIN32

You should take a look into the /lame-3.96.1/libmp3lame/i386/Makefile
Bogalvator
bluesky,

I shall try and answer your query in your other thread:
http://www.hydrogenaudio.org/forums/index....showtopic=30938
damaki
QUOTE(bluesky @ Jan 29 2005, 09:05 PM)
What optmizations would you recommend for an athlon-xp build?

"-fomit-frame-pointer -O3 -march=athlon-xp" should be more than enough.

For you build problems, perhaps you should try with a different version of nasm.
Bogalvator
QUOTE(damaki @ Jan 29 2005, 12:16 PM)
QUOTE(bluesky @ Jan 29 2005, 09:05 PM)
What optmizations would you recommend for an athlon-xp build?

"-fomit-frame-pointer -O3 -march=athlon-xp" should be more than enough.

For you build problems, perhaps you should try with a different version of nasm.
*



In regards to this check out my last post in this thread:
http://www.hydrogenaudio.org/forums/index....showtopic=30446

(You may notice that it was only recently that was having the same troubles as you bluesky!)

Basically damaki is right, generally the less flags, the better wink.gif
DarkAvenger
Well, I just tried to do a cross compile in linux and it seems to be no big problem.

Calling the compiled lame.exe via wine:

CODE

LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE


I hacked a bit configure.in to be sure that correct nasm parameters got used and then used automake and friends to get new configure and Makefiles.

Then I invoked this:

CODE

CFLAGS="-march=athlon-xp -mtune=athlon-xp -O2 -pipe -frename-registers -fomit-frame-pointer -fprefetch-loop-arrays" CPPFLAGS="-DWIN32 -D_WINDOWS -D_MBCS -DNDEBUG " CC=i386-mingw32msvc-gcc CXX=i386-mingw32msvc-g++ LD=i386-mingw32msvc-ld ./configure --target=i386-mingw32msvc --host=i386-mingw32msvc --build=i386-linux --enable-nasm


This has been done on gentoo Linux. No problem here...

Did you check whether the nas files actually get compiled? Go into the libmp3lame/i386 folder, do make clean and make. What is the output? A fft3dn.lo should have been generated...
bluesky
Finally got it to work! First off, I want to thank everyone who helped me out on this one (in alpha order): Bogalvator, damaki, DarkAvenger, Gabriel, Garf, john33, and robert.

@Bogalvator: I haven't tried your suggestion yet, since I got the configure route to work.
@Robert: you were totally right on about editing those two makefiles and those two interface.* files -- they were causing the build problems!

Check it out:
CODE
D:\Incoming\junk>lame test.wav --alt-preset extreme
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE
Using polyphase lowpass filter, transition band: 19383 Hz - 19916 Hz
Encoding test.wav to test.wav.mp3


I've summarized the process that worked for doing this in a new thread so these three I started will all have some closure and so others in the future can easily find the answer when using MinGW.

Check it out here

Again, thank you all for your time on this issue; the hydrogenaudio community is a great place where someone (me) with no programming experience/skills can ask totally naive questions and not get spoken-down to or ridiculed.

As Bogalvator said in this thread, "it's no fun using someones else's compile is it."
Garf
QUOTE(bluesky @ Jan 30 2005, 12:52 PM)
As Bogalvator said in this thread, "it's no fun using someones else's compile is it."
*



Perhaps not, but it's a) safer b) less work c) often faster.
AstralStorm
You've awoken me from my eternal sleep... wink.gif
I was to suggest to change configure.in, but it seems you've found it already.

As to your CFLAGS - they are mostly correct, I'd add -mfpmath=sse -ffast-math. A bit faster and still as accurate as usual LAME due to SSE being 64bit, not 80.

BTW, your CXXFLAGS were horked, before -fsched-spec-load.

-freduce-all-givs,-fforce-addr = slower, -falign-function = better left to be set by -march
bluesky
QUOTE(AstralStorm @ Jan 30 2005, 12:32 PM)
As to your CFLAGS - they are mostly correct, I'd add -mfpmath=sse -ffast-math. A bit faster and still as accurate as usual LAME due to SSE being 64bit, not 80.
*



So you're saying that since SSE is 64-bit, it's okay to use -ffast-math? From what I've read, that can introduce errors. I'll add them to my tests and see. I've been running tests with my binaries, encoding wav files 5 times and also comparing the MD5s of the resulting mp3 files. Thus far all have matched.
Garf
QUOTE(bluesky @ Jan 30 2005, 08:25 PM)
QUOTE(AstralStorm @ Jan 30 2005, 12:32 PM)
As to your CFLAGS - they are mostly correct, I'd add -mfpmath=sse -ffast-math. A bit faster and still as accurate as usual LAME due to SSE being 64bit, not 80.
*



So you're saying that since SSE is 64-bit, it's okay to use -ffast-math?


That makes no sense to me at all (normal LAME probably uses doubles which are 64 bit when stored but actually 80 bit when doing calculations). I don't get the "still as accurate due to being 64 bit not 80". The reverse makes more sense (you do lose a tiny bit of precision).

-ffast-math is generally safe, it does not follow the IEEE rules stricly, but how many programmers know those anyway?
bluesky
QUOTE(AstralStorm @ Jan 30 2005, 12:32 PM)
As to your CFLAGS - they are mostly correct, I'd add -mfpmath=sse -ffast-math. A bit faster and still as accurate as usual LAME due to SSE being 64bit, not 80.


Thus far, the fastest binary I was able to make uses this code and is only 2.26%-3.25% slower than the rarewares.org build (I only used two wav files one about 54 meg and the other about 20 meg):
CODE
./configure --enable-nasm CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer" CXXFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"


I'll add your suggestion of using those two extras and test it out. Thanks for the idea. Once I get the tests finished, I'll post the results here for interested parties.
bluesky
The test results are published here
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.