OP-TEE / optee_test

Test suite
Other
81 stars 199 forks source link

Compile error when building xtest with musl #722

Open jonmason opened 10 months ago

jonmason commented 10 months ago

When compiling optee_test v4.1 (in yocto) with musl, I see the following error: | In file included from optee-test/4.1.0/recipe-sysroot/usr/include/sys/stat.h:23, | from optee-test/4.1.0/git/host/xtest/stats.c:17: | optee-test/4.1.0/recipe-sysroot/usr/include/bits/stat.h:17:26: error: expected identifier or '(' before '[' token | 17 | unsigned __unused[2]; | | ^

This is similar to commit 1013c491940a8af27fbf5dcecf1d53275bc99c60 And similar to that commit, I was able to remove the header file in question and it compiles without issue.

etienne-lms commented 10 months ago

I see that sys/stat.h is included from several source file in OP-TEE source trees:

optee_client/libteec/src/tee_client_api.c:#include <sys/stat.h>
optee_client/tee-supplicant/src/rpmb.c:#include <sys/stat.h>
optee_client/tee-supplicant/src/tee_supplicant.c:#include <sys/stat.h>
optee_client/tee-supplicant/src/prof.c:#include <sys/stat.h>
optee_client/tee-supplicant/src/tee_supp_fs.c:#include <sys/stat.h>
optee_test/host/xtest/hash_perf.c:#include <sys/stat.h>
optee_test/host/xtest/stats.c:#include <sys/stat.h>
optee_test/host/xtest/install_ta.c:#include <sys/stat.h>
optee_test/host/xtest/aes_perf.c:#include <sys/stat.h>

__unused attributes if defined from compiler.h header file exported to host applications through the OP-TEE TA devkit (export-ta\*/hostinclude/compiler.h). Maybe we should not export OP-TEE compiler.h into OP-TEE TA devkit.

jenswi-linaro commented 10 months ago

__unused attributes if defined from compiler.h header file exported to host applications through the OP-TEE TA devkit (export-ta*/hostinclude/compiler.h). Maybe we should not export OP-TEE compiler.h into OP-TEE TA devkit.

Into TA devkit is OK, but perhaps not into the host includes.

jforissier commented 10 months ago

__unused attributes if defined from compiler.h header file exported to host applications through the OP-TEE TA devkit (export-ta*/hostinclude/compiler.h). Maybe we should not export OP-TEE compiler.h into OP-TEE TA devkit.

Into TA devkit is OK, but perhaps not into the host includes.

+1

etienne-lms commented 10 months ago

Into TA devkit is OK, but perhaps not into the host includes.

Indeed.

Note that this changes requires changes in optee_test that uses __unused, __maybe_unused and __printf(...) in the host applications implementation.

jenswi-linaro commented 10 months ago

Note that this changes requires changes in optee_test that uses __unused, __maybe_unused and __printf(...) in the host applications implementation.

Agreed.

github-actions[bot] commented 9 months ago

This issue has been marked as a stale issue because it has been open (more than) 30 days with no activity. Remove the stale label or add a comment, otherwise this issue will automatically be closed in 5 days. Note that you can always re-open a closed issue at any time.

jonmason commented 7 months ago

We're still maintaining a patch in the meta-arm yocto layer to remove this header file (to work around the issue). Based on the comments, it seemed to be agreed that this issue needs to be addressed. Yet, the bot closed this issue (and I didn't see anything in the commit log which looks like the issue has been fixed). Can someone re-open and address this issue?

jbech-linaro commented 7 months ago

@jonmason I've reopened it and added the bug and enhancement labels (prevent the bot from automatically closing it). Having said that I believe this has low or no attention here right now, people busy with other things, so don't dare to say when it'll be fixed if there is no-one outside jumping in and having a look at it.

jforissier commented 7 months ago

I'll try simply removing #include <sys/stat.h> from host/xtest/stats.c, if that's enough to fix the issue, then I'll open a PR. In any case that would be a workaround.

jforissier commented 7 months ago

https://github.com/OP-TEE/optee_test/pull/744