Re: Cross compiling lame 3.100 fails on macOS 11.0

桃源老師 via Lame-dev <[email protected]> Tue, 8 Dec 2020 17:48:09 +0900
Newsgroups gmane.comp.audio.mp3.lame
Message-ID <[email protected]>
Hello Alexander-san,

Thank you very much for your replay.

> 2020/12/08 午後4:48、Alexander Leidinger via Lame-dev <[email protected]>のメール:
> 
> 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.

OK.  I'm now editing make file using Adobe Brackets.  But I'm very happy if there is a way to edit before make file was created. (ex. at configure?)  Are there any way to do so?

> 
>>> 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.

I learned a lot from what you said.  Thank you very much.


Best Regards,

// Kimio Miyamura

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