溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

在Solaris 10 x86下用gcc編譯Poco 1.4.6

發(fā)布時間:2020-08-15 15:25:35 來源:網(wǎng)絡(luò) 閱讀:747 作者:al0n9 欄目:編程語言

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

操作系統(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.

二、 安裝補(bǔ)丁包

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

系統(tǒng)自帶的GNU ld版本為2.15,此版本的GNU ld有一個bug,在Solaris 10中,將許多在Solaris 9中原本處于.bbs段的符號移到了.abs段,而GNU ld不會處理.abs中導(dǎo)出的符號,導(dǎo)致在鏈接時報許多符號找不到的錯誤。在GNU binutils 2006年的bug郵件列表里詳細(xì)討論了此問題及解決方法。我不太確定GNU ld具體是在哪一個版本里修正了此bug,我下載的2.21.1版本的binutil二進(jìn)制包中已經(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.運(yùn)行configure生成配置文件:

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

Configured for SunOS-GCC



向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI