在Solaris10x86下用gcc編譯Poco1.4.6-創(chuàng)新互聯(lián)

一、 系統(tǒng)環(huán)境

創(chuàng)新互聯(lián)主要從事成都網(wǎng)站制作、成都網(wǎng)站設計、網(wǎng)頁設計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務。立足成都服務東寶,十年網(wǎng)站建設經(jīng)驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:18982081108

操作系統(tǒng)原始環(huán)境如下:

$ uname -a

SunOS sol10u6 5.10 Generic_137138-09 i86pc i386 i86pc

$ /usr/sfw/bin/gcc -v

Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs

Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared

Thread model: posix

gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

$ /usr/ccs/bin/ld -V

ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.490

$ gmake --version

GNU Make 3.80

Copyright (C) 2002  Free Software Foundation, Inc.

This is free software; see the source for copying conditions.

There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A

PARTICULAR PURPOSE.

$ /usr/sfw/bin/gld --version

GNU ld version 2.15

Copyright 2002 Free Software Foundation, Inc.

This program is free software; you may redistribute it under the terms of

the GNU General Public License.  This program has absolutely no warranty.

二、 安裝補丁包

Solaris 10 x86自帶的gcc版本為3,4.3,指定鏈接器為/usr/ccs/bin/ld,但是在poco對應gcc編譯器的配置文件build/config/SunOS-GCC中,指定的鏈接器參數(shù)是GNU ld格式的,編譯時會報出許多跟鏈接器有關的警告及錯誤,所以,必須強制gcc使用GNU ld。我不知道gcc是不是可以通過命令行參數(shù)來指定所使用的鏈接器,我是通過重命名系統(tǒng)自帶的/usr/ccs/bin/ld文件,然后在/usr/ccs/bin/下建立一個符號連接,指向GNU ld來達到這一目的的。

系統(tǒng)自帶的GNU ld版本為2.15,此版本的GNU ld有一個bug,在Solaris 10中,將許多在Solaris 9中原本處于.bbs段的符號移到了.abs段,而GNU ld不會處理.abs中導出的符號,導致在鏈接時報許多符號找不到的錯誤。在GNU binutils 2006年的bug郵件列表里詳細討論了此問題及解決方法。我不太確定GNU ld具體是在哪一個版本里修正了此bug,我下載的2.21.1版本的binutil二進制包中已經(jīng)修正了此bug。binutils依賴于以下的包:libiconv,libintl,zlib,libgcc-3.4.6或者c-3.4.6。必須安裝這些包才能順利編譯poco,各個包安裝的先后次序沒有要求。安裝完各個包之后,先將系統(tǒng)自帶的/usr/ccs/bin/ld重命名,然后ln -s /usr/local/bin/ld  ld建議一個符號連接。

www.sourceware.org/bugzilla/show_bug.cgi?id=1021

通過命令pkgadd -d filename安裝以下包:

binutils-2.21.1a-sol10-x86-local

gcc-3.4.6-sol10-x86-local

libiconv-1.14-sol10-x86-local

libintl-3.4.0-sol10-x86-local

zlib-1.2.7-sol10-x86-local

安裝完成后環(huán)境如下:

$ which gcc

/usr/local/bin/gcc

$ /usr/local/bin/gcc -v

Reading specs from /usr/local/lib/gcc/i386-pc-solaris2.10/3.4.6/specs

Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --enable-shared --enable-languages=c,c++,f77

Thread model: posix

gcc version 3.4.6

$ ls -l /usr/ccs/bin/ld

lrwxrwxrwx  1 root   root      17 Jan 25 11:15 /usr/ccs/bin/ld -> /usr/local/bin/ld

$ /usr/local/bin/ld --version

GNU ld (GNU Binutils) 2.21.1

Copyright 2011 Free Software Foundation, Inc.

This program is free software; you may redistribute it under the terms of

the GNU General Public License version 3 or (at your option) a later version.

This program has absolutely no warranty.

三、 修改poco配置文件

1.編輯build/config/SunOS-GCC文件,找到以下行:

#

# System Specific Libraries

#

SYSLIBS  = -lpthread -ldl -lrt

修改為:

#

# System Specific Libraries

#

SYSLIBS  = -lrt -lsocket -lnls

On S10 libpthread is an empty filter on libc, which is a fancy way of saying that all of the code in libthread moved to libc and libpthread is just a shell saying as much so that older programs linked with libpthread can still run.

gld is choking on Solaris libraries that are filters.

http://www.mentby.com/Group/sqlite-users/build-problem-of-sqlite-36142-on-solaris-10-with-gcc-440.html

2.編輯build/rules/global文件,找到以下行:

#

# Build Include directory List

#

INCLUDE = $(foreach p,$(POCO_ADD_INCLUDE),-I$(p)) -Iinclude $(foreach p,$(COMPONENTS),-I$(POCO_BASE)/$(p)/$(INCDIR))

#

# Build Library Directory List

#

LIBRARY = $(foreach p,$(POCO_ADD_LIBRARY),-L$(p)) -L$(LIBPATH:) $(POCO_LIBRARY)

修改為:

#

# Build Include directory List

#

INCLUDE = $(foreach p,$(POCO_ADD_INCLUDE),-I$(p)) -Iinclude -I/usr/sfw/include -

I/usr/sfw/include/mysql $(foreach p,$(COMPONENTS),-I$(POCO_BASE)/$(p)/$(INCDIR))

#

# Build Library Directory List

#

LIBRARY = $(foreach p,$(POCO_ADD_LIBRARY),-L$(p)) -L/usr/sfw/lib -L$(LIBPATH) $(

POCO_LIBRARY)

======

3.運行configure生成配置文件:

$ ./configure --prefix=$HOME/poco --config=SunOS-GCC --omit=Data/ODBC,Data/MySQL

Configured for SunOS-GCC

另外有需要云服務器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。

網(wǎng)站欄目:在Solaris10x86下用gcc編譯Poco1.4.6-創(chuàng)新互聯(lián)
文章源于:http://muchs.cn/article24/posce.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站網(wǎng)站建設、網(wǎng)站維護小程序開發(fā)軟件開發(fā)、營銷型網(wǎng)站建設

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化