Author Topic: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'  (Read 26770 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12246
    • Travis build status
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #15 on: January 26, 2013, 07:35:41 pm »
BTW: Have you tried to right click in these logs? There is the handy option to copy the contents as text. :)

Also when posting the full build log, use the rebuild command :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Ralphxyz

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #16 on: January 26, 2013, 11:26:52 pm »
It's still showing the same errors we started with!
There is a problem with the linked compiler libraries (not knowing wha tI am talking about of course).

-------------- Clean: Debug in StepperJoy (compiler: GNU AVR GCC Compiler)---------------

Cleaned "StepperJoy - Debug"

-------------- Build: Debug in StepperJoy (compiler: GNU AVR GCC Compiler)---------------

avr-gcc.exe -Wall -mmcu=atmega328p -DF_CPU=14745600  -g    -IC:\WinAVR-20090313\avr\include -IC:\NERDKITS\Code\libnerdkits -IC:\WinAVR-20100110\avr\include  -c fuse.c -o obj\Debug\fuse.o
avr-gcc.exe -Wall -mmcu=atmega328p -DF_CPU=14745600  -g    -IC:\WinAVR-20090313\avr\include -IC:\NERDKITS\Code\libnerdkits -IC:\WinAVR-20100110\avr\include  -c main.c -o obj\Debug\main.o
main.c: In function 'main':
main.c:133: warning: unused variable 'i'
avr-g++.exe -LC:\WinAVR-20090313\avr\lib  -o bin\Debug\StepperJoy.elf obj\Debug\fuse.o obj\Debug\main.o   -mmcu=atmega328p -Wl,-Map=bin\Debug\StepperJoy.map,--cref  C:\NERDKITS\Code\libnerdkits-328p\delay.c C:\NERDKITS\Code\libnerdkits-328p\delay.h C:\NERDKITS\Code\libnerdkits-328p\delay.o C:\NERDKITS\Code\libnerdkits-328p\io_328p.h C:\NERDKITS\Code\libnerdkits-328p\lcd.c C:\NERDKITS\Code\libnerdkits-328p\lcd.h C:\NERDKITS\Code\libnerdkits-328p\lcd.o C:\NERDKITS\Code\libnerdkits-328p\uart.c C:\NERDKITS\Code\libnerdkits-328p\uart.h C:\NERDKITS\Code\libnerdkits-328p\uart.o
C:\WinAVR-20090313\avr\lib\libc.a(vfprintf_std.o): In function `vfprintf':
(.text+0xd4): undefined reference to `__mulhi3'
C:\WinAVR-20090313\avr\lib\libc.a(vfprintf_std.o): In function `vfprintf':
(.text+0xe4): undefined reference to `__mulhi3'
C:\WinAVR-20090313\avr\lib\libc.a(calloc.o): In function `calloc':
(.text+0x14): undefined reference to `__mulhi3'
Process terminated with status 1 (0 minutes, 0 seconds)
3 errors, 1 warnings (0 minutes, 0 seconds)
 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12246
    • Travis build status
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #17 on: January 26, 2013, 11:33:08 pm »
Now, if you compare this log to the one from the command line, which works. what are the differences?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Ralphxyz

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #18 on: January 26, 2013, 11:37:36 pm »
Quote
Now, if you compare this log to the one from the command line, which works. what are the differences?

Sorry I do not know how to get a log from the command line.

I just run "make" , that compiles my .c code following a Makefile.

There might be a option I could put in the Makefile??

Ralph

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12246
    • Travis build status
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #19 on: January 26, 2013, 11:40:17 pm »
It depends on the makefile, look at it and edit it. Some makefiles support VERBOSE=1.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Ralphxyz

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #20 on: January 26, 2013, 11:57:43 pm »
I am running:

 GNU Make 3.81

and I do not believe I am running the same compiler from the command line as I do in Code::Blocks

From the command line I am running:

gcc version 4.3.3 (WinAVR 20100110)

The Code:Blocks is running something from WinAVR-20090313

I do not know how to see the version in Code::Blocks.

Ralph

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #21 on: January 27, 2013, 12:05:56 am »
So look at your makefile where the compiler is installed and make sure the avr toolchain im C::B uses the same compiler.

Offline Ralphxyz

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #22 on: January 27, 2013, 03:32:22 am »
Quote
So look at your makefile where the compiler is installed and make sure the avr toolchain im C::B uses the same compiler.

I have gone completely through the Code:Blocks Toolchain pointing to the C:\WinAVR-20100110 folder instead of the default C:\WinAVR-20090313 folder but still get the same errors looking in the WinAVR-20090313 folder.

The WinAVR-20090313 is persistent, in fact there is lots of persistents in the Code::Blocks install if you uninstall and reinstall it still remembers your prior projects, I even went through regedit removing all references to CodeBlocks and a new install still knew about prior projects.

So finally I Googled "undefined reference to `__mulhi3'" and see that there has been a lot discussion on fixing this problem.

One of the most common fixes was to use the -lm flag but how? I do not see anywhere to set the flags.

Now if I was building Code::Blocks from the source files I'd understand this error but seeing as I am just trying to run a default install I just do not understand why I am getting this Compiler Linking error, if that is what it is.

Thanks so much for all of the help.

I will try changing the command line compiler, if I knew how would help.

Ralph

Offline Ralphxyz

  • Multiple posting newcomer
  • *
  • Posts: 18
 :D Solution

I renamed the C:\WinAVR-20090313 folder to zWinAVR-20090313.

Then I ran the Code::Blocks Compiler/Toolchain executables Auto-detect.

Now it found C:\WinAVR-20100110 and instantiated it.

TaDah, it works!!

Here is the Build Log:


-------------- Build: Debug in StepperJoy (compiler: GNU AVR GCC Compiler)---------------

avr-g++.exe -LC:\WinAVR-20090313\avr\lib  -o bin\Debug\StepperJoy.elf obj\Debug\fuse.o obj\Debug\main.o   -mmcu=atmega328p -Wl,-Map=bin\Debug\StepperJoy.map,--cref  C:\NERDKITS\Code\libnerdkits-328p\delay.c C:\NERDKITS\Code\libnerdkits-328p\delay.h C:\NERDKITS\Code\libnerdkits-328p\delay.o C:\NERDKITS\Code\libnerdkits-328p\io_328p.h C:\NERDKITS\Code\libnerdkits-328p\lcd.c C:\NERDKITS\Code\libnerdkits-328p\lcd.h C:\NERDKITS\Code\libnerdkits-328p\lcd.o C:\NERDKITS\Code\libnerdkits-328p\uart.c C:\NERDKITS\Code\libnerdkits-328p\uart.h C:\NERDKITS\Code\libnerdkits-328p\uart.o
Output size is 48.66 KB
Running project post-build steps
avr-size --mcu=atmega328p --format=avr bin\Debug\StepperJoy.elf
AVR Memory Usage
----------------
Device: atmega328p
Program:    9538 bytes (29.1% Full)
(.text + .data + .bootloader)
Data:        299 bytes (14.6% Full)
(.data + .bss + .noinit)
cmd /c "avr-objdump -h -S bin\Debug\StepperJoy.elf > bin\Debug\StepperJoy.lss"
avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex bin\Debug\StepperJoy.elf bin\Debug\StepperJoy.hex
avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex bin\Debug\StepperJoy.elf bin\Debug\StepperJoy.eep
avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O ihex bin\Debug\StepperJoy.elf bin\Debug\StepperJoy.lock
avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O ihex bin\Debug\StepperJoy.elf bin\Debug\StepperJoy.sig
avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O ihex bin\Debug\StepperJoy.elf bin\Debug\StepperJoy.fuse
srec_cat bin\Debug\StepperJoy.fuse -Intel -crop 0x00 0x01 -offset  0x00 -O bin\Debug\StepperJoy.lfs -Intel
srec_cat bin\Debug\StepperJoy.fuse -Intel -crop 0x01 0x02 -offset -0x01 -O bin\Debug\StepperJoy.hfs -Intel
srec_cat bin\Debug\StepperJoy.fuse -Intel -crop 0x02 0x03 -offset -0x02 -O bin\Debug\StepperJoy.efs -Intel
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 0 warnings (0 minutes, 2 seconds)
 
Strange no "unused -i" warnings but maybe that is covered in the compile.

Now to move on to my next question!!

Thanks again for the help.

Ralph

Offline LETARTARE

  • Regular
  • ***
  • Posts: 395
  • L'ami de l'homme.The friend of man.
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #24 on: January 27, 2013, 10:32:00 am »
hello,
what is :
Code: [Select]
-LC:\WinAVR-20090313\avr\libsince this directory does not exist ?
Cordially.
C::B  : svn11911, wx-3.1.1, plugins : QtPregen-2.7.2-sdk146
1-Vista Business Pack 2 32bits : gcc-8.1.0,
2-OpenSuse-15.1-Leap 64bits :  gcc-7.4.1,
=> !! The messages are translated by Deepl !!

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #25 on: January 27, 2013, 11:16:18 am »
hello,
what is :
Code: [Select]
-LC:\WinAVR-20090313\avr\libsince this directory does not exist ?
Cordially.
This is surely a manual setting, either in project/target settings or in the compiler toolchain.
In any case it an incorrect configuration done by the user not by C::B, and it's the cause for the OP's problem.

The WinAVR-20090313 is persistent, in fact there is lots of persistents in the Code::Blocks install if you uninstall and reinstall it still remembers your prior projects, I even went through regedit removing all references to CodeBlocks and a new install still knew about prior projects.
User settings should always be persistent through install or new install.
C::B does not store anything in the registry.
The only thing there are the file associations, but that's the windows way to do it, no way to work around. And this is of course not the cause for the issue.


Offline Ralphxyz

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #26 on: January 27, 2013, 04:21:32 pm »
Quote
what is :
Code:
-LC:\WinAVR-20090313\avr\lib
Quote
In any case it an incorrect configuration done by the user not by C::B, and it's the cause for the OP's problem.

Nope, I didn't set any configurations just hit Auto detect after moving C:\WinAVR-20090313 out of the way!!

Ralph




Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12246
    • Travis build status
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #27 on: January 27, 2013, 04:33:49 pm »
Then inspect your project and the compiler settings for this path and remove it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Ralphxyz

  • Multiple posting newcomer
  • *
  • Posts: 18
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #28 on: January 27, 2013, 05:58:20 pm »
Quote
Insert Quote
Then inspect your project and the compiler settings for this path and remove it.

Interesting I can not find any reference to C:\WinAVR-20090313\avr\lib but the -LC:\WinAVR-20090313\avr\lib
still shows up.

Quote
-------------- Build: Debug in StepperJoy (compiler: GNU AVR GCC Compiler)---------------

avr-g++.exe -LC:\WinAVR-20090313\avr\lib

In fact I no longer have a C:\WinAVR-20090313 folder on my system.

Also I do not see any place to set a -L flag.

In the Global compiler settings on the first tab there is a tab "Compiler Flags" but no -L option.

So this "-LC:\WinAVR-20090313\avr\lib" setting is not something I am doing but part of the default install.

As it is it doesn't hurt anything I am now able to Build my projects since I am using a newer (WinAVR-20100110) Toolchain.

Ralph

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12246
    • Travis build status
Re: undefined reference to '__mulhi3' In function 'vfprintf': and 'calloc'
« Reply #29 on: January 27, 2013, 06:05:05 pm »
In the Global compiler settings on the first tab there is a tab "Compiler Flags" but no -L option.
Have you tried the other tabs? What about the Search Directories -> Linker?

This starts to get really annoying.
Please make sure you've clicked on every button in the Global compiler settings and in Project -> Properties before posting your next post.
Also make sure you've read the user manual. If you don't understand it read it again.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]