cc1
, cc1plus
and lto1
binaries so that it accepts any xclm
binary.These instructions are mostly based on this page: http://www.jubatian.com/articles/turning-on-optimizations-in-microchips-xc32/
First you have to download the source of the compiler. Go to http://www.microchip.com/mplab/compilers, click on “Downloads Archive”, scroll down and find “Source Archives”. There you can choose which version to download. At the time of writing the latest link is for xc32-v1.40.
sh: 1: pygmentize: not found
# ⚠ change these variables according to your setup. installpath="$HOME/microshit" # this is where the compiler will be installed pic32mxpath='/opt/microchip/xc32/v1.40/pic32mx/' # assuming that you already have installed xc32 from microchip
sh: 1: pygmentize: not found
mkdir -- "$installpath" export CPPFLAGS="-I$installpath/usr/include" export LDFLAGS="-L$installpath/usr/lib"
sh: 1: pygmentize: not found
# gmp mkdir -p gmp_build && cd gmp_build ../gmp/configure "--prefix=$installpath/usr" --disable-shared --enable-static --enable-cxx make make install cd ..
sh: 1: pygmentize: not found
# ppl mkdir -p ppl_build && cd ppl_build ../ppl/configure "--prefix=$installpath/usr" --disable-shared --enable-static make make install cd ..
Unfortunately I get this error during make:
sh: 1: pygmentize: not found
../../ppl/src/Generator_System.defs.hh:253:7: error: ‘ptrdiff_t’ was not declared in this scope
It seems like it does not compile under newer gcc versions.
This leads me to this page: https://gcc.gnu.org/gcc-4.6/porting_to.html
It says that you should #include <cstddef>
. You have to do that with these files:
Just add #include <cstddef>
and save. Now run *make* again.
Now you'll probably see this error:
sh: 1: pygmentize: not found
../../ppl/src/Interval.defs.hh:451:77: error: ‘f_info’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] Result rl = Boundary_NS::assign(UPPER, upper(), info(), UPPER, x, f_info(x, open));
It looks like it can be solved by using -fpermissive flag.
Try rerunning make like this:
sh: 1: pygmentize: not found
make CXXFLAGS='-g -O2 -frounding-math -W -Wall -fpermissive'
This should probably work.
sh: 1: pygmentize: not found
# cloog mkdir -p cloog_build && cd cloog_build ../cloog/configure "--prefix=$installpath/usr" --disable-shared --enable-static "--with-ppl=$installpath/usr" make make install cd ..
sh: 1: pygmentize: not found
# libelf mkdir -p libelf_build && cd libelf_build ../libelf/configure "--prefix=$installpath/usr" --disable-shared make make install cd ..
sh: 1: pygmentize: not found
# zlib cd zlib ./configure "--prefix=$installpath/usr" make make install cd ..
sh: 1: pygmentize: not found
# binutils mkdir -p binutils_build && cd binutils_build ../binutils/configure "--prefix=$installpath/usr" --disable-shared --enable-static --target=pic32mx --with-dwarf2 make make install cd ..
You will get this error:
sh: 1: pygmentize: not found
../../binutils/bfd/cpu-pic32.c:32:55: fatal error: ../../c30_resource/src/xc32/resource_info.h: No such file or directory
OK this is a real issue. It seems like they forgot to include the file. See this link: http://www.microchip.com/forums/m897811.aspx
sh: 1: pygmentize: not found
# Microchip libraries cp -a -- "$pic32mxpath" "$installpath/usr/pic32mx"
sh: 1: pygmentize: not found
# gcc mkdir -p gcc_build && cd gcc_build ../gcc/configure "--prefix=$installpath/usr" --disable-shared --enable-static --target=pic32mx --enable-languages=c,c++,lto --disable-objc-gc --enable-lto --with-host-libstdcxx=-lstdc++ --enable-multilib --with-dwarf2 --disable-sjlj-exceptions "--with-sysroot=$installpath/usr/pic32mx" make make install
After all these efforts you end up with a half-broken build.
Just edit the SHA sum in cc1
, cc1plus
and lto1
binaries and you're done.
There is a chance that the build process will become easier once Microchip updates their compiler to the latest GCC version. Latest XC compiler version is 1.40 (2015-06-17), which is pretty old. The reason for such delay is probably that they are unable to compile the thing with the newer GCC versions. Ha-ha. Good luck, Microchip.