Discussion:
[xmlsec] Include file order
Peter Budai
2018-06-08 09:44:18 UTC
Permalink
With the latest release I have noticed that the build under MSYS2/MINGW is failing with the following message:
../../../src/openssl/x509.c:109:66: error: expected declaration specifiers or '...' before '(' token
static xmlChar* xmlSecOpenSSLX509NameWrite (X509_NAME* nm);
^
../../../src/openssl/x509.c: In function 'xmlSecOpenSSLX509SubjectNameNodeWrite':

More detailed build log you can see here: https://ci.appveyor.com/project/peterbud/xmlsec/build/job/sc82e41xseg7c391#L494

The problem in my understanding is that Windows headers also #define some names that openssl uses too. Openssl headers #undef the offending names before reusing them. But if those offending Windows headers get included _after_ the openssl headers the namespace gets polluted.

As a solution I have changed the include order in the openssl/x509.c and openssl/x50vfy.c files, aka moved the openssl includes as the last files to include, and that solved the problem, I was able to compile and execute all the tests.

However I’m not sue this is the right solution. Any opinion?

Peter
Aleksey Sanin
2018-06-08 16:44:29 UTC
Permalink
Interesting. Looks like libxslt is now including some windows crypto
code that triggered this issue.

I think changing includes order should be fine. Nothing in xmlsec
should depend on includes order. Do you mind sending a PR?

Aleksey

On 6/8/18 2:44 AM, Peter Budai wrote:
>  
>
> With the latest release I have noticed that the build under MSYS2/MINGW
> is failing with the following message:
>
> ../../../src/openssl/x509.c:109:66: error: expected declaration
> specifiers or '...' before '(' token
>
> static xmlChar* xmlSecOpenSSLX509NameWrite (X509_NAME* nm);
>
> ^
>
> ../../../src/openssl/x509.c: In function
> 'xmlSecOpenSSLX509SubjectNameNodeWrite':
>
>  
>
> More detailed build log you can see here:
> https://ci.appveyor.com/project/peterbud/xmlsec/build/job/sc82e41xseg7c391#L494
>
>  
>
> The problem in my understanding is that Windows headers also #define
> some names that openssl uses too. Openssl headers #undef the offending
> names before reusing them. But if those offending Windows headers get
> included _/after/_ the openssl headers the namespace gets polluted.
>
>  
>
> As a solution I have changed the include order in the openssl/x509.c and
> openssl/x50vfy.c files, aka moved the openssl includes as the last files
> to include, and that solved the problem, I was able to compile and
> execute all the tests.
>
>  
>
> However I’m not sue this is the right solution. Any opinion?
>
>  
>
> Peter
>
>
>
> _______________________________________________
> xmlsec mailing list
> ***@aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec
>
Peter Budai
2018-06-09 07:59:26 UTC
Permalink
I’ll send a PR shortly, no problem



Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10



________________________________
From: Aleksey Sanin <***@aleksey.com>
Sent: Friday, June 8, 2018 6:44:29 PM
To: Peter Budai; ***@aleksey.com
Subject: Re: [xmlsec] Include file order

Interesting. Looks like libxslt is now including some windows crypto
code that triggered this issue.

I think changing includes order should be fine. Nothing in xmlsec
should depend on includes order. Do you mind sending a PR?

Aleksey

On 6/8/18 2:44 AM, Peter Budai wrote:
>
>
> With the latest release I have noticed that the build under MSYS2/MINGW
> is failing with the following message:
>
> ../../../src/openssl/x509.c:109:66: error: expected declaration
> specifiers or '...' before '(' token
>
> static xmlChar* xmlSecOpenSSLX509NameWrite (X509_NAME* nm);
>
> ^
>
> ../../../src/openssl/x509.c: In function
> 'xmlSecOpenSSLX509SubjectNameNodeWrite':
>
>
>
> More detailed build log you can see here:
> https://ci.appveyor.com/project/peterbud/xmlsec/build/job/sc82e41xseg7c391#L494
>
>
>
> The problem in my understanding is that Windows headers also #define
> some names that openssl uses too. Openssl headers #undef the offending
> names before reusing them. But if those offending Windows headers get
> included _/after/_ the openssl headers the namespace gets polluted.
>
>
>
> As a solution I have changed the include order in the openssl/x509.c and
> openssl/x50vfy.c files, aka moved the openssl includes as the last files
> to include, and that solved the problem, I was able to compile and
> execute all the tests.
>
>
>
> However I’m not sue this is the right solution. Any opinion?
>
>
>
> Peter
>
>
>
> _______________________________________________
> xmlsec mailing list
> ***@aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec
>
Aleksey Sanin
2018-06-11 16:28:11 UTC
Permalink
Thank you!

Aleksey

On 6/9/18 12:59 AM, Peter Budai wrote:
> I’ll send a PR shortly, no problem
>
>  
>
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>  
>
> ------------------------------------------------------------------------
> *From:* Aleksey Sanin <***@aleksey.com>
> *Sent:* Friday, June 8, 2018 6:44:29 PM
> *To:* Peter Budai; ***@aleksey.com
> *Subject:* Re: [xmlsec] Include file order
>  
> Interesting. Looks like libxslt is now including some windows crypto
> code that triggered this issue.
>
> I think changing includes order should be fine. Nothing in xmlsec
> should depend on includes order. Do you mind sending a PR?
>
> Aleksey
>
> On 6/8/18 2:44 AM, Peter Budai wrote:
>>  
>>
>> With the latest release I have noticed that the build under MSYS2/MINGW
>> is failing with the following message:
>>
>> ../../../src/openssl/x509.c:109:66: error: expected declaration
>> specifiers or '...' before '(' token
>>
>> static xmlChar* xmlSecOpenSSLX509NameWrite (X509_NAME* nm);
>>
>> ^
>>
>> ../../../src/openssl/x509.c: In function
>> 'xmlSecOpenSSLX509SubjectNameNodeWrite':
>>
>>  
>>
>> More detailed build log you can see here:
>> https://ci.appveyor.com/project/peterbud/xmlsec/build/job/sc82e41xseg7c391#L494
>>
>>  
>>
>> The problem in my understanding is that Windows headers also #define
>> some names that openssl uses too. Openssl headers #undef the offending
>> names before reusing them. But if those offending Windows headers get
>> included _/after/_ the openssl headers the namespace gets polluted.
>>
>>  
>>
>> As a solution I have changed the include order in the openssl/x509.c and
>> openssl/x50vfy.c files, aka moved the openssl includes as the last files
>> to include, and that solved the problem, I was able to compile and
>> execute all the tests.
>>
>>  
>>
>> However I’m not sue this is the right solution. Any opinion?
>>
>>  
>>
>> Peter
>>
>>
>>
>> _______________________________________________
>> xmlsec mailing list
>> ***@aleksey.com
>> http://www.aleksey.com/mailman/listinfo/xmlsec
>>
>
>
> _______________________________________________
> xmlsec mailing list
> ***@aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec
>
Loading...