不能在apple M1上成功编译gcc-start
According to https://miosix.org/wiki/index.php? title=Building_GCC_from_sources' tips
My step:
-
xcode-select --install
-
cc-v
-
Git clone https://miosix.org/git-public/miosix-kernel.git
-
cd miosix-kernel
-
Git fetch origin
-
git checkout -b testing origin/testing
-
sh download.sh
-
sh install-script.sh -j12
Finally, I got:: Error compiling gcc-start
This is my log/e.txt. I would appreciate it if you could help me.
I had a quick look at the issue, but I don't have access to a mac so I could not try to reproduce it and test solutions. From the log file (thanks! that was helpful) the first error is
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__locale:496:3: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
Looking online I found https://trac.macports.org/ticket/71137 linking to a useful bug report https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111632
It looks like an incompatibility between the source code of GCC and the latest clang/libc++.
Comment 1 in the bug report contains a patch https://gcc.gnu.org/bugzilla/attachment.cgi?id=56010&action=diff that seems not too hard to backport to gcc 9.2.0.
If you feel like trying yourself, you can try backporting it and we could add it together with our patches in the kernel unstable branch (which is where we are working right now).
Alternatively you could use the pre-compiled release of the Miosix compiler https://miosix.org/wiki/index.php?title=Miosix_Toolchain
We also have a pre-compiled release for the apple M1, I suppose compiled before apple updated clang to the version incompatible with GCC's source code.
Finally, we are working on upgrading to a later GCC as we want to support C++20 with Miosix, so in a few months the problem will be gone anyway.