您好,登錄后才能下訂單哦!
一、 系統環境
操作系統原始環境如下:
$ 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中,指定的鏈接器參數是GNU ld格式的,編譯時會報出許多跟鏈接器有關的警告及錯誤,所以,必須強制gcc使用GNU ld。我不知道gcc是不是可以通過命令行參數來指定所使用的鏈接器,我是通過重命名系統自帶的/usr/ccs/bin/ld文件,然后在/usr/ccs/bin/下建立一個符號連接,指向GNU ld來達到這一目的的。
系統自帶的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二進制包中已經修正了此bug。binutils依賴于以下的包:libiconv,libintl,zlib,libgcc-3.4.6或者c-3.4.6。必須安裝這些包才能順利編譯poco,各個包安裝的先后次序沒有要求。安裝完各個包之后,先將系統自帶的/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
安裝完成后環境如下:
$ 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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。