TPMS_ALGORITHM_DESCRIPTION deprecation problem
When trying to build tools against master, I run into an error, because the deprecated struct is used in a function declaration on tss2_mu.h Apparently, even when using a deprecated type inside a deprecated function declaration, the compiler is unhappy:
In file included from tools/fapi/tss2_gettpm2object.c:10:
/home/afuchs/tpm2-software/INSTALL/include/tss2/tss2_mu.h:753:5: error: ‘TPMS_ALGORITHM_DESCRIPTION’ is deprecated [-Werror=deprecated-declarations]
753 | TPMS_ALGORITHM_DESCRIPTION const *src,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/afuchs/tpm2-software/INSTALL/include/tss2/tss2_tctildr.h:11,
from tools/fapi/tss2_gettpm2object.c:8:
/home/afuchs/tpm2-software/INSTALL/include/tss2/tss2_tpm2_types.h:927:8: note: declared here
927 | struct TPMS_ALGORITHM_DESCRIPTION {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
Anyone got any idea how to fix this ? @williamcroberts Maybe you have an idea ?
Why are the tools using a dead function? The tools have a pretty big text matrix of versions I am surprised we didn't bump into this. You could #pragma your way around it:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* C CODE USING DEPRECATED HERE */
#pragma GCC diagnostic pop
But why not just delete the offending code?
The tools do not use the offending code from what I can tell. The tools merely include the tss2-mu.h file which uses the offending typedef from tss2-tpm2-types.h.
We could pragma around the parameter inside tss2-mu.h I guess, but that just looks ugly. Is it possible to attribute no-deprecation warnings for a single parameter ? Then we could add this to tss2-mu.h
The tools do not use the offending code from what I can tell. The tools merely include the tss2-mu.h file which uses the offending typedef from tss2-tpm2-types.h.
That doesn't make sense, you have to use it to get the deprecated warning to fire or you would never be able to build anything with a deprecated annotation. The tools have lots of files that include tss2_mu.h and build with all warnings as errors so I am really confused as to why your hitting it.
The CI builds against master with all the errors/warnings enabled:
- GCC: https://github.com/tpm2-software/tpm2-tools/runs/6871487235?check_suite_focus=true#step:3:1315
- CLANG: https://github.com/tpm2-software/tpm2-tools/runs/6871487278?check_suite_focus=true#step:3:1060
I guess the question is, how do we replicate your build?
Hmmm... Ubuntu 22.04, gcc, only configure parameters were --prefix
There is definitely no usage of said function or struct anywhere in the file. The compiler also says it stems from the header.
So weird, let me try today.
I just installed a fresh ubuntu-22.04 VM:
- tpm2-tss: 512b90d
- tpm2-tools: 9cf075
I ensured their was no unexpected things on the system by running configure on the tools first and ensuring it failed. I cannot reproduce and the CI shows the same. You're working with master/master for both projects?
lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
gcc --version
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
@AndreasFuchsTPM are you still blocked by this? Do you have like a docker image or a script I can run on a fresh VM to reproduce?
FWIW, the same problem occurs with Fedora 36 here: https://gitlab.gnome.org/jadahl/gnome-remote-desktop/-/jobs/2075290#L121
From there, you can download a docker image used by CI and reproduce with the merge request linked from the job page.
I just changed the installed headers... But I think we need to figure this out before the next release hits...
revert the type change and leave the mu routines marked deprecated or we could remove the type all together.
I'm still curious as to why the tools and everything else build fine
@williamcroberts @JuergenReppSIT I guess we should remove this with 4.0 as well, correct ?
Fixed on #2447