Code::Blocks Forums

User forums => Help => Topic started by: Rishahnu on September 21, 2009, 12:05:13 am

Title: Problem with Build
Post by: Rishahnu 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!
Title: Re: Problem with Build
Post by: stahta01 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.
Title: Re: Problem with Build
Post by: Rishahnu 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
Title: Re: Problem with Build
Post by: stahta01 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.
Title: Re: Problem with Build
Post by: Jenna 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.
Title: Re: Problem with Build
Post by: Rishahnu 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.
Title: Re: Problem with Build
Post by: Jenna 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.
Title: Re: Problem with Build
Post by: Rishahnu 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!