Anyway, I've been on a quest to build the chipKIT compiler from https://github.com/chipKIT32/chipKIT-cxx using the script from https://github.com/chipKIT32/chipKIT-cxx-build. I'm doing this on Ubuntu 14.04 LTS 64-bit (in VirtualBox). The README that is provided with the script states that it was meant for OS X 10.6 or 10.7, however.
Unfortunately, I am running into a bit of trouble at the moment. On the plus side that gives me an opportunity to at least share what I've done so far in case anyone else wants to try building on Ubuntu.
The README provides the software packages needed for OS X, but things are a bit different here. Here are the packages you need; get them either using the apt-get install command or via the Ubuntu Software Center. Remember that these are for Ubuntu 14.04 64-bit.
Edit 2016 Mar 31: Added ARM cross-compiler packages.
The other packages listed (curl, rsync, etc.) should already be installed. The "growl" and "growl-notify" packages are not needed as they are specific to OS X. You'll still get nice notifications in Ubuntu.
NOTE: The "build-essential" package will bring in GCC 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.1). This is different from what the script's README wanted (GCC 4.2), but ought to be OK since the newest chipKIT compiler is based on GCC 4.8.3.
You also need Texinfo, but the version that the Ubuntu package repository provides is too new and will cause all sorts of errors with GCC 4.8 docs. You can tell GCC to not build its docs, but unfortunately the script barfs on the warnings the GCC instead outputs. Instead, you need to build and install an older Texinfo from source using the instructions provided at http://askubuntu.com/questions/491184/texinfo-downgrade.
I grabbed the latest script from GitHub and made a few mods to make it run. I have attached the modified script to this message.
1. The first modification is minor. Search for the comment "#Process the arguments" to see a case structure to handle command-line options. You'll see a reference to a function (or whatever they call those in Bash-speak) called "show_usage". However, that function is defined after it is referenced and so will not work. Find the "show_usage()" function and move it above the case structure.
2. To make the other change, search for the comment "#Check out the source code". Scroll down a bit and you'll notice that the portion of the script to grab the source of the actual compiler is commented out! Uncomment that section and then change the GIT_CHIPKIT_CXX_REPO variable to https://api.github.com/repos/chipKIT32/ ... all/master.
Edit 2016 Mar 31: Added new mods to script
3. The script needs to be modified if you are running on a 64-bit Linux to force the chipKIT compiler to be built in 32-bit mode. Search for "xDarwin-image" to find an if-statement. This checks if the script is running on OS X. Scroll down a bit to find the corresponding else-clause and add the following inside of it:
Code: Select all
# We need to force a 32-bit build if we're on 64-bit Linux if [ `getconf LONG_BIT` = "64" ] then if [ "x$SKIPNATIVE" == "x" ] ; then COMPATIBILITY_FLAGS="-m32 -march=i686" export CXX_FOR_BUILD="g++ $COMPATIBILITY_FLAGS" export CC_FOR_BUILD="gcc $COMPATIBILITY_FLAGS" export CC="gcc $COMPATIBILITY_FLAGS" export CPP="cpp $COMPATIBILITY_FLAGS" export CXX="g++ $COMPATIBILITY_FLAGS" export LD="gcc $COMPATIBILITY_FLAGS" export AR="ar" fi # SKIPNATIVE fi
4. Ubuntu 14.04 has a different name for the ARM cross-compiler than OS X does, it seems, so the script needs to be updated to figure out which compiler prefix (the "blahblah" in "blahblah-gcc"). Search for "unset ARMLINUX32_HOST_PREFIX" near the top of the script. Replace that line and the following assignment with the following code:
Code: Select all
# Figure out which ARM cross compiler we have. Candidates are: # arm-linux-gnueabi-gcc (Ubuntu) # arm-none-linux-gnueabi-gcc (OS X) if [ "x$ARMLINUX32_HOST_PREFIX" == "x" ]; then WHICH_ARM_GCC=`which arm-none-linux-gnueabi-gcc` if [ "x$WHICH_ARM_GCC" != "x" ] ; then ARMLINUX32_HOST_PREFIX=arm-none-linux-gnueabi else ARMLINUX32_HOST_PREFIX=arm-linux-gnueabi fi unset WHICH_ARM_GCC fi
Running the Script
At this point you should be able to run the script. If you've already run the script once and thus have already checked out the code, you can pass the "-N" command-line option to stop the script from re-downloading the source. In the future, I may try adding an option to only download the sources for archival purposes.
...Aaannnnd I'm Stuck
Edit 2016 Mar 31: This is no longer true! I am no longer stuck!
So it is at this point I am stuck in the build. What appears to be happening is that the chipKIT build (pic32-gcc) is segfauting while trying to build Newlib. I'm not sure why this is happening, but I wonder if it is because I am building on a 64-bit OS and thus building a 64-bit version of the compiler. I notice that the script appears to force a 32-bit build when on OS X, so hopefully I can leverage that code to make it work. I'll update this thread with my progress, but I'll attach my build log in case one of you guys has run into this before.
On another note, is is normal for the build to emit so many warnings? Ubuntu's GCC (4.8.4) seems to emit a whole lot of warnings when building the chipKIT compiler, mainly about local variables shadowing global ones of the same name.
Edit 2016 Mar 31: This post used to have a modified build script and a log showing where I was originally stuck building. I have removed both of those. A later post has a new build script that you should use instead.