Go Down

Topic: [SOLVED] Problem using EEPROM lib: undefined reference to `__eewr_byte_m168' (Read 2637 times) previous topic - next topic


Hello, kind of new to Arduino and I have run into some problems.
I have an Arduino Diecimila board and have been able to compile the basic examples and transferred to the Arduino and got them to run, but now when I need to compile a sketch that uses the EEPROM library i get an error:

Code: [Select]
EEPROM/EEPROM.cpp.o: In function `EEPROMClass::read(int)':
/usr/share/arduino-1.0/libraries/EEPROM/EEPROM.cpp:42: undefined reference to `__eewr_byte_m168'
/usr/share/arduino-1.0/libraries/EEPROM/EEPROM.cpp:42: undefined reference to `__eerd_byte_m168'

I use Gentoo Linux, Arduino 1.0. I tried with avr-libc 1.7.1 and 1.8.0, also gcc 4.3.6 and a later version (can't remember the exact version I tried now, sorry), the error stayed the same with all versions.
I tried opening the examples that are in the Arduino EEPROM library folder, they wouldn't compile either, same error.
I tried opening examples from the other libraries and they compiled, so this error seems limited to the EEPROM library.
I checked that there is a eeprom.h present in the avr include folder, and that gcc searches in that folder.

I have no idea what to do to continue troubleshooting these compile issues, can anyone point me in the right direction or suggest anything further I can check to find out why EEPROM isn't usable?
Thanks in advance.


What versions of gcc-avr and binutils-avr?   I've Ubuntu with avr-lib 1:1.6.8-2, binutils-avr 2.20.1-1ubuntu2, gcc-avr 1:4.3.5-1,
avrdude 5.10-3

Seems happy with EEPROM code.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thank you for your answer. I tried installing the versions you are using of the tools. Sadly it made no difference, I get the same error. Now I have reinstalled the versions Gentoo currently uses by default, which is gcc 4.5.3, avr-libc 1.8.0 and binutils 2.22 and the error remains.


Perhaps there is a problem passing the LD_LIBRARY_PATH or similar?  Also perhaps this page is useful?  'fraid I haven't used Gentoo so can't do more than inspired guesses...

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thank you for your assistance MarkT, somehow I had managed to miss that particular article when searching earlier. The Gentoo implementation of the Arduino tools seems to be not quite 100% working, and that writeup you pointed me to describes how to ignore the versions of the avr development tools in portage and instead manually compile and install them. I'm quite sure that doing that would have solved the problem, but before starting with that I tried around a bit more and found what seems to be another solution. I did this:

Code: [Select]

cd /usr/avr/lib
ln -sf avr5/libc.a .
ln -sf avr5/libm.a .

and now sketches using the EEPROM library compile without errors. I haven't tried running them on an Arduino yet, but hopefully it will work.
I earlier had to symlink the crtm168.o file in the same manner as above to be able to compile any sketches at all, so it seems the Gentoo packages doesn't set up the required files correctly without user intervention.

Should this ever be of help to someone else, note that as stated earlier I use an Arduino Diecimila, depending on the particular Arduino board symlinks may have to point to another of the avr directories in /ust/avr/lib.

Go Up