When I try to compile example “PololuQTRRCExample” from PololuQTRSensorsForArduino I’m getting following error:
PololuQTRRCExample.cpp.o: In function `setup':
PololuQTRRCExample.cpp:47: undefined reference to `__dso_handle'
PololuQTRRCExample.cpp:50: undefined reference to `__dso_handle'
PololuQTRRCExample.cpp:50: undefined reference to `__cxa_atexit'
I use arduino 022 and gcc 4.4.3 and avr-gcc 4.4.3.
If I try to workaround this problem modifying the original example by adding initial declaration:
I tried to reproduce your problem but could not. The example sketch compiled with no errors on my computer.
I downloaded the latest version of PololuQTRSensorsForArduino from here: pololu.com/docs/0J19/all
I am using Windows Vista and arduino-0022. This version of the IDE uses avr-gcc.exe “version 4.3.2 (WinAVR 20081205)”. What operating system are you using? How did you determine the version number of avr-gcc? I determined my version number by going to my Arduino installation directory and running “hardware\tools\avr\bin\avr-gcc.exe -v” in a Command Prompt.
Also, your version of plain old gcc should not matter. If you are compiling the sketch within the Arduino IDE, it should use avr-gcc, not gcc. The __dso_handle and __cxa_atexit symbols have something to do with shared libraries: a feature that avr-gcc does not support. This makes me think you are using an unusual compiler. You should definitely not try to use plain old gcc to compile programs for an AVR.
Your avr-gcc version is exactly this one, which is recommended to solve this issue. Please refer to the link to arduino forum I enclosed in my first post. The avr-gcc 4.3.1 was mentioned as a buggy one and it is not longer available for Mandriva.
Under my virtual box with xp I can compile and run the example without any problem.
However I do not have mentioned by you avr-gcc. In the hardware\tools\avr\bin folder there is only gcc.
Just an update:
In order to get rid of mentioned issues it is necessary to add following flag -fno-use-cxa-atexit to avr-gcc >= V.4.4.x
Unfortunately it is not possible in arduino ide - no way to pass anything to gcc.
The (interim) solution for me was to migrate this project to netbeans. There it works fine.
I noticed that your version of avr-gcc in Mandriva Linux was compiled with the --enable-__cxa_atexit option. This is probably causing your problem. Are you able to compile example Arduino sketches for any other libraries?
Here is my avr-gcc -v version info from Ubuntu. It doesn’t have --enable-__cxa_atexit.
> Are you able to compile example Arduino sketches for any other libraries?
Some of them. Honestly this (PololuQTRSensors) was the first library which makes me some troubles.
Since I can go ahead with my project and we can influence neither standard gcc in Mandriva nor Arduino IDE let’s keep in mind -fno-use-cxa-atexit as the solution.
Anyway many thanks for your support and good pololu stuff.
Both gcc and the Arduino IDE are open source, so you should be able to compile your own version of them if you wanted to. I think it will be easier to compile Arduino than avr-gcc.
If your change works then you might be able to influence the person who made the avr-gcc package for Mandriva, or influence the Arduino team.