arduino-mk gives error for EEPROM library

I have a problem that Arduino-mk does not seam to compile the same way as the IDE, and gives me a compile error for code that works in the IDE.

Here is my example.

#include <EEPROM.h>

void setup()
  float tempFloat;
  int   addr;

  Serial.println("Begin setup");
  Serial.println("EEPROM Compile Test");

  addr = 1;
  EEPROM.get(addr, tempFloat);
  EEPROM.put(addr, tempFloat);

  addr += sizeof(float);


void loop()

(I know it doesn’t do anything useful, I just wanted minimum code that demonstrated the compile error)

This compiles fine in the IDE.

Using Arduino-mk I get compile error. Here is my Makefile

ARDUINO_DIR  = /usr/share/arduino
USER_LIB_PATH = /home/gareth/Arduino/libraries
BOARD_TAG    = mega2560

include /usr/share/arduino/

Here is the output when I run make.

gareth@deskpi:~/Arduino/EEPROM_make_test $ make
------------------------- Configuration:
- [USER]               ARDUINO_DIR = /usr/share/arduino 
- [COMPUTED]           ARDMK_DIR = /usr/share/arduino (relative to
- [DEFAULT]            ARCHITECTURE =  
- [DEFAULT]            ARDMK_VENDOR = arduino 
- [BUNDLED]            AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED]           ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [COMPUTED]           ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino//variants (from ARDUINO_DIR)
- [COMPUTED]           BOARDS_TXT = /usr/share/arduino/hardware/arduino//boards.txt (from ARDUINO_DIR)
- [USER]               USER_LIB_PATH = /home/gareth/Arduino/libraries 
- [DEFAULT]            PRE_BUILD_HOOK = 
- [USER]               BOARD_TAG = mega2560 
- [COMPUTED]           CORE = arduino (from build.core)
- [COMPUTED]           VARIANT = mega (from build.variant)
- [COMPUTED]           OBJDIR = build-mega2560 (from BOARD_TAG)
- [COMPUTED]           ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino//cores/arduino (from ARDUINO_DIR, BOARD_TAG and boards.txt)
- [DETECTED]           MONITOR_BAUDRATE = 57600  (in sketch)
- [DEFAULT]            MCU_FLAG_NAME = mmcu 
- [DEFAULT]            CFLAGS_STD = -std=gnu11 -flto -fno-fat-lto-objects 
- [DEFAULT]            CXXFLAGS_STD = -std=gnu++11 -fno-threadsafe-statics -flto 
- [COMPUTED]           DEVICE_PATH = /dev/ttyACM0 (from MONITOR_PORT)
- [AUTODETECTED]       Size utility: AVR-aware for enhanced output
-                      ARDUINO_LIBS =
- [SYSTEM]               EEPROM
- [COMPUTED]           BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino//bootloaders (from ARDUINO_DIR)
- [COMPUTED]           ARDMK_VERSION = 1.5 
- [COMPUTED]           CC_VERSION = 4.9.2 (avr-gcc)
mkdir -p build-mega2560
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=105  -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino//cores/arduino -I/usr/share/arduino/hardware/arduino//variants/mega    -I/usr/share/arduino/libraries/EEPROM   -Wall -ffunction-sections -fdata-sections -Os -fpermissive -fno-exceptions -std=gnu++11 -fno-threadsafe-statics -flto EEPROM_make_test.ino -o build-mega2560/EEPROM_make_test.ino.o
EEPROM_make_test.ino: In function ‘void setup()’:
EEPROM_make_test.ino:17:10: error: ‘class EEPROMClass’ has no member named ‘get’
   EEPROM.get(addr, tempFloat);
EEPROM_make_test.ino:19:10: error: ‘class EEPROMClass’ has no member named ‘put’
   EEPROM.put(addr, tempFloat);
/usr/share/arduino/ recipe for target 'build-mega2560/EEPROM_make_test.ino.o' failed
make: *** [build-mega2560/EEPROM_make_test.ino.o] Error 1

I did look for EEPROM.h and found that it defined an EEPROMClass in terms of read and write… so maybe the IDE and Arduino-mk are using different versions of EEPROM.h? But I only found one in my file structure?

I’m using a Raspberry Pi 3. Debian Stretch.

None of the other libraries I’ve tried have given me any problems. Any suggestions on where I go from here to debug this problem?



I think it's definitely using a different library. Your compilation command contains this:


but the Arduino IDE is likely using the EEPROM library at a different location. It really doesn't make sense to have the EEPROM library installed at /usr/share/arduino/libraries/EEPROM because that's a hardware-specific library and thus each hardware platform provides its own version of the EEPROM library so it should be located in the libraries subfolder of the hardware package.

You can find the location of the EEPROM library used by the Arduino IDE by doing this:

  • Tools > Board > Arduino/Genuino Mega
  • File > Examples > EEPROM > eeprom_clear
  • Sketch > Show Sketch Folder
  • Navigate up two folder levels. The source files for the library will there or under the src subfolder.

Thanks for the very helpful reply.

I found the library folder that the IDE was using and the EEPROM.h was different from the one pointed to by the make file. (I hadn’t found it originally as it is in a hidden folder.)

I’m ashamed to say that I used a brute force method to fix my arduino-mk make, by coping the EEPROM library folder from the complicated path used by the IDE to the path looked for in the make file /usr/…

I understand that this is a kludge because you said that it was hardware specific; I’ll cross that bridge if I ever come to it…

I understand that in the future you may say “I told you so!”

As an aside, I really appreciate that you took the time to answer my actual question and didn’t tell me that I aught to be doing something different. That happens a lot on the FaceBook based pages… (:-X )

Best regards


If you're only using AVR boards then it shouldn't be a problem. It's only if you try to compile a program that uses the EEPROM library for a microcontroller of a different architecture that you'll encounter an error. The Arduino IDE automatically selects the EEPROM library associated with the hardware package of the board you're compiling for so each package can use its own version of the hardware-specific libraries (e.g: EEPROM, SoftwareSerial, SPI, Wire).

I'm glad I was able to help. Enjoy!


I only have avr boards so I should be ok.

I do need to find out how to fix my paths though, because the other hardware specific libraries are now failing now that I’ve got past EEPROM! Fortunately I don’t need those yet.

Best regards