Compiling the Geeetech Sanguino firmware with a recent Arduino IDE

As I have posted previously, trying to compile the Geeetech Sanguino firmware with a recent version of the Arduino IDE results in the following errors:

In file included from sketch/SdFile.h:27:0,
                 from sketch/cardreader.h:8,
                 from sketch/Marlin_main.cpp:44:
SdBaseFile.h:38: error: using typedef-name 'fpos_t' after 'struct'
 struct fpos_t {
In file included from sketch/Marlin.h:10:0,
                 from sketch/Marlin_main.cpp:30:
note: 'fpos_t' has a previous declaration here
 __extension__ typedef long long fpos_t;
exit status 1
using typedef-name 'fpos_t' after 'struct'

The recommendation repeated often on the Geeetech forums is to use v1.0.1 of the IDE because the code is written specifically for that version, but that’s hardly practical and a little misleading, I’d suggest. It’s more the case that the code happens to compile with that version of the IDE and won’t with later ones because of the above error which is presumably due to changes within the compilation environment.

In fact, the problem is relatively easy to fix by changing the name of the variable in the firmware source code. It’s only used in two files, SdBaseFile.cpp and SdBaseFile.h, so they’re easy enough to edit by hand changing all the occurrences of “fpos_t” to something else. Because I couldn’t be bothered to edit them, I changed to the firmware source directory and ran the following to change “fpos_t” to “gt_fpos_t”:

sed -i.bak -e 's/fpos_t/gt_fpos_t/g' SdBaseFile.cpp SdBaseFile.h

That done, recompiling gives the result:

Archiving built core (caching) in: /tmp/arduino_cache_531416
Sketch uses 92644 bytes (71%) of program storage space. Maximum is 130048 bytes.
Global variables use 4029 bytes (24%) of dynamic memory, leaving 12355 bytes for local
variables. Maximum is 16384 bytes.

Happy days. Next comes the scary step of seeing if I can upload it successfully.

This entry was posted in 3D Printing and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *