带有gSoap的C静态程序

时间:2016-02-25 16:13:56

标签: c++ c gsoap

我正在尝试使用gSoap构建一个静态程序。

我使用以下命令编译程序:

gcc -c -Wall -g  -I./gSoap/   -I/usr/share/gsoap/plugin/    -c -o singlePayment.o singlePayment.c
gcc -o singlePayment singlePayment.o ./gSoap/soapC.c ./gSoap/soapClient.c  -lgsoapssl   -L/usr/lib/mysql -L/usr/lib -L/lib -lmysqlclient -lssl  -lz  -lcrypto -Wl,--no-as-needed -ldl -static -fno-stack-protector

程序运行后出错:

 *** stack smashing detected ***: ./singlePayment terminated
======= Backtrace: =========
[0x6ee755]
[0x6ee71e]
[0x59aa2a]
[0x59ab34]
[0x57fcfe]
[0x400762]
[0x6aa4a3]
[0x400469]
======= Memory map: ========
00400000-00833000 r-xp 00000000 08:01 6687104                            /home/valon/paypalSOAP/singlePayment
00a32000-00a43000 rw-p 00432000 08:01 6687104                            /home/valon/paypalSOAP/singlePayment
00a43000-00a72000 rw-p 00000000 00:00 0
017e5000-01863000 rw-p 00000000 00:00 0                                  [heap]
7f2cc5007000-7f2cc501a000 r-xp 00000000 08:01 9962058                    /lib/x86_64-linux-gnu/libresolv-2.13.so
7f2cc501a000-7f2cc5219000 ---p 00013000 08:01 9962058

              ...

7ffe8ffe7000-7ffe8ffe8000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Abgebrochen

如果我将其视为无静态,那么相同的程序也可以工作。

gcc -c -Wall -g  -I./gSoap/   -I/usr/share/gsoap/plugin/    -c -o singlePayment.o singlePayment.c
gcc -o singlePayment singlePayment.o ./gSoap/soapC.c ./gSoap/soapClient.c /usr/share/gsoap/plugin/logging.c   -lm -lgsoapssl -lssl

任何想法为什么会发生这种情况?

1 个答案:

答案 0 :(得分:1)

您似乎正在使用OpenSSL。如果是,请使用<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:key name="krel" match="THIS" use="ID"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="ALLDATA"> <xsl:copy> <xsl:apply-templates select="THIS[generate-id() = generate-id(key('krel', ID)[1])]" /> </xsl:copy> </xsl:template> <xsl:template match="THIS/RELATIONSHIPS"> <xsl:copy> <xsl:apply-templates select="key('krel', ../ID)/RELATIONSHIPS/rel"/> </xsl:copy> </xsl:template> </xsl:stylesheet> 进行编译,以确保您可以使用gcc -DWITH_OPENSSL函数,soap_ssl_X中声明的引擎上下文将启用SSL。