Author Topic: a problem compiling eeprom of avr(atmega16,winavr) program  (Read 31751 times)

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #15 on: August 07, 2011, 01:10:24 pm »
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

  • Guest
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #16 on: August 07, 2011, 02:50:03 pm »
I really hope that the link problems of avr-gcc and other aspect's problems aren't too many.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #17 on: August 07, 2011, 03:47:35 pm »
Is it possible, that avr-gcc and mingw is mixed, both using the same root-folder ?
Just a wild guess.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #18 on: August 07, 2011, 04:53:41 pm »
Worth a try, I'll check it out but don't think so.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #19 on: August 08, 2011, 12:55:23 pm »
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.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #20 on: August 11, 2011, 07:19:04 pm »
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

  • Guest
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #21 on: August 12, 2011, 02:47:59 am »
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?

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #22 on: August 12, 2011, 09:38:51 am »
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?

Offline Aelxx

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #23 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

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #24 on: August 12, 2011, 09:50:33 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.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #25 on: August 12, 2011, 10:01:45 am »
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

  • Guest
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #26 on: August 12, 2011, 12:26:57 pm »
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.

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #27 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.

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #28 on: August 12, 2011, 01:54:18 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.codeblocks.org/index.php/topic,15118.msg101248.html#msg101248

Offline scarphin

  • Lives here!
  • ****
  • Posts: 644
Re: a problem compiling eeprom of avr(atmega16,winavr) program
« Reply #29 on: August 12, 2011, 02:34:07 pm »
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. ;)