Search code examples
gccu-boot

Gccv5.4 undefined reference to `__normal___udivdi3'


I have updated the gcc from version 4.6 to 5.4. To be clear, I have both the versions I am using the sudo update-alternatives --config g++ to switch between the versions.

vies7605@eso9265:~/Projects/u-boot/u-boot-x86$ sudo update-alternatives --config g++
There are 2 choices for the alternative g++ (providing /usr/bin/g++).

  Selection    Path              Priority   Status
------------------------------------------------------------
  0            /usr/bin/g++-4.6   20        auto mode
  1            /usr/bin/g++-4.6   20        manual mode
* 2            /usr/bin/g++-5     20        manual mode

Press enter to keep the current choice[*], or type selection number: 

vies7605@eso9265:~/Projects/u-boot/u-boot-x86$ sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path              Priority   Status
------------------------------------------------------------
  0            /usr/bin/gcc-4.6   20        auto mode
  1            /usr/bin/gcc-4.6   20        manual mode
* 2            /usr/bin/gcc-5     20        manual mode

I am building the u-boot source code(latest git version x86), with the gcc compiler. When I am using the version 4.6 the build is fine. But when I use the gcc version 5.4 the build fails with the error message,

arch/x86/lib/built-in.o: In function `__wrap___udivdi3':
/home/vies7605/Projects/u-boot/u-boot-x86/arch/x86/lib/gcc.c:25: undefined reference to `__normal___udivdi3'
make: *** [u-boot] Error 1

I am not sure why this is happening, any help on this topic will be helpful.

vies7605@eso9265:~/Projects/u-boot/u-boot-x86$ gcc --version
gcc (Ubuntu 5.4.0-3ubuntu1~12.04) 5.4.0 20160603
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Solution

  • The problem is my laptop is 64 bit system and the u-boot is built in 32 bit mode for Minnowboard target(x86)

    Installing multilib version of gcc , solves the issue.

    sudo apt-get install gcc-6-multilib g++-6-multilib 
    sudo apt-get install gcc-5-multilib g++-5-multilib