2016-08-01 85 views
1

我已经将gcc从版本4.6更新到5.4。要清楚,我有两个版本,我使用的是sudo update-alternatives --config g ++在版本之间切换。Gccv5.4未定义引用`__normal___udivdi3'

[email protected]:~/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: 

[email protected]:~/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 

我建立U-Boot的源代码(最新的Git版本的x86),用gcc编译器。当我使用4.6版本时,构建很好。 但是,当我使用gcc版本5.4构建失败,错误消息,

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 

我不知道为什么发生这种情况,关于这个主题的帮助将是有益的。

[email protected]:~/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. 

回答

0

问题是我的笔记本电脑是64位系统和U-Boot的是建立在32位模式为Minnowboard目标(86)

安装的gcc版本multilib的,解决这个问题。

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

看起来好像你没有CONFIG_USE_PRIVATE_LIBGCC设置。

+0

号其在配置文件中启用./configs/minnowmax_defconfig:CONFIG_USE_PRIVATE_LIBGCC=y – evk1206

+0

OK的,有趣的。你使用的是什么版本的U-Boot?我几乎每天都构建x86的所有版本,但使用gcc-5.3而不是5.4。 –

+0

使用gcc-4.6编译没有问题,但是使用gcc-5.4构建破解,u-boot是v2016.07-rc1-271-g9f82361 – evk1206