News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

a problem compiling eeprom of avr(atmega16,winavr) program

Started by zage2009, August 03, 2011, 02:39:22 PM

Previous topic - Next topic

scarphin

It's not CB that links to the wrong library, it's gcc that links to the 'libc.a' in the root folder (lib/) that doesn't have the corresponding functions. The correct one being in the 'lib/avr5/' folder has the corresponding functions and gcc links to it if it can't access to the one in the root (lib/). Or if u change the 'lib/libc.a' with the correct one 'lib/avr5/libc.a' everything goes fine with the linkage. It's quite clear that gcc looks for the 'libc.a' first in the root folder and finds first the wrong 'libc.a' version and stops linking. I'm guessing u have a setting somewhere that bypasses the root folder 'lib/' somehow. I don't think it's related to CB but I think it's a missing setting in CB.

zage2009

I really hope that the link problems of avr-gcc and other aspect's problems aren't too many.

Jenna

Is it possible, that avr-gcc and mingw is mixed, both using the same root-folder ?
Just a wild guess.

scarphin


scarphin

Aelxx: I checked ur settings file and couldn't find any specific setting regarding the issue. It also didn't build and gave the same linker error. Thnx for the help though.

Jens: I checked for an interference between my mingw and avr-gcc installations and found nothing. Thnx for the idea.

I ran out of ideas, I think I'll try 'avrfreaks' when I have time.

scarphin

After further tweaking I think I've found the reason. I had the '$winavr/avr/lib' folder in the 'search directories' for the linker. When this is removed, linker finds the correct 'libc.a' somehow and everything builds ok. Aelxx's configuration doesn't have this folder included that was the reason he didn't have linker problems. I'm not sure if it's CB or me added this folder in the 'linker search dirs' but if it is CB, it shouldn't do it anymore for the avr-gcc. Shoud I make a bug report about this?

zage2009

I reinstall cb10.05 and WinAVR-20100110 in  windows xp and windows7 which are installed in vmware Workstation and I find that in winxp there still is the '$winavr/avr/lib' folder in the 'search directories' for the linker,but in win7  the 'search directories' for the linker is empty and everything builds ok.I guess that Aelxx probably uses CB and WinAVR in win7.Just the difference between the operating system causes the problem?

scarphin

Did u also delete the CB settings in the 'C:\Documents and Settings\$user$\Application Data\codeblocks' folder when reinstalling on XP? Those are the settings CB uses when launched. But afaik CB adds the folders 'avr/include/' and 'avr/lib/'. From what it seems the latter shouldn't be added. The reason that these are not added on Win7 might be something else. Can any dev help us out here pls?

Aelxx

scarphin - Glad you found your problem's solution.
Zage2009 - No. I use WinXP SP3, C::B rev6454 or Later. I keep my old C::B configurations after reinstalling C::B. And also after reinstalling winAvr I always do manual compiler configuration in C::B, cause C::B doesn't autodetect avr-gcc (IMHO), maybe at this step I remove '$winavr/avr/lib' - can't say, cause I don't remember. Guess scarphin is right and it's some C::B's AVR-GCC compiler configuration bug, and I was lucky not to hit it  :D

Jenna

Quote from: Aelxx on August 12, 2011, 09:45:19 AM
scarphin - Glad you found your problem's solution.
Zage2009 - No. I use WinXP SP3, C::B rev6454 or Later. I keep my old C::B configurations after reinstalling C::B. And also after reinstalling winAvr I always do manual compiler configuration in C::B, cause C::B doesn't autodetect avr-gcc (IMHO), maybe at this step I remove '$winavr/avr/lib' - can't say, cause I don't remember. Guess scarphin is right and it's some C::B's AVR-GCC compiler configuration bug, and I was lucky not to hit it  :D

Thes settings are made if you use autodetection, otherwise they stay empty.

scarphin

Well we are all lucky one of us hit that bug. ;) Can someone pls try building on linux and see if 'avr/lib' should be there in the search path or not, possibly a dev pls?

zage2009

Quote from: jens on August 12, 2011, 09:50:33 AM
Quote from: Aelxx on August 12, 2011, 09:45:19 AM
scarphin - Glad you found your problem's solution.
Zage2009 - No. I use WinXP SP3, C::B rev6454 or Later. I keep my old C::B configurations after reinstalling C::B. And also after reinstalling winAvr I always do manual compiler configuration in C::B, cause C::B doesn't autodetect avr-gcc (IMHO), maybe at this step I remove '$winavr/avr/lib' - can't say, cause I don't remember. Guess scarphin is right and it's some C::B's AVR-GCC compiler configuration bug, and I was lucky not to hit it  :D

Thes settings are made if you use autodetection, otherwise they stay empty.
I reinstall the win7 in vmware Workstation and install the WinAVR,CB10.05(rev6283) in Win7.The result is that the option 'winavr/avr/lib' is still in the Linker tab of the Search directions and perhaps there still is the same problem in different operation system.

scarphin

It's sure CB adds 'avr/lib' folder automatically to the linker search path. The problem is if it should do this or not. Can someone test under linux and see if the problem also exits on linux or not pls? So the devs can remove it in the next nightly if adding 'avr/lib' to the search path generates this linker problem also under linux.

Jenna

Quote from: scarphin on August 12, 2011, 01:45:28 PM
It's sure CB adds 'avr/lib' folder automatically to the linker search path. The problem is if it should do this or not. Can someone test under linux and see if the problem also exits on linux or not pls? So the devs can remove it in the next nightly if adding 'avr/lib' to the search path generates this linker problem also under linux.


There is another thread about a similar problem on linux.
Here is one of my answers:
http://forums.next.codeblocks.org/index.php/topic,15118.msg101248.html#msg101248

scarphin

Yes I'm aware of that thread. Correct me if I'm wrong but the situation there is the inclusion of the GCC libs not the avr-gcc specific libs. As from what I understand someone needs to make sure the problem still exists or not if avr-gcc specific linker libs 'avr/lib' not 'usr/lib' is included. Sry for the trouble if these 2 cases are the same or both libs are installed in the same folder under linux. It's been long since I used linux, just trying to help. ;)