08月 13th, 2008 OpenSolaris编译安装gcc4.3.1成功
编译时间为1小时零12分钟,调试错误的时间累计就不知道多少了。要编译的语言为c,c++,f95。之前出过N多的错误,因为时间过去太久了,有些错误的名字记不太清楚了,只大概地写一下:
Fatal error in reader: makefile, line XXX: Unexpected end of line seen
解决这个问题,需要安装gmake,因为OpenSolaris中自带的语法和gnu make的语法可能不一样。
接下去碰到的问题,是采用以下编译选项的:
1 2 3 | ./configure --prefix=/usr/local \ --with-gnu-ld=/usr/gnu/bin/ld; \ gmake all |
出错提示有很多,都记不太清了,比如:
configure: error: cannot compute suffix of object files: cannot compile
[gmake] *** cannot create rule to make target `all' ***
ld errors: no .eh_frame_hdr table will be created.
在网上找到这个网页:http://www.linuxidc.com/Linux/2008-07/14125p2.htm
看到如下的configure选项:
1 2 3 4 5 6 7 8 9 10 11 12 | ./configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-clocale=gnu --disable-libstdcxx-pch --disable-multilib --enable-languages=c,c++,f95 |
第1,2,3不是关键选项。继续查找资料,第4项在gcc的README里面说明了是默认打开的。第5项我把posix改成了solaris,第6项在有glibc的情况下下才有用,第7,8,9,10没找到相关说明,第11项是禁止多个平台的库都编译(我觉得我过去几天没编译成功的原因很可能就是这样的,因为总是在AMD64相关的目录下编译,我的机子可是i386啊…),最后一项指定要安装的语言,我下的是core包和自己要装的语言包,就用不着这个命令了。
所以最后选定编译选项为:
1 2 3 4 | ./configure --prefix=/usr/local \ --enable-threads=posix \ --disable-multilib \ --with-gnu-ld=/usr/gnu/bin/ld |
make的时候命令是
1 | make bootstrap |
它显式指定了bootstrap,但是我看到帮助文档上说默认是开启了3-stage的bootstrap模式的,所以我觉得这也不是关键。
中途只报了一个错,错误的内容大致是
libgcc.map has not a good format and tries without success to use it as ld script
查到解决方案是,把/gcc-4.3.1/gcc/config/t-slibgcc-sld文件第13行修改一下,把-M参数改为-Map参数,修改后的那一行如下:
1 | -Wl,-Map,$(SHLIB_MAP) -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp \ |
然后重新configure XXX, gmake bootstrap, gmake install
整个过程真是艰辛阿,而且gcc编译出来之后发现,原来不是gcc的问题,还得想办法找glibc在OpenSolaris上的porting。
如果您喜欢本站的内容,欢迎订阅我的RSS以获取本站最新资讯。
大中华局域网用户订阅地址:http://feed.casparant.com/
国际互联网用户订阅地址:http://feeds.casparant.com/casparant
Related Posts
---------- COPYRIGHT (C) CasparAnt.COM 2008 ----------
本站所有文章均遵循“创作共用条款(CC)3.0版本”, 允许转载演绎本站文章,仅需遵循以下原则:保留文章出处(URL及站名Caspar Ant), 并且给我一个 引用通告(trackback)。如果您觉得本站的文章很好,欢迎选择下面的网络书签收藏本文; 如果您觉得本站值得浏览,欢迎点击侧边栏进行订阅;欢迎您对文章发表评论,您的留言是对我最好的鼓励!
This entry is under CREATIVE COMMON ATTRIBUTION 3.0 LICENSE. Please remain "Caspar Ant" and the URL stay in your site when you share or remix this entry. It's necessary to give me a trackback from your own site. If you think this entry is good enough, welcome to put it to your own web bookmark. You can select from the bookmark sites at follows:

















