2016-08-01 46 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