您好,登錄后才能下訂單哦!
引:
現(xiàn)用的gsoap版本是2.7版本,gsoap代碼在sourceforge上維護,版本維護工具是SVN。gsoap 2.7有多個小版本,最新的是2.7.17。這個2.7.17版本sf頁面,顯示的最后修改時間是2016-09-22,點進去后,看到的gsoap_2.7.17.zip的最后修改時間是1010-05-09,這個可能是版本文件夾創(chuàng)建于2016-09-22。OK,扯遠了,現(xiàn)在要說的是。綜合各種現(xiàn)象判斷gsoap2.7是基于openssl 1.0以前的版本,依賴于BIO結(jié)構(gòu)。而openssl自1.0及以后的版本,不在公開BIO的結(jié)構(gòu),將該結(jié)構(gòu)隱藏起來。凡是外部引用BIO結(jié)構(gòu)的APP或者庫,就會報告這個BIO類型的變量size不確定,原因就是openssl 1.0以后BIO結(jié)構(gòu)的聲明不再存在于openssl公開的頭文件里了。這個東西只是在openssl的changes(相當于release notes)文件里說明了下,官方的文檔并沒有指出來。而后來爆出來的openssl 0.98及以前的版本存在嚴重漏洞,會使***者獲得ssl加密的明文,所以如果要使用ssl加密業(yè)務(wù)交互重的數(shù)據(jù),就要升級到openssl 0.98以上,在openssl官方公布的版本里,0.98以上就是1.0及以上。
綜合以上問題,gsoap的2.7版本基本上要被棄用了,要轉(zhuǎn)入到gsoap 2.8版本。今天要做的事情,就是建立gsoap 2.8 + openssl 1.1.0e的體系支持。openssl 1.1.0e的編譯前文章已經(jīng)有敘述解決,本文就gsoap 2.8的編譯就以說明。
1.準備
gsoap2.8.46的版本功能增強,依賴的包也相對較多。采用cygwin 32來編譯gsoap至少需要以下工具及庫:
1)flex develop
2)yacc develop
3)openssl 1.1.0e
2.編譯配置
本次的目標是生成cygwin 32里可運行的gsoap工具,如下:
soapcpp2.exe wsdl2h.exe
所以配置就在cygwin里默認。
#./configure --prefix=/usr/local/gsoap-utils
然后就是需要修改gsoap-2.8/config.h的文件,gsoap的配置工具在檢測strtod_l/strtof_l等函數(shù)的可用性,和make會有不一致的問題。配置工具檢測使用gcc去檢測,檢測到strtod_l/strtof_l函數(shù),只會報告warning,說此函數(shù)是隱式聲明。而在編譯時,用的g++去編譯,就會報錯,說‘strtod_l’在此作用域中尚未聲明。這個是gcc和g++編譯器的差異。根本原因在于stdlib.h確實有聲明這個函數(shù),libc庫確實有這個函數(shù)實現(xiàn),但是stdlib里的聲明上卻有一個宏來控制,如下:
#if __GNU_VISIBLE
double strtod_l (const char *__restrict, char **__restrict, locale_t);
float strtof_l (const char *__restrict, char **__restrict, locale_t);
而__GNU_VISIBLE又受__GNU_SOURCE的控制,而在編譯時,這個宏默認是不打開的,所以就產(chǎn)生了有定義無聲明,gcc檢測有,g++編譯報錯的問題。
那么解決這個問題的方法就是,修改gcc檢測根據(jù)監(jiān)測結(jié)果后生成的config.h,將這個文件里的對應(yīng)的聲明修改。如下:
#define HAVE_STRTOD_L 1
修改為
//#define HAVE_STRTOD_L 1
#define HAVE_STRTOF_L 1
修改為
//#define HAVE_STRTOF_L 1
#define HAVE_STRTOLD_L 1
修改為
//#define HAVE_STRTOLD_L 1
3.編譯安裝
#make
#make install
make install會將對應(yīng)的工具安裝到--prefixc參數(shù)指定的目錄/usr/local/gsoap-utils。
附生成后gsoap SDK。
raynard.wang@cmp_cpyb01 /usr/local/gsoap-utils
$ du -a
1392 ./bin/soapcpp2.exe
15836 ./bin/wsdl2h.exe
17228 ./bin
148 ./include/stdsoap2.h
148 ./include
908 ./lib/libgsoap++.a
564 ./lib/libgsoap.a
948 ./lib/libgsoapck++.a
596 ./lib/libgsoapck.a
1016 ./lib/libgsoapssl++.a
656 ./lib/libgsoapssl.a
1 ./lib/pkgconfig/gsoap++.pc
1 ./lib/pkgconfig/gsoap.pc
1 ./lib/pkgconfig/gsoapck++.pc
1 ./lib/pkgconfig/gsoapck.pc
1 ./lib/pkgconfig/gsoapssl++.pc
1 ./lib/pkgconfig/gsoapssl.pc
10 ./lib/pkgconfig
4702 ./lib
12 ./share/gsoap/custom/chrono_duration.cpp
4 ./share/gsoap/custom/chrono_duration.h
8 ./share/gsoap/custom/chrono_time_point.cpp
4 ./share/gsoap/custom/chrono_time_point.h
8 ./share/gsoap/custom/duration.c
4 ./share/gsoap/custom/duration.h
8 ./share/gsoap/custom/float128.c
4 ./share/gsoap/custom/float128.h
8 ./share/gsoap/custom/int128.c
4 ./share/gsoap/custom/int128.h
8 ./share/gsoap/custom/long_double.c
4 ./share/gsoap/custom/long_double.h
8 ./share/gsoap/custom/long_time.c
4 ./share/gsoap/custom/long_time.h
8 ./share/gsoap/custom/qbytearray_base64.cpp
4 ./share/gsoap/custom/qbytearray_base64.h
8 ./share/gsoap/custom/qbytearray_hex.cpp
4 ./share/gsoap/custom/qbytearray_hex.h
8 ./share/gsoap/custom/qdate.cpp
4 ./share/gsoap/custom/qdate.h
8 ./share/gsoap/custom/qdatetime.cpp
4 ./share/gsoap/custom/qdatetime.h
8 ./share/gsoap/custom/qstring.cpp
4 ./share/gsoap/custom/qstring.h
8 ./share/gsoap/custom/qtime.cpp
4 ./share/gsoap/custom/qtime.h
8 ./share/gsoap/custom/README.txt
8 ./share/gsoap/custom/struct_timeval.c
4 ./share/gsoap/custom/struct_timeval.h
8 ./share/gsoap/custom/struct_tm.c
8 ./share/gsoap/custom/struct_tm.h
8 ./share/gsoap/custom/struct_tm_date.c
4 ./share/gsoap/custom/struct_tm_date.h
216 ./share/gsoap/custom
4 ./share/gsoap/extras/ckdb.c
4 ./share/gsoap/extras/ckdb.h
4 ./share/gsoap/extras/ckdbtest.c
1 ./share/gsoap/extras/ckdbtest.h
4 ./share/gsoap/extras/fault.cpp
4 ./share/gsoap/extras/logging.cpp
1 ./share/gsoap/extras/README.txt
4 ./share/gsoap/extras/soapdefs.h
30 ./share/gsoap/extras
4 ./share/gsoap/import/c14n.h
4 ./share/gsoap/import/dom.h
20 ./share/gsoap/import/ds.h
20 ./share/gsoap/import/ds2.h
4 ./share/gsoap/import/plnk.h
4 ./share/gsoap/import/README.txt
4 ./share/gsoap/import/ref.h
80 ./share/gsoap/import/saml1.h
96 ./share/gsoap/import/saml2.h
1 ./share/gsoap/import/ser.h
4 ./share/gsoap/import/soap12.h
4 ./share/gsoap/import/stdstring.h
4 ./share/gsoap/import/stl.h
4 ./share/gsoap/import/stldeque.h
4 ./share/gsoap/import/stllist.h
4 ./share/gsoap/import/stlset.h
4 ./share/gsoap/import/stlvector.h
4 ./share/gsoap/import/vprop.h
4 ./share/gsoap/import/WS-example.c
4 ./share/gsoap/import/WS-example.h
4 ./share/gsoap/import/WS-Header.h
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。