You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@serf.apache.org by Branko Čibej <br...@apache.org> on 2018/06/23 10:59:11 UTC

SCons considered terminally broken

I've been working on getting Serf built on Windows x64 with OpenSSL
1.1.0. I noticed that the function checks in SCons (Config.CheckFunc)
that we use to find OpenSSL features were not working correctly. After
some digging around in OpenSSL import libraries, SCons sources and the
config.log file, I found the following:

1. Behaviour of Config.CheckFunc(function[, header]):

SCons generates a test program that contains a call to 'function()'.
This turns out to be quite problematic.

2. CheckFunc without the optional header parameter:

When the test program is built, the compiler issues a warning about a
missing prototype for 'function', assumes it's an "extern returning
int". However, linking fails because the linker looks for the decorated
function name '_function', but the names exported from the OpenSSL
libraries (static or DLL import lib) are not decorated, so, just
'function'. The names don't match, the link fails and SCons happily
assumes that the function does not exist.

3. CheckFunc /with/ the optional header parameter:

The compiler now sees the function prototype and, since most functions
require parameters, errors out because the call to 'function()' as
generated by SCons is invalid. Again, SCons happily assumes that the
function does not exist.

4. Conclusion:

I do have an opinion about Windows name decoration that's not for public
consumption. But in this case, I think that SCons is simply doing the
wrong thing by blindly generating the function call. For comparison,
autoconf does the same *but* also generates a prototype that overrides
any compiler builtins, and doesn't include any headers in the test program.

Finally, has anyone successfully built 64-bit Serf with OpenSSL 1.1.0 on
Windows? If yes, how? Because I can't think of how this could be
possible with SCons failing the way it does.

FWIW: a 32-bit build of Serf and OpenSSL works.

-- Brane


Re: SCons considered terminally broken

Posted by Greg Stein <gs...@gmail.com>.
On Sat, Jun 23, 2018, 13:23 Greg Stein <gs...@gmail.com> wrote:

> On Sat, Jun 23, 2018, 13:07 Branko Čibej <br...@apache.org> wrote:
>
>> On 23.06.2018 19:53, Greg Stein wrote:
>> > I think you have suggested CMake in the past? ... I would support any
>> > build system that does Unix and Windows (which obviates autoconf)
>>
>> Not that I like CMake, but in my experience it does work better
>> cross-platform than SCons. So yes, I started working on a CMake-based
>> build just today. I'll
>
>
> Haha... Imagine that :-)
>

Just realized you had committed your experiment an hour before my email!
Guess I should read all my email first...

Re: SCons considered terminally broken

Posted by Greg Stein <gs...@gmail.com>.
On Sat, Jun 23, 2018, 13:07 Branko Čibej <br...@apache.org> wrote:

> On 23.06.2018 19:53, Greg Stein wrote:
> > I think you have suggested CMake in the past? ... I would support any
> > build system that does Unix and Windows (which obviates autoconf)
>
> Not that I like CMake, but in my experience it does work better
> cross-platform than SCons. So yes, I started working on a CMake-based
> build just today. I'll


Haha... Imagine that :-)

be testing it on OSX and Windows to see how that
> goes. However I don't expect to replicate all the features of the SCons
> build; for example, I'm not planning to add the SOURCE_LAYOUT feature we
> have, which is only used on Windows and really only for APR/Util and
> OpenSSL. With these dependencies moving to more predictable installed
> layouts, it should no longer be necessary.
>

Agreed.

Cheers,
-g

Re: SCons considered terminally broken

Posted by Branko Čibej <br...@apache.org>.
On 23.06.2018 19:53, Greg Stein wrote:
> I think you have suggested CMake in the past? ... I would support any
> build system that does Unix and Windows (which obviates autoconf)

Not that I like CMake, but in my experience it does work better
cross-platform than SCons. So yes, I started working on a CMake-based
build just today. I'll be testing it on OSX and Windows to see how that
goes. However I don't expect to replicate all the features of the SCons
build; for example, I'm not planning to add the SOURCE_LAYOUT feature we
have, which is only used on Windows and really only for APR/Util and
OpenSSL. With these dependencies moving to more predictable installed
layouts, it should no longer be necessary.

-- Brane


Re: SCons considered terminally broken

Posted by Greg Stein <gs...@gmail.com>.
I think you have suggested CMake in the past? ... I would support any build
system that does Unix and Windows (which obviates autoconf)


On Sat, Jun 23, 2018, 05:59 Branko Čibej <br...@apache.org> wrote:

> I've been working on getting Serf built on Windows x64 with OpenSSL
> 1.1.0. I noticed that the function checks in SCons (Config.CheckFunc)
> that we use to find OpenSSL features were not working correctly. After
> some digging around in OpenSSL import libraries, SCons sources and the
> config.log file, I found the following:
>
> 1. Behaviour of Config.CheckFunc(function[, header]):
>
> SCons generates a test program that contains a call to 'function()'.
> This turns out to be quite problematic.
>
> 2. CheckFunc without the optional header parameter:
>
> When the test program is built, the compiler issues a warning about a
> missing prototype for 'function', assumes it's an "extern returning
> int". However, linking fails because the linker looks for the decorated
> function name '_function', but the names exported from the OpenSSL
> libraries (static or DLL import lib) are not decorated, so, just
> 'function'. The names don't match, the link fails and SCons happily
> assumes that the function does not exist.
>
> 3. CheckFunc /with/ the optional header parameter:
>
> The compiler now sees the function prototype and, since most functions
> require parameters, errors out because the call to 'function()' as
> generated by SCons is invalid. Again, SCons happily assumes that the
> function does not exist.
>
> 4. Conclusion:
>
> I do have an opinion about Windows name decoration that's not for public
> consumption. But in this case, I think that SCons is simply doing the
> wrong thing by blindly generating the function call. For comparison,
> autoconf does the same *but* also generates a prototype that overrides
> any compiler builtins, and doesn't include any headers in the test program.
>
> Finally, has anyone successfully built 64-bit Serf with OpenSSL 1.1.0 on
> Windows? If yes, how? Because I can't think of how this could be
> possible with SCons failing the way it does.
>
> FWIW: a 32-bit build of Serf and OpenSSL works.
>
> -- Brane
>
>