在OpenSolaris上从源代码安装MySQL
经历了不下十次以上的 configure make和make install,
终于搞定了。 归咎起来还是Opensolaris上软件的缺乏和不完整性。
之前一直用gcc编译,但一直会出现ld连接错误。
安装步骤:
- Install Sun compilers by issuing the following command: pfexec pkg install ss-dev. The tools are installed in /opt/SunStudioExpress.
- Prepare the user environment for MySQL by issuing the following commands:
- groupadd mysql
- useradd -g mysql mysql
- Become the mysql user with su mysql.
- Download the latest MySQL source from dev.mysql.com. I downloaded the compressed GNU TAR archive (tar.gz) version 5.1.29-rc from here.
- Extract the MySQL source code from the archive with the commands below. The source code will be extracted to mysql-5.1.29-rc.
- gunzip mysql-5.1.29-rc.tar.gz
- tar xvf mysql-5.1.29-rc.tar
- Set the following environment variables:
- export CC=/opt/SunStudioExpress/bin/cc
- export CXX=/opt/SunStudioExpress/bin/CC
- export CFLAGS="-xO3" #Change this to have your compiler variables
- export CXXFLAGS="-xO3"
- export PATH=$CC:$CXX:/usr/sfw/bin:/usr/ccs/bin:$PATH
- Create a sym link from gmake to make with cd /usr/sfw/bin ; ln -s gmake make
- cd to the source code directiory. In my case mysql-5.1.29-rc.
- Execute the following command at the prompt: ./configure --prefix=/usr/local/mysql
- The
configure command allows you to control the configuration of the MySQL
source distribution. A full listing of the options to configure can be
found here. Prefix simply installs architecture-independent files in the location specified by prefix (everything is installed under
/usr/local/mysqlrather than the default of/usr/local). - Execute the following command at the prompt: make
- Execute the following command at the prompt: make install
Very cool! Congrats on the pairing.
Posted by tiffany & co Bangle on November 13, 2009 at 03:00 PM CST #