extra defines for static linking

Roumen Petrov <[email protected]> Sat, 10 Jun 2017 18:12:57 +0300
Newsgroups gmane.text.xml.xmlsec
Message-ID <[email protected]>
Hi ,

Please find attahced patch 0002-extra-defines-for-static-linking.patch - 
it resolves build configuration with --enable-static-linking . Tested 
for x86_64-w64-mingw32 host.

For protocol build error is
   CCLD     xmlsec1.exe
xmlsec.o: In function `xmlSecAppSignFile':
.../apps/xmlsec.c:1172: undefined reference to `__imp_xmlSecDSigNs'
.../apps/xmlsec.c:1172: undefined reference to `__imp_xmlSecNodeSignature'

No idea why only -DXMLSEC_STATIC is enough to resolve issue.


Regression tests fail but tests fail even on native linux build :

strace shows
...
futex(0x7fc64a2ccc88, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, 
"func=xmlSecPtrListAdd:file=list.c:line=287:obj=unknown:subj=xmlSecPtrListIsValid(list):error=100:assertion: 
\n", 
109func=xmlSecPtrListAdd:file=list.c:line=287:obj=unknown:subj=xmlSecPtrListIsValid(list):error=100:assertion: 

) = 109
write(2, 
"func=xmlSecKeyDataIdsRegister:file=keysdata.c:line=103:obj=aes:subj=xmlSecPtrListAdd:error=1:xmlsec 
library function failed: \n", 
126func=xmlSecKeyDataIdsRegister:file=keysdata.c:line=103:obj=aes:subj=xmlSecPtrListAdd:error=1:xmlsec 
library function failed:
) = 126
write(2, 
"func=xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms:file=dl.c:line=540:obj=aes:subj=xmlSecKeyDataIdsRegister:error=1:xmlsec"..., 
155func=xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms:file=dl.c:line=540:obj=aes:subj=xmlSecKeyDataIdsRegister:error=1:xmlsec 
library function failed:
) = 155
write(2, 
"func=xmlSecOpenSSLInit:file=crypto.c:line=332:obj=unknown:subj=xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms:error=1:xmlse"..., 
156func=xmlSecOpenSSLInit:file=crypto.c:line=332:obj=unknown:subj=xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms:error=1:xmlsec 
library function failed:
) = 156
write(2, "Error: xmlSecCryptoInit failed\n", 31Error: xmlSecCryptoInit 
failed
) = 31
write(2, "Error: xmlsec crypto intialization failed.\n", 43Error: xmlsec 
crypto intialization failed.
) = 43
write(2, "Error: initialization failed\n", 29Error: initialization failed
) = 29
fstat(1, {st_mode=S_IFREG|0644, st_size=30364, ...}) = 0
...


Regards,
Roumen

P.S. It is more easy to post patch to mail list instead to open github 
pull request.

_______________________________________________
xmlsec mailing list
[email protected]
http://www.aleksey.com/mailman/listinfo/xmlsec
0002-extra-defines-for-static-linking.patch (text/x-diff, 743 B)
From ed18ed545fe9eacbe22375c552631666d22f6710 Mon Sep 17 00:00:00 2001
From: Roumen Petrov <[email protected]>
Date: Sun, 28 May 2017 14:01:47 +0300
Subject: [PATCH 2/2] extra defines for static linking

---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index acdc22b..e8a8c9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1570,6 +1570,7 @@ AC_MSG_CHECKING(for static linking)
 AC_ARG_ENABLE(static_linking,   [  --enable-static-linking enable static linking (no)])
 if test "z$enable_static_linking" = "zyes" ; then
     XMLSEC_STATIC_BINARIES="-static"
+    XMLSEC_APP_DEFINES="$XMLSEC_APP_DEFINES -DXMLSEC_STATIC=1"
     AC_MSG_RESULT(yes)
 else
     AC_MSG_RESULT(no)
-- 
1.8.3.1