Cant compile for Photon

Hey all,
I have a photon, and I needed to make some changes to the code base (basically remove the touchscreen code), and I am unable to compile and load the code onto my device. Seems like I can compile the code from my eclipse enviornment, and flash it to the photon, but then it goes into safe mode (flashing magenta). I assumed this was due to some mismatch between the system firmware and compiled code. So I attempted to compile the code from terminal (compile system-part1 and then system-part2, ending in flashing the app). However, now I am getting an error around sscanf. See the output below:

jeff@ubuntu:~/git/brewpi-master/modules/photon/system-part1$ make clean all PLATFORM=photon program-dfu
make[1]: Entering directory `/home/jeff/git/brewpi-master/communication'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/communication'
make[1]: Entering directory `/home/jeff/git/brewpi-master/hal'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/hal'
make[1]: Entering directory `/home/jeff/git/brewpi-master/services'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/services'
make[1]: Entering directory `/home/jeff/git/brewpi-master/platform'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/platform'
make[1]: Entering directory `/home/jeff/git/brewpi-master/communication'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/communication'
make[1]: Entering directory `/home/jeff/git/brewpi-master/hal'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/hal'
make[1]: Entering directory `/home/jeff/git/brewpi-master/services'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/services'
make[1]: Entering directory `/home/jeff/git/brewpi-master/platform'
make[1]: Leaving directory `/home/jeff/git/brewpi-master/platform'
/tmp/ccd7ZbeO.ltrans4.ltrans.o: In function `sscanf':
/home/jeff/git/brewpi-master/modules/photon/system-part1/../../../rt-dynalib/inc/rt_dynalib.h:33: multiple definition of     `sscanf'
/usr/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/lib/armv7-m/libg_nano.a(lib_a-sscanf.o):sscanf.c:(.text.sscanf+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [../../../build/target/system-part1/platform-6-m-lto/system-part1.elf] Error 1
jeff@ubuntu:~/git/brewpi-master/modules/photon/system-part1$ 

Anyone know whats going on? The errors dont seem to be related to code that I changed

To be clear, I CAN compile and install spark-latest firmware, and I am able to get the tinker app running - I am just unable to run brewpi firmware.

To latest BrewPi code is compiled with system version 0.4
7. The Particle branch latest is recommended to compile against, but at least the version tag 0.4.7 should work.

Do a clean build.

Why did you make your own board and what is different?

Im making my own board as a drop-in replacement for my fridge’s thermostat. Yes, I will have to run a USB cable out of the fridge for now, but eventually once Wifi is working it will be a MUCH cleaner and integrated solution than hacking apart a fridge.

As of right now, the only item I am dealing with is the Particle Photon. I have a DS2482 chip connected, and will add on a 40x4 LCD, but first things first, I am just trying to compile the code to flash to the photon so I can eventually remove the GUI library (I do not plan on having a touch screen on this build)

Looks like I had some issue with my installed libraries. Making progress - I switched my make directory to platform/spark, and it compiles further. However, now I am getting the following error:

In file included from /usr/arm-none-eabi/include/c++/4.9.3/bits/locale_facets.h:41:0,
                 from /usr/arm-none-eabi/include/c++/4.9.3/bits/basic_ios.h:37,
                 from /usr/arm-none-eabi/include/c++/4.9.3/ios:44,
                 from /usr/arm-none-eabi/include/c++/4.9.3/ostream:38,
                 from ../wiring/inc/spark_wiring_string.h:228,
                 from ../wiring/inc/spark_wiring_stream.h:30,
                 from ../wiring/inc/spark_wiring.h:39,
                 from ./inc/application.h:36,
                 from /home/jeff/git/brewpi-master/platform/spark/modules/Platform.h:4,
                 from /home/jeff/git/brewpi-master/app/controller/Brewpi.cpp:28:
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:46:35: error: '_U' was not declared in this scope
     static const mask upper     = _U;
                                   ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:47:32: error: '_L' was not declared in this scope
     static const mask lower  = _L;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:48:32: error: '_U' was not declared in this scope
     static const mask alpha  = _U | _L;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:48:37: error: '_L' was not declared in this scope
     static const mask alpha  = _U | _L;
                                     ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:49:32: error: '_N' was not declared in this scope
     static const mask digit  = _N;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:50:33: error: '_X' was not declared in this scope
     static const mask xdigit  = _X | _N;
                                 ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:50:38: error: '_N' was not declared in this scope
     static const mask xdigit  = _X | _N;
                                      ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:51:32: error: '_S' was not declared in this scope
     static const mask space  = _S;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:52:32: error: '_P' was not declared in this scope
     static const mask print  = _P | _U | _L | _N | _B;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:52:37: error: '_U' was not declared in this scope
     static const mask print  = _P | _U | _L | _N | _B;
                                     ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:52:42: error: '_L' was not declared in this scope
     static const mask print  = _P | _U | _L | _N | _B;
                                          ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:52:47: error: '_N' was not declared in this scope
     static const mask print  = _P | _U | _L | _N | _B;
                                               ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:52:52: error: '_B' was not declared in this scope
     static const mask print  = _P | _U | _L | _N | _B;
                                                    ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:53:32: error: '_P' was not declared in this scope
     static const mask graph  = _P | _U | _L | _N;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:53:37: error: '_U' was not declared in this scope
     static const mask graph  = _P | _U | _L | _N;
                                     ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:53:42: error: '_L' was not declared in this scope
     static const mask graph  = _P | _U | _L | _N;
                                          ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:53:47: error: '_N' was not declared in this scope
     static const mask graph  = _P | _U | _L | _N;
                                               ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:54:32: error: '_C' was not declared in this scope
     static const mask cntrl  = _C;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:55:32: error: '_P' was not declared in this scope
     static const mask punct  = _P;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:56:32: error: '_U' was not declared in this scope
     static const mask alnum  = _U | _L | _N;
                                ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:56:37: error: '_L' was not declared in this scope
     static const mask alnum  = _U | _L | _N;
                                     ^
/usr/arm-none-eabi/include/c++/4.9.3/arm-none-eabi/armv7-m/bits/ctype_base.h:56:42: error: '_N' was not declared in this scope
     static const mask alnum  = _U | _L | _N;
                                          ^
make[3]: *** [/home/jeff/git/brewpi-master/platform/spark/target/user/platform-6-m/brewpi-master/app/controller/Brewpi.o] Error 1
make[3]: Leaving directory `/home/jeff/git/brewpi-master/platform/spark/firmware/user'
make[2]: *** [user] Error 2
make[2]: Leaving directory `/home/jeff/git/brewpi-master/platform/spark/firmware/modules/photon/user-part'
make[1]: *** [modules/photon/user-part] Error 2
make[1]: Leaving directory `/home/jeff/git/brewpi-master/platform/spark/firmware/main'
make: *** [run_make] Error 2

Can someone clarify which directory I should be running make from? Under platform/spark/firmware, compilation succeeds, but it looks like it is installing the code for the default tinker app. In the output, I see no references to any BrewPi code. Is there a specific directory I should run make under?

You should run make in:

In eclipse, my build command for the photon is:
${cross_make} -f makefile USE_SWD=y PLATFORM=photon
And the build directory is:
${workspace_loc:/firmware/platform/spark}

Disregard my previous comments on which system version is used to compile, I forgot that we include the dependencies from Particle as a subtree now.
You should also have boost installed and BOOST_ROOT set as environment variable.

I think the issue is with the latest (4.9.3) version of the ARM compiler. I had to edit the offending ctype_base.h to add the missing constants. I was able to compile the code, and it is running.

As a sidenote: looks like my original attempt to connect my brewpi (the reason why I was going to modify the code) was not working due to a lack of a DS2482 one-wire master. I added he DS2482 to the circuit, and now it seems to be working. Still have a few issues to sort out: why the script keeps crashing, and merge arduino and spark code to allow me to use the 40x4 LCD I had planned on using. Also, wireless control seems pretty easy (at least it can be if hardcoded), so I might work on that as well.