Author Topic: Problem with Build  (Read 8813 times)

Offline Rishahnu

  • Single posting newcomer
  • *
  • Posts: 4
Problem with Build
« on: September 21, 2009, 12:05:13 am »
Hi Folks,

I just installed Code::Blocks version 8.02 today, and it seems great so far, except for this problem when I try to build a project:

Quote
-------------- Build: Debug in RobostixStabilitySystem ---------------

Linking console executable: bin/Debug/RobostixStabilitySystem.elf
/usr/lib/libm.so: file not recognized: File format not recognized
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

I'm using the AVR-GCC compiler version 4.3.2 in Ubuntu version 9.04, and am compiling for the ATmega128. Any suggestions?

Thanks!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: Problem with Build
« Reply #1 on: September 21, 2009, 01:21:57 am »
Read the FAQ and turn on full compiler logging.
Verify the project is using correct compiler with proper project settings.

http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.
« Last Edit: September 21, 2009, 01:24:55 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Rishahnu

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problem with Build
« Reply #2 on: September 21, 2009, 01:38:29 am »
Thanks for the reply!

I turned on full compiler logging and now I get the following output:
Quote
-------------- Build: Debug in RobostixStabilitySystem ---------------

avr-g++ -L/usr/lib  -o bin/Debug/RobostixStabilitySystem.elf obj/Debug/main.o   -mmcu=atmega128 -Wl,-Map=bin/Debug/RobostixStabilitySystem.elf.map,--cref 
/usr/lib/libm.so: file not recognized: File format not recognized
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: Problem with Build
« Reply #3 on: September 21, 2009, 01:43:13 am »
A wild guess from a windows user; but, does "/usr/lib" contain the proper libraries for the embedded AVR compiler?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Problem with Build
« Reply #4 on: September 21, 2009, 07:17:07 am »
Is your system 64- or 32-bit ?

I'm not sure whether the avr-cross-linker should link against the systems libm.so, but it might be correct.
But if you have a 64-bit and need 32 it will not work.

In this case you need the 32-bit libs also, the package you need in this case is most likely ia32-libs-dev.
And you should use /usr/lib32/ as linker-searchpath in this case.

Please be aware, that all I posted is only correct, if the cross-compiler uses the systems libc6 and is 64-bit.


Most likely all wrong.

I just looked into the debian package list.
Do you have avr-libc installed ?

Quote from: description for avr-libc
Standard C library for Atmel AVR development

Standard library used to the development of C programs for the
Atmel AVR micro controllers. This package contains static
libraries as well as the header files needed.
« Last Edit: September 21, 2009, 07:25:59 am by jens »

Offline Rishahnu

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problem with Build
« Reply #5 on: September 21, 2009, 09:28:42 pm »
Yeah, I believe I do have avr-libc installed. Any idea how would I check to make sure?

My system is 64 bit, but I do think I already have the ia32-libs-dev package. I added it to the linker search path with no success...

Thanks for the continued help.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Problem with Build
« Reply #6 on: September 21, 2009, 09:39:08 pm »
You have /usr/lib in the linker search-path, that's normally wrong for cross-compiling, because it contains system-libs.
You might ned to explicitely set the path where the libm.so for your microcontroller is to the linker search paths.
dpkg -L <package-name> lists all files belonging to the package.
In your case dpkg -L avr-libc.

If it is not installed, you can install it with sudo apt-get install avr-libc.

Offline Rishahnu

  • Single posting newcomer
  • *
  • Posts: 4
Re: Problem with Build
« Reply #7 on: September 22, 2009, 04:19:31 pm »
Thanks! I changed the search location for the linker to lib32 instead of lib, and it now works!

Cheers!