Wednesday, 28 October 2015

[gccsdk] cross-compiling using gcc5 on the host 1

Hi

There are 2 things I have had to change to build the gccsdk on a gcc5 host

First deals with __FUNCTION__ nolonger being recognised, so a global replace of __FUNCTION__ with __func__ is needed.

I have done this with a patch to the gcc4/Makefile. This is a sledgehammer as the gcc build tree appears to use the old format in many places.

I'm sure there is a better way, but this is needed. As far as I understand things, this should be OK for gcc4.7 and later (at least) too


--- Makefile    2015-10-28 10:05:44.839970500 +0000
+++ Makefile.fixed    2015-10-28 10:07:54.000000000 +0000
@@ -220,6 +220,7 @@
     -rm -rf $(BUILDDIR) $(BUILDSTEPSDIR) $(SRCDIR) $(GCCSDK_CROSS_PREFIX) $(GCCSDK_RISCOS_PREFIX)
     -svn revert -R $(SRCORIGDIR)/gcc-trunk
     -svn status $(SRCORIGDIR)/gcc-trunk | grep -E "^?" | cut -b 9- | xargs rm -rf
+    cd $(SRCORIGDIR)/gcc-trunk && find -regex ".*\.\(c\|C\|h\)"  -type f  -exec sed -i 's/__FUNCTION__/__func__/g' {} \;
     for i in . riscos/asasm riscos/asasm/decaof/ riscos/asasm/elftoolchain/ ; do svn status --no-ignore $$i | grep "^I       " | cut -b 9- | grep -v -E "^(gccsdk-params|srcdir\.orig|release-area)$$" | xargs rm -rf ; done
 
 # Return to a state for doing a full fresh cross build (using the current binutils/gcc sources).
@@ -242,6 +243,7 @@
     -svn revert -R $(SRCORIGDIR)/gcc-trunk
     -svn status $(SRCORIGDIR)/gcc-trunk | grep -E "^?" | cut -b 9- | xargs rm -rf
     cd $(SRCORIGDIR)/gcc-trunk && ./contrib/gcc_update
+    cd $(SRCORIGDIR)/gcc-trunk && find -regex ".*\.\(c\|C\|h\)"  -type f  -exec sed -i 's/__FUNCTION__/__func__/g' {} \;
 else
     @echo "Makefile target updategcc is only supported when GCC sources are fetched from the GCC source control system."
 endif
@@ -542,6 +544,7 @@
     -rm -rf $(SRCDIR)/gcc
     -svn revert -R $(SRCORIGDIR)/gcc-trunk
     -svn status $(SRCORIGDIR)/gcc-trunk | grep -E "^?" | cut -b 9- | xargs rm -rf
+    cd $(SRCORIGDIR)/gcc-trunk && find -regex ".*\.\(c\|C\|h\)"  -type f  -exec sed -i 's/__FUNCTION__/__func__/g' {} \;
     ln -s $(SRCORIGDIR)/gcc-trunk $(SRCDIR)/gcc
 else
 src-gcc-copied: $(SRCORIGDIR)/gcc-$(GCC_VERSION).tar.bz2
@@ -686,6 +689,7 @@
     -mkdir -p $(SRCORIGDIR)
     cd $(SRCORIGDIR) && svn co svn://gcc.gnu.org/svn/gcc/$(GCC_SCM_PATH) gcc-trunk
     cd $(SRCORIGDIR)/gcc-trunk && ./contrib/gcc_update
+    cd $(SRCORIGDIR)/gcc-trunk && find -regex ".*\.\(c\|C\|h\)"  -type f  -exec sed -i 's/__FUNCTION__/__func__/g' {} \;
 else
 # Download gcc source:
 $(SRCORIGDIR)/gcc-$(GCC_VERSION).tar.bz2:
      
--
Stop press! Just announced -

Most Trusted Broadband Provider in the 2014 Moneywise Customer Services Awards

For full details of see https://www.utilitywarehouse.co.uk/reviews?exref=095761

Intrigued? Call me

John Ballance C.Eng MIET - jwb@macpcrepair.co.uk - 07976 295923

No comments:

Post a Comment