Re: Cross compiling lame 3.100 fails on macOS 11.0

Alexander Leidinger via Lame-dev <[email protected]> Tue, 08 Dec 2020 08:48:08 +0100
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <20201208084808.Horde.jqfRPs4TDUGoRvTJp2EtEVO@webmail.leidinger.net>
Quoting 桃源老師 via Lame-dev <[email protected]> (from Tue,  
8 Dec 2020 15:32:50 +0900):

> Hi
>
>> 2020/12/07 午後10:12、桃源老師 via Lame-dev <[email protected]>のメール:
>>
>> Hi,
>>
>> I'm now trying to cross compile lame 3.100 for Apple Silicon Mac.
>>
>> My configure option is as follows:
>>
>> ./configure CFLAGS="-arch arm64" --host=i386-apple-darwin20.1.0  
>> --disable-shared
>>
>> And it fails with below error on make.
>>
>> clang: error: the clang compiler does not support '-march=native'
>> clang: error: the clang compiler does not support '-mtune=native'
>>
>> I looked into make file and found that those two compiler flag were  
>> defined in CFLAGS of make file.
>>
>> CFLAGS = -O3 -march=native 				-mtune=native -Wall -arch arm64 -fno-common
>>
>>
>> I also tried to compile lame as native Intel-based:
>>
>> ./configure --disable-shared
>>
>> And found that there are no -march and no -mtune.
>>
>> CFLAGS = -O3 -Wall -fno-common
>>
>> So I thought that those compiler flag -march=native -mtune=native  
>> are not supported = unneeded, and removed them from make file of  
>> cross compile mode. Then lame seems to built successfully.

You did the right thing.

>> But I'm not sure that my thought is correct or not...
>>
>> Would you please check my thought is correct or not.  And also, if  
>> I'm doing wrong, please advice correct way to cross compile of lame  
>> 3.100?
>>
>>
>> Best Regards,
>>
>> // Kimio Miyamura
>
> I forgot to attach detailed error.  Here it is...
>
> $ make
> /Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
> Making all in mpglib
> /bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H   
> -I. -I.. -I../include -I. -I../libmp3lame -I..    -O3 -march=native  
> 				-mtune=native -Wall -arch arm64 -fno-common -MT common.lo -MD  
> -MP -MF .deps/common.Tpo -c -o common.lo common.c
> libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../include -I.  
> -I../libmp3lame -I.. -O3 -march=native -mtune=native -Wall -arch  
> arm64 -fno-common -MT common.lo -MD -MP -MF .deps/common.Tpo -c  
> common.c  -fno-common -DPIC -o .libs/common.o
> clang: error: the clang compiler does not support '-march=native'
> make[2]: *** [common.lo] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
>
> Please help me...

"march=native" means that the compiler shall optimize for the  
instruction set of the CPU the compiler runs on. This doesn't make  
sense for cross-architecture builds. We should not add those flags in  
cross-builds.

Bye,
Alexander.


-- 
http://www.Leidinger.net [email protected]: PGP 0x8F31830F9F2772BF
http://www.FreeBSD.org    [email protected]  : PGP 0x8F31830F9F2772BF

_______________________________________________
Lame-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lame-dev