Category Archives: Compiler

Solaris 10 x86上编译Apache HTTPD 2.2.24 with SSL

Apache HTTPD 2.2.24 在Solaris 10 x86上编译,使用命令是:
./configure –enable-proxy –enable-ssl

只要求SSL和proxy,遇到很多问题,现记录2个:
1.  No recognized SSL/TLS toolkit detected
Solution: 加上了–with-ssl=dir,命令成为
./configure –with-ssl=/usr/local/ssl –enable-proxy –enable-ssl

2.  Error, SSL/TLS libraries were missing or unusable
Solution: 安装了openssl 1.0.0j,1.0.0e都不行

 

Install MySQLdb module of Python on Solaris/Solaris 10上安装Python的MySQLdb模块

Reason: Solaris 10 自带的python是forte c++编译的,所以和gcc编译的软件一起工作会有很多问题。The built-in python of Solaris 10 is compiled by forte c++, normally we want to use gcc as the default compiler. This will cause some errors:

 

root@felix1 [/data1/soft/MySQL-python-1.2.4] # python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.solaris-2.10-i86pc-2.6/MySQLdb
running build_ext
building ‘_mysql’ extension
creating build/temp.solaris-2.10-i86pc-2.6
/usr/lib/python2.6/pycc -DNDEBUG -KPIC -Dversion_info=(1,2,4,’final’,1) -D__version__=1.2.4 -I/opt/mysql/include -I/usr/include/python2.6 -c _mysql.c -o build/temp.solaris-2.10-i86pc-2.6/_mysql.o -g
gcc: unrecognized option `-KPIC’
In file included from _mysql.c:44

 

为了避免该问题我们可以需要使用全都用gcc编译的软件一起工作。包括python和mysql。To avoid this we need to use a python which compiled by GCC. We need a mysql compiled by GCC as well. Download python from www.sunfreeware.com and download 32bit mysql from mysql.com and install them.

从sourceforge上下载MySQLdb模块源代码,设置环境变量/Download MySQLdb from sf.net and setup the environment:

 

root@felix1 [/data1/soft/MySQL-python-1.2.4] # export LD_LIBRARY_PATH=/usr/local/mysql/lib:/opt/mysql/lib:/lib:/usr/lib:/usr/local/lib:/usr/local/mysql/lib
root@felix1 [/data1/soft/MySQL-python-1.2.4] # PATH=/usr/local/mysql/bin:$PATH
root@felix1 [/data1/soft/MySQL-python-1.2.4] # python setup.py build

running build
running build_py
copying MySQLdb/release.py -> build/lib.solaris-2.10-i86pc-2.6/MySQLdb
running build_ext
building ‘_mysql’ extension
gcc -shared build/temp.solaris-2.10-i86pc-2.6/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lthread -lsocket -lnsl -lm -lrt -o build/lib.solaris-2.10-i86pc-2.6/_mysql.so

root@felix1 [/data1/soft/MySQL-python-1.2.4] # python setup.py install

你就会安装MySQLdb模块到/usr/local下的python了。此时因为_mysql.so已经编译完成,所以就算你切换回系统python,执行python setup.py install,也会得到一个正确的安装的模块。
You’ll install the module to python under /usr/local. Now the _mysql.so is built, so even you switch to the /usr/bin/python, execute ‘python setup.py install’, you’ll get a good module as well

 

Install Mysql from Source on Solaris/Solaris 上从源代码安装Mysql

To prevent the compiling problem with the “gcc: unrecognized option `-KPIC'” error, we can build a copy of gcc-compiled mysql and install the DBI-mysql for Perl or Mysql-Python interface for Python on Solaris.

1. Download GA source code from mysql.com
2. Uncompress it
3. Download “cmake” and “libidn” from sunfreeware.com and use “pkgadd” to add them
4. Then run:
> cmake -D CMAKE_INSTALL_PREFIX:PATH=/opt/mysql -D MYSQL_DATADIR:PATH=/opt/mysql/data .
> make
> make install
You’ll get your own mysql compiling versiong by GCC