Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows bulding: Make dependency generation not quite as talkative #15006

Closed
wants to merge 6 commits into from

Conversation

levitte
Copy link
Member

@levitte levitte commented Apr 23, 2021

The modified way to generate .d files had an unfortunate side effect,
that it outputs the whole preprocessed file and not just the dependency
lines, at least with MSVC's cl. That gave util/add-depends.pl a whole
lot more to read through, which impacts greatly on the performance of
dependency treatment.

We modify the process by adding a config target attribute 'make_depend',
which can be any suitable command for generating such lines. All it
needs is to also accept C flags and macro definitions.

Fixes #14994

The modified way to generate .d files had an unfortunate side effect,
that it outputs the whole preprocessed file and not just the dependency
lines, at least with MSVC's cl.  That gave util/add-depends.pl a whole
lot more to read through, which impacts greatly on the performance of
dependency treatment.

We modify the process by adding a config target attribute 'make_depend',
which can be any suitable command for generating such lines.  All it
needs is to also accept C flags and macro definitions.

Fixes openssl#14994
@levitte levitte added branch: master Merge to master branch approval: review pending This pull request needs review by a committer labels Apr 23, 2021
@levitte
Copy link
Member Author

levitte commented Apr 23, 2021

This is an alternative to #15001

@levitte
Copy link
Member Author

levitte commented Apr 23, 2021

@tanzislam, it would be great if you would test this.

Copy link
Contributor

@tanzislam tanzislam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. The "master"-branch is apparently broken somehow with C++Builder (guessing due to 6b29784):

> perl Configure BC-32 --prefix=%CD% no-asm
...
> make -N
...
        cmd /C ""ilink32" -x -Gn -q -w-dup -j"C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\win32c\release" -L"C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\win32c\release" -aa -Tpd c0d32.obj  -x -Gn -q -w-dup -j"C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\win32c\release" -L"C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\win32c\release" @MAKE0001.@@@  || (DEL /Q libcrypto-3.* libcrypto.lib & EXIT 1)"
Error: Unresolved external 'WspiapiLoad' referenced from C:\USERS\T_17_\SOURCE\REPOS\CRYPTOPALS\OPENSSL_ANOTHER\CRYPTO\BIO\LIBCRYPTO-SHLIB-B_ADDR.OBJ
Error: Unable to perform link

I'll investigate and fix that separately. Don't want to delay fixing the MSVC-build.

UPDATE: Raised https://quality.embarcadero.com/browse/RSP-33806. Can't think of a workaround, so raised #15025 to undo that commit for C++Builder.

@mspncp
Copy link
Contributor

mspncp commented Apr 26, 2021

Raised https://quality.embarcadero.com/browse/RSP-33806.

@tanzislam is there a guest login for this link?

Previously, we had dependency making pretty much hard coded in the
build file templates, with a bit of an exception for Unix family
platforms, where we had different cases depending on what dependency
making program was found.

With the Embarcadero C++ builder, a separate scheme appeared, with a
different logic.

This change merges the two, and introduces two config target
attributes:

    makedepcmd          The program to use, where this is relevant.
                        This replaces the earlier configuration
                        attribute 'makedepprog'.
    makedep_scheme      This is a keyword that can be used by build
                        files templates to produce different sorts of
                        commands, but most importantly, to pass as
                        argument to util/add-depend.pl, which uses
                        this keyword as a "producer" for the
                        dependency lines.

If the config target doesn't define the 'makedep_scheme' attribute,
Configure tries to figure it out by looking for GCC compatible
compilers or for the 'makedepend' command.
@tanzislam
Copy link
Contributor

tanzislam commented Apr 26, 2021

Unfortunately not. It's free to create an Embarcadero account at https://www.embarcadero.com/products/cbuilder/starter/free-download

I gave them a minimal example that does not link when compiled as C, but does so as C++:

__inline void func(void) { return; }

int main(void)
{
    func();
    return 0;
}

It was discovered that MSVC has localized /showIncludes output.
Fortunately, it still seems to follow the same generic format, so we
can adapt the regular expression to make it language agnostic.

Fixes openssl#14994
@levitte
Copy link
Member Author

levitte commented Apr 26, 2021

I did a bit or rework to make the whole dependency making stuff less of a hack.
I also changed util/add-depends.pl to handle localized MSVC output

@mspncp
Copy link
Contributor

mspncp commented Apr 26, 2021

Restating my question #14994 (comment) here, where it seems more fitting:

@levitte are you saying that the 'makedepend' configure option is not necessary for a full build, that it's just an optimization for further builds?

If that is the case, then the 'makedepend' option should be disabled by default. Because regular users will build&install the binaries in one go using configure, make, make install. So there is no benefit from creating the dependency files, it only slows everything down. Only openssl developers working on the source code would benefit from this optimization. (And the benefit is limited by the fact that switching between topic branches very often requires reconfiguration and a full rebuild.)

My main motivation is that we ought to get the terrible build times on Windows back to reasonable values before the beta release (issue #14055). Using no-makedepend and no-fips I was able to reduce the build times significantly:

BUILD OPENSSL
20:39:39,53 start configure
20:40:21,36 start nmake
20:53:34,86 start nmake install
20:57:17,08 start nmake clean
20:57:50,51 done

A more detailed report will follow soon on #14055.

@levitte
Copy link
Member Author

levitte commented Apr 26, 2021

@mspncp, I would rather have the question of makedepend being enable or disabled by default to be a separate issue. Please don't pile more stuff into one issue.

@mspncp
Copy link
Contributor

mspncp commented Apr 26, 2021

Ok, no problem.

@levitte
Copy link
Member Author

levitte commented Apr 27, 2021

@openssl, a review, please?

@t8m t8m added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels Apr 27, 2021
@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but this PR has failing CI tests. Once the tests pass it will get moved to 'approval: ready to merge' automatically, alternatively please review and set the label manually.

@mspncp mspncp added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels Apr 28, 2021
@mspncp
Copy link
Contributor

mspncp commented Apr 28, 2021

The only failure was that the AppVeyor build was cancelled.

openssl-machine pushed a commit that referenced this pull request Apr 28, 2021
The modified way to generate .d files had an unfortunate side effect,
that it outputs the whole preprocessed file and not just the dependency
lines, at least with MSVC's cl.  That gave util/add-depends.pl a whole
lot more to read through, which impacts greatly on the performance of
dependency treatment.

We modify the process by adding a config target attribute 'make_depend',
which can be any suitable command for generating such lines.  All it
needs is to also accept C flags and macro definitions.

Fixes #14994

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Matthias St. Pierre <[email protected]>
(Merged from #15006)
openssl-machine pushed a commit that referenced this pull request Apr 28, 2021
Previously, we had dependency making pretty much hard coded in the
build file templates, with a bit of an exception for Unix family
platforms, where we had different cases depending on what dependency
making program was found.

With the Embarcadero C++ builder, a separate scheme appeared, with a
different logic.

This change merges the two, and introduces two config target
attributes:

    makedepcmd          The program to use, where this is relevant.
                        This replaces the earlier configuration
                        attribute 'makedepprog'.
    makedep_scheme      This is a keyword that can be used by build
                        files templates to produce different sorts of
                        commands, but most importantly, to pass as
                        argument to util/add-depend.pl, which uses
                        this keyword as a "producer" for the
                        dependency lines.

If the config target doesn't define the 'makedep_scheme' attribute,
Configure tries to figure it out by looking for GCC compatible
compilers or for the 'makedepend' command.

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Matthias St. Pierre <[email protected]>
(Merged from #15006)
openssl-machine pushed a commit that referenced this pull request Apr 28, 2021
It was discovered that MSVC has localized /showIncludes output.
Fortunately, it still seems to follow the same generic format, so we
can adapt the regular expression to make it language agnostic.

Fixes #14994

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: Matthias St. Pierre <[email protected]>
(Merged from #15006)
@levitte
Copy link
Member Author

levitte commented Apr 28, 2021

Merged

0bd138b Windows bulding: Make dependency generation not quite as talkative
2e535eb Configuration: rework how dependency making is handled
3babc1e util/add-depends.pl: Adapt to localized /showIncludes output

@levitte levitte closed this Apr 28, 2021
@levitte levitte deleted the fix-14994 branch April 28, 2021 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Merge to master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nmake install stuck in first step in windows
5 participants