-
Notifications
You must be signed in to change notification settings - Fork 57
Fix bug that caused build to break with -DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=ON #277
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
Fix bug that caused build to break with -DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=ON #277
Conversation
…RARY=ON Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
|
The new job has failed as expected on commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with the change introduced in the CMake file, but I have some doubt about the test component. I don't think we can force the Ubuntu/GCC/LD version to be used in the CI for a test component. Based on what I see most of the tests are run with u16 and few of them with higher versions (up to u22). If component_test_tf_psa_crypto_shared was meant to catch this problem, but it didn't I guess it's due to the fact that it's only tested in u16. What you should do is starting a Docker instance to test that component with u22 instead.
What you added here is a filter for component_build_tf_psa_crypto_shared_newer_ld_gcc, but since you cannot force the Docker version this component is tested on I think u16 will be used and therefore it will never be executed.
As check for my hypothesis I grep tf-psa-crypto-outcomes.csv artifact and I didn't found any reference to build_tf_psa_crypto_shared_newer_ld_gcc so I think it's correct.
|
@valeriosetti Hmm I think there's something strange going on in I see the new test is also not in that file, however it is definitely being run on the CI, e.g. the last job before the windows jobs is I was basing this work on a reply I got from @mpg:
So it's definitely running on Ubuntu 22 (also running & failing in the link in my first comment as I hadn't put in the CMake fix yet), but yes it is a bit counter-intuitive in the way you have to force it to use a newer OS or tool. |
Oh, you are right, I didn't see that line for I only have a minor proposal left: instead of naming the component --- Question to other reviewers --- |
| # which_aes | ||
| tfpsacrypto_build_program_common(which_aes) | ||
| target_link_libraries(which_aes PRIVATE ${tfpsacrypto_target}) | ||
| target_sources(which_aes PRIVATE $<TARGET_OBJECTS:tf_psa_crypto_test>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to not do that as this rather hides than fixes the issue. The core issue seems that we have two separate libraries, in the C compiler/linker sense, for the PSA core and the driver builtin that reference each other and it is linker dependent how this is handled. We should probably have only one library and in the CMake scripts to define the builtin library as an object library. I will create an issue for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the issue: #300
The magic for that lives in the mbedtls-test repo, specifically this function. Basically it runs That's most of what the pre-test-checks stage does (after loading and/or rebuilding the Docker images, and before running the actual tests). If one component from These days the list has Ubuntu 16 at the front, so all (This is for Linux, I think FreeBSD is handled differently: it runs a hardcoded subset of I hope that helps. Feel free to browse the code and/or ask more questions obviously! |
Yes, currently only test results are recorded in the outcomes file, not build results, which is annoying for all kinds of reasons, including this. As usual, Gilles has a PR for that, which we have not been reviewing so it's not been merged and we keep running in the issue... If you feel like reviewing it, it would help :) |
Right. Currently the outcome file only records outcomes from running unit tests,
Right, this is documented in |
| fi | ||
|
|
||
| # Newer lds with gcc cause extra errors that wouldn't be caught with older versions | ||
| [ "$distrib_id" != "Ubuntu" ] || [ "$ld_version_minor" -gt 37 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the exact Linux distribution matter? As far as I understand, there are three possibilities:
- Recent GNU binutils — good.
- Old GNU binutils — bad.
- Non-GNU ld — good? Or bad, since we can't be sure they would catch the problem? It's a bit of a moot point anyway since we run every component on Ubuntu (and even if we create non-Ubuntu components one day, we'd still keep Ubuntu as a possibility).
If we just want a recent enough GNU binutils, given that we can assume Ubuntu, we can just check the version of binutils.
support_build_tf_psa_crypto_shared_newer_ld_gcc () {
# Require a recent enough GNU binutils, because older ones are more
# permissive and would not detect e.g.
# https://github.com/Mbed-TLS/TF-PSA-Crypto/issues/300
dpkg --compare-versions "$(dpkg-query --show --showformat '${Version}' binutils)" '>=' 2.38 2>/dev/null
}
|
Is it still relevant or can it be closed now that #300 (which according to Ronald was the root of the problem) has been resolved? |
|
Yep shouldn't be needed any more. |
This bug caused errors like:
When building with
-DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=ON, e.g. the testcomponent_test_tf_psa_crypto_sharedincomponent-build-system.shshould have picked it up, I found it locally on Ubuntu 22.It wasn't caught by the CI, presumably because the CI was running it on Ubuntu 16 and the older version of
lddidn't notice it...Originally introduced in #199
PR checklist
ldcheck as well asgccso that this error will be caught in the future,