LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: 基督山伯爵

(已解决)求助,mysql编译问题。cannot find -lgcc_s collect2: ld returned 1 exit st

[复制链接]
发表于 2009-6-11 12:31:18 | 显示全部楼层
静态编译后,程序比较大,因为原本像.so的动态库的内容也编译进去了,此时不再需要.so动态库
动态编译即把库单独编译出.so文件,主程序会小很多,主程序启动时,再去加载.so库
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-14 21:03:43 | 显示全部楼层
根据手册的提示,新添加了参数,编译通过。
完整编译参数如下:
[PHP]
./configure --prefix=/app/mysql \
--libdir=/usr/lib \
--with-mysqld-user=mysql \
--without-debug \
--with-big-tables \
--with-zlib-dir=bundled \
--with-extra-charsets=all \
--with-pthread \
--enable-static \
--enable-thread-safe-client \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--enable-assembler \
--with-ssl \
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
[/PHP]
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-14 21:07:09 | 显示全部楼层
友情提示:
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
这二个参数在Fedora9/10上无法编译。据说是fedora未提供相关的信赖包。CentOS5/Redhat5无此问题。
感叹一下:Fedora越做越水了。。。。。。
回复 支持 反对

使用道具 举报

发表于 2009-6-14 21:14:34 | 显示全部楼层
CFLAGS="-O3"

不要用-O3, 用-O2
回复 支持 反对

使用道具 举报

发表于 2009-6-14 21:25:02 | 显示全部楼层
Post by ginkgo;1997851
CFLAGS="-O3"

不要用-O3, 用-O2


为啥呢?……
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-14 21:32:53 | 显示全部楼层
Post by grissiom;1997853
为啥呢?……


同问
凑字凑字
回复 支持 反对

使用道具 举报

发表于 2009-6-14 21:51:02 | 显示全部楼层
具体的我不是太清楚,不过用-O3优化,Patric 大神好像不是很赞同。slackware的脚本里面都用的是-O2, 我看python 的脚本注意到

  1. # Normally I don't trust -O3, but it is the Python default so
  2. # I'll assume that in this case it has been well tested.
复制代码


这个还要看大家的习惯,不过-O3 比 -O2 快不了太多,如果不是有特殊的要求,还是稳妥为好。
这个符合slackware的哲学。
回复 支持 反对

使用道具 举报

发表于 2009-6-14 22:03:57 | 显示全部楼层
Post by ginkgo;1997870
具体的我不是太清楚,不过用-O3优化,Patric 大神好像不是很赞同。slackware的脚本里面都用的是-O2, 我看python 的脚本注意到
  1. # Normally I don't trust -O3, but it is the Python default so
  2. # I'll assume that in this case it has been well tested.
复制代码

这个还要看大家的习惯,不过-O3 比 -O2 快不了太多,如果不是有特殊的要求,还是稳妥为好。
这个符合slackware的哲学。

没错,不止Slackware,以订制和优化著称的Gentoo和ArchLinux相关手册里都不推荐使用-O3。
回复 支持 反对

使用道具 举报

发表于 2009-6-14 23:35:05 | 显示全部楼层
这里有:

http://www.gentoo.org/doc/en/gcc-optimization.xml#doc_chap2_sect3
#  -O3: This is the highest level of optimization possible, and also the riskiest. It will take a longer time to compile your code with this option, and in fact it should not be used system-wide with gcc 4.x. The behavior of gcc has changed significantly since version 3.x. In 3.x, -O3 has been shown to lead to marginally faster execution times over -O2, but this is no longer the case with gcc 4.x. Compiling all your packages with -O3 will result in larger binaries that require more memory, and will significantly increase the odds of compilation failure or unexpected program behavior (including errors). The downsides outweigh the benefits; remember the principle of diminishing returns. Using -O3 is not recommended for gcc 4.x.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-6-15 01:20:09 | 显示全部楼层
那参数:
CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
是否也要改成:
CXXFLAGS="-O2 -felide-constructors -fno-exceptions -fno-rtti"
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表