You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to compile my own xmlsec based library and the examples and directly using the pkg-config flags the XMLSEC_CRYPTO definition causes errors due to the quote escaping. This is with xmlsec 1.2.20 on archlinux (no patches)
This is particularly frustrating at the moment as I'm writing a Go binding to libxml/libxslt/xmlsec and Go does not let me do anything to modify the results of pkg-config output when doing its thing.
GCC 4.9.1 Output:
gcc $(pkg-config --cflags --libs xmlsec1) sign1.c -o sign1 :(
<command-line>:0:16: warning: missing terminating " character
sign1.c: In function ‘main’:
sign1.c:93:5: error: stray ‘\’ in program
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
^
sign1.c:93:5: error: missing terminating " character
sign1.c:93:56: error: expected expression before ‘)’ token
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
^
clang 3.4.2 Output:
clang $(pkg-config --cflags --libs xmlsec1) sign1.c -o sign1 :(
In file included from <built-in>:161:
<command line>:1:24: warning: missing terminating '"' character [-Winvalid-pp-token]
#define XMLSEC_CRYPTO \"openssl\"
^
sign1.c:93:43: error: expected expression
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
^
<command line>:1:23: note: expanded from here
#define XMLSEC_CRYPTO \"openssl\"
^
sign1.c:184:43: warning: passing 'const char *' to parameter of type 'const xmlChar *' (aka 'const unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
^~~~~~~~
/usr/include/xmlsec1/xmlsec/keys.h:197:73: note: passing argument to parameter 'name' here
const xmlChar* name);
^
2 warnings and 1 error generated.
1 tburdick@rocket ~/src/xmlsec/examples (git)-[master] % clang --version :(
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Go output for my bindings:
go build
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
# github.com/bfrog/xml
<command-line>:0:16: warning: missing terminating " character
./xml.c: In function ‘init’:
./xml.c:43:5: error: stray ‘\’ in program
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
^
./xml.c:43:5: error: missing terminating " character
./xml.c:43:56: error: expected expression before ‘)’ token
if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {
^
Any ideas on how to solve this in the meantime would be really appreciated, for my own purposes I just ended up sticking the string literal for now temporarily into xmlSecCryptoDLLoadLibrary("openssl") like so but that seems fragile
The GCC error doesn't look like pkg-config problem and some clang errors look weird as well...
Unfortunately, I am not exactly sure what is the problem here. I've just tried on latest Ubuntu I have and it worked w/o problem. Do you have any problems running 'make' in the xmlsec1/examples folder?
[reply] [−] Comment 2 Tom Burdick [reporter] 2014-08-05 03:59:42 UTC
The makefile in the xmlsec/examples folder does something very different than what most users of pkg-config would be doing I'd think? Its assigning the results of a shell command to a variable first.
I unfortunately cannot do that with go as Cgo enforces some very specific meta comments in Go that let me do very little.
In either case even the pkg-config docs say to use pkg-config as I have here in their examples. I would think it should work.
It seems like maybe there's too many escapes or not enough escapes going on here?
Fixed by getting rid of XMLSEC_CRYPTO define. There is no good way to handle string defines in pkg-config. This might create backward compatibility problems though I made an effort to make it an unlikely event. Plus I think it is a better way forward anyway
* Tom Burdick [reporter] 2014-07-29 20:17:50 UTC*
When attempting to compile my own xmlsec based library and the examples and directly using the pkg-config flags the XMLSEC_CRYPTO definition causes errors due to the quote escaping. This is with xmlsec 1.2.20 on archlinux (no patches)
This is particularly frustrating at the moment as I'm writing a Go binding to libxml/libxslt/xmlsec and Go does not let me do anything to modify the results of pkg-config output when doing its thing.
GCC 4.9.1 Output:
clang 3.4.2 Output:
Go output for my bindings:
Any ideas on how to solve this in the meantime would be really appreciated, for my own purposes I just ended up sticking the string literal for now temporarily into xmlSecCryptoDLLoadLibrary("openssl") like so but that seems fragile
[reply] [−] Comment 1 Aleksey Sanin [xmlsec developer] 2014-08-04 16:04:34 UTC
The GCC error doesn't look like pkg-config problem and some clang errors look weird as well...
Unfortunately, I am not exactly sure what is the problem here. I've just tried on latest Ubuntu I have and it worked w/o problem. Do you have any problems running 'make' in the xmlsec1/examples folder?
[reply] [−] Comment 2 Tom Burdick [reporter] 2014-08-05 03:59:42 UTC
The makefile in the xmlsec/examples folder does something very different than what most users of pkg-config would be doing I'd think? Its assigning the results of a shell command to a variable first.
I unfortunately cannot do that with go as Cgo enforces some very specific meta comments in Go that let me do very little.
In either case even the pkg-config docs say to use pkg-config as I have here in their examples. I would think it should work.
It seems like maybe there's too many escapes or not enough escapes going on here?
http://golang.org/cmd/cgo/
http://people.freedesktop.org/~dbn/pkg-config-guide.html
Migrated from: https://bugzilla.gnome.org/show_bug.cgi?id=733935
The text was updated successfully, but these errors were encountered: