之前必须确定
openssl 和 Mysql 安装了,如果你不想安装这两个可以在下面的排除选项中排除它. 我这里不需要ODBC和 SQListe,安装路径为 /usr ,它会把头文件安装在/usr/include/Poco下, lib文件安装在 usr/lib下
参数解释:--omit 排除(不编译的),--prefix安装路径
> sudo ./configure
--omit=Data/ODBC,Data/SQLite--prefix=/usr
--static --shared
> sudo make -s install
PS:
如果没有 --static --shared默认为
shared 不编译静态库
如果在x64的系统下使用到静态库 .记得一定要加-fPIC,动态库不用.
./configure --omit=Data/ODBC,Data/SQLite --prefix=/usr
--cflags=-fPIC --static
gmake -s install
否则会出现这类的错误:
/usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../
....
can not be used when making a shared object; recompile with
-fPIC
如果你的是Centos x64 z可能会报一些没有库的错误.
例如
* Building executable (debug)
/root/poco-1.4.3p1-all/PageCompiler/bin/Linux/x86_64/static/cpspcd
/usr/bin/ld: cannot find -lpthread
collect2: ld returned 1 exit status
make[1]: ***
[/root/poco-1.4.3p1-all/PageCompiler/bin/Linux/x86_64/static/cpspcd]
Error 1
make: *** [PageCompiler-libexec] Error 2
这个表示没有找到共享库libpthread
可以在 /usr 下搜索一下这个库在哪, 然后做个软链接到
/user/lib64 下就行了.
例如:
[root@localhost ~]# find /usr/ -name
libpthread* /usr/lib/x86_64-redhat-linux5E/lib64/libpthread_nonshared.a
/usr/lib/x86_64-redhat-linux5E/lib64/libpthread.so
/usr/lib/x86_64-redhat-linux5E/lib64/libpthread.a
/usr/lib64/libpthread_nonshared.a
/usr/lib64/libpthread.so
/usr/lib64/libpthread.a