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

Allow building as a subdir #5837

Conversation

robert-shade
Copy link
Contributor

Allow building as a subdirectory (like with cmake FetchContent)

Fixes #5688

Signed-off-by: Robert Shade [email protected]

Status

READ

Requires Backporting

NO

Migrations

If there is any API change, what's the incentive and logic for it.

NO

@daverodgman daverodgman added needs-review Every commit must be reviewed by at least two team members, needs: changelog needs-reviewer This PR needs someone to pick it up for review size-s Estimated task size: small (~2d) priority-medium Medium priority - this can be reviewed as time permits labels May 13, 2022
@daverodgman
Copy link
Contributor

Tested by making a project that refers to Mbed TLS in this way - as a non-CMake expert this PR seems to address the problem (and doesn't introduce new cmake version requirements).

Copy link
Contributor

@daverodgman daverodgman left a comment

Choose a reason for hiding this comment

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

Please could you add a Changelog

@tom-cosgrove-arm
Copy link
Contributor

Hi, every commit needs a "Signed-off-by" line, including the ChangeLog one, so would you mind updating that commit?

@robert-shade robert-shade force-pushed the robert-shade/add_subdirectory_support branch from 0374966 to 8fa3a67 Compare May 13, 2022 21:51
@daverodgman daverodgman removed the needs-reviewer This PR needs someone to pick it up for review label May 19, 2022
daverodgman
daverodgman previously approved these changes May 19, 2022
Fixes Mbed-TLS#5688

Signed-off-by: Robert Shade <[email protected]>
@robert-shade robert-shade force-pushed the robert-shade/add_subdirectory_support branch from 8fa3a67 to 591e729 Compare May 21, 2022 16:56
@daverodgman
Copy link
Contributor

daverodgman commented May 24, 2022

It looks like this is failing on the FreeBSD CI (but only for internal CI, not on OpenCI). The log shows:

`******************************************************************

  • test_cmake_out_of_source: test: cmake 'out-of-source' build

  • Sat May 21 17:14:57 UTC 2022


Running tests...

Test project /tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/mbedtls_out_of_source_build

  Start  1: aes.cbc-suite

1/95 Test #1: aes.cbc-suite .............................. Passed 0.00 sec

  Start  2: aes.cfb-suite

2/95 Test #2: aes.cfb-suite .............................. Passed 0.00 sec

  Start  3: aes.ecb-suite

3/95 Test #3: aes.ecb-suite .............................. Passed 0.00 sec

  Start  4: aes.ofb-suite

............ [redacted a load of passing tests for brevity] ...........

93/95 Test #93: version-suite .............................. Passed 0.00 sec

  Start 94: x509parse-suite

94/95 Test #94: x509parse-suite ............................ Passed 0.44 sec

  Start 95: x509write-suite

95/95 Test #95: x509write-suite ............................ Passed 0.30 sec

100% tests passed, 0 tests failed out of 95

Total Test time (real) = 24.06 sec

^^^^test_cmake_out_of_source: test: cmake 'out-of-source' build: ./tests/ssl-opt.sh -f 'Default' > ssl-opt.out 2> ssl-opt.err -> 1^^^^

Default ................................................................ PASS

make[1]: Entering directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/library'

make[1]: Leaving directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/library'

make[1]: Entering directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/programs'

make[2]: Entering directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/programs/fuzz'

make[2]: Leaving directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/programs/fuzz'

make[1]: Leaving directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/programs'

make[1]: Entering directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/tests'

make[1]: Leaving directory '/tmp/workspace/mbed-tls-pr-head_PR-5837-head/src/tests'


  • Done, cleaning up `

@gilles-peskine-arm
Copy link
Contributor

The relevant part of the log is

^^^^test_cmake_out_of_source: test: cmake 'out-of-source' build: ./tests/ssl-opt.sh -f 'Default' > ssl-opt.out 2> ssl-opt.err -> 1^^^^
Default ................................................................ PASS

which corresponds to

    ./tests/ssl-opt.sh -f 'Default' >ssl-opt.out 2>ssl-opt.err
    grep PASS ssl-opt.out
    cat ssl-opt.err >&2

This is a sanity check for running SSL tests after an out-of-source build and the expected output is

Default ................................................................ PASS
Default, DTLS .......................................................... PASS
PASSED (2 / 2 tests (0 skipped))

The only expected reason why “Default” would pass but not “Default, DTLS” is a problem with udp_proxy (which we systematically use for DTLS tests in ssl-opt.sh). But there's no plausible reason why there would be a problem with the proxy, especially one that's specific to out-of-tree builds with a specific set of tools.

And pr-merge is passing.

So this looks like a mysterious one-off.

@@ -0,0 +1,4 @@
Changes
* Add aliases for libraries so that the normal MbedTLS::* targets
Copy link
Contributor

Choose a reason for hiding this comment

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

Please indicate clearly near the beginning that this is about CMake. For readers that don't have CMake in mind, the first sentence looks quite mysterious.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done in #5905.

@daverodgman
Copy link
Contributor

So this looks like a mysterious one-off.

I've re-triggered CI to see if it works this time

@daverodgman
Copy link
Contributor

Seems to be a one-off, CI is happy now.

@daverodgman
Copy link
Contributor

Since we don't have an update on the changelog wording for two weeks, I'm going to merge as-is. We can always tidy up the changelog later - I will make a note on the 3.2 release task.

@daverodgman daverodgman merged commit 5e03d9e into Mbed-TLS:development Jun 6, 2022
@daverodgman daverodgman mentioned this pull request Jun 6, 2022
3 tasks
@pfeatherstone
Copy link

Great stuff! Shame we now need Jinja2 to build mbedtls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review Every commit must be reviewed by at least two team members, priority-medium Medium priority - this can be reviewed as time permits size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add cmake FetchContent support
7 participants