免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 10848 | 回复: 11

用icc来编译内核 [复制链接]

论坛徽章:
0
发表于 2005-11-14 09:53 |显示全部楼层

论坛徽章:
0
发表于 2005-11-14 10:09 |显示全部楼层
成功了

安装intel c++ compiler
这步在intel的网站上有 有RPM方式与非RPM方式安装
照做就行

第二步 使用ICC编译内核 我是
CC=icc make bzImage modules modules_install 的
不知道有没起作用

最后是安装nv驱动
把usr/src/nv/conftest.sh中一个地方修改一下
也就是
cc_check那块的
把exit 1修改成exit 0
没有改前make install 会报错 cc_check就是那个报错的标签
修改后成功

编译nv时我是
rm /usr/bin/gcc;ln -s /usr/bin/icc /usr/bin/gcc

论坛徽章:
0
发表于 2005-11-14 11:44 |显示全部楼层
牛!icc应该是gcc之后的第一个能编译linux内核的编译器

论坛徽章:
0
发表于 2005-11-14 16:42 |显示全部楼层
速度有优势么

论坛徽章:
0
发表于 2005-11-14 17:53 |显示全部楼层

论坛徽章:
0
发表于 2005-11-16 12:12 |显示全部楼层
安装使用intel C++ compiler7.1 小记

有关intel cpp compiler(简称icc,但是icc作为其一个命令,只是这个软件包的ia32 cpu的cpp编译器)的介绍可以参见:(  http://www.linuxsir.com/bbs/showthread.php?s=&threadid=42324)。为什么要使用这个编译器呢?
1. linux下面要编译只有gcc,change一下未尝不可。
2. icc针对intel cpu进行优化,照intel网站上面所说是maxium the speed. 这里有一篇评测,从中可以看出不仅p4得到提高,就算是p3,icc的代码在速度上也很有优势。
http://www.linuxsir.com/bbs/showthread.php?s=&threadid=42324
3. 编译的速度提高,在上面测试中可以找到,我也做了一个小比较,在后面。
4. 文档很少,摸着石头过河,很有意思。

首先说安装

在intel注册然后得到一个license文件和下载地址
http://www.intel.com/software/products/compilers/clin/noncom.htm
或者
在这里下载安装包
http://gentoo.oregonstate.edu/distfiles/l_cc_p_7.1.006.tar

在这里下载license文件
ftp://linuxsir:linuxsir@218.6.242.103/upload/l_cpp_26602777.lic

然后将lic文件拷贝到/opt/intel/licenses,执行install安装icc
安装完成之后将icc所在的目录添加到path里面,把/opt/intel/...../lib 添加到ld.so.conf里面执行ldconfig。将/opt/intel/comp.../man/icc.1 拷贝到/usr/share/man/man1/

我用的是bash205b,但是好象不支持icc脚本里面的exec -a,执行icc会出现错误:
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x1: undefined reference to `main'
所以编辑icc脚本将里面exec -a 的 -a和后面的路经去掉。 exec /opt/intel/compiler70/ia32/bin/iccbin "$@"; 象这样。

接着执行icc,如果得到
iccbin: Command line error: no files specified; for help type "iccbin -help"
就是安装好了。

然后说软件包的编译。
首先设置环境变量,用icc代替gcc。并且使用icc自己的linker。
export LD=xild
export AR=xiar
export CC=icc
export CXX=icc

优化参数上面不太一样,我的设置是
export CFLAGS="-march=pentiumiii -O2"
export CXXFLAGS="-march=pentiumiii -O2 "

注意icc的march参数和gcc的设置不一样,比如gcc里面是pentium3. 具体可以看man icc

接着,如果不出意外就可以编译了。
我尝试编译了distcc,bash205b,gnet,都没有问题。

编译时间上面我做了一个比较,用icc编译bash205b
real 1m7.926s
user 0m41.750s
sys 0m10.510s
同样情况下面gcc
real 1m49.384s
user 1m21.770s
sys 0m9.380s

论坛徽章:
0
发表于 2005-11-16 12:26 |显示全部楼层
以前不是听说要对内核patch才能用icc, 现在不用了吗?

论坛徽章:
1
处女座
日期:2013-08-19 12:39:10
发表于 2005-12-09 22:48 |显示全部楼层
Hi, I have been successful at getting the Intel C/C++ compiler to work in Debian. Here's what I did. Hope it helps.
--
Dan

1) Download Linux version of compiler and extract rpm's
2) Use alien to convert the rpm's to .deb packages
3) Install the deb packages, and copy your license to /opt/intel/cc/9.0/licenses directory
4) Replace every occurance of <INSTALLDIR> with /opt/intel/cc/9.0 for every file in /opt/intel/cc/9.0/bin. The script below will do this for you. Save it as replace.sh, make it executable, and then call:

replace.sh "<INSTALLDIR>" "\/opt\/intel\/cc\/9.0" /opt/intel/cc/9.0/bin


#!/bin/bash

fileList=`grep -l $1 $3/*`

for file in $fileList
do
echo "$file"
sed "s/$1/$2/g" $file > $file.new
mv $file.new $file
done

论坛徽章:
0
发表于 2007-07-19 16:56 |显示全部楼层
谢谢,有用,支持一下.

论坛徽章:
0
发表于 2007-07-31 14:52 |显示全部楼层
ICC已经到9了啊!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP