Closed liuqun closed 6 years ago
We updated cmocka to the 1.x releases some time back. This was a major version bump (API changes). Since this doesn't effect compatibility with the libraries (just the unit tests) and building a newer version of cmocka from source is pretty trivial on Debian (this is what I do) I don't think this is a bug, it's a feature.
in tpm2-tss/configure.ac, checking cmocka >= 1.x.y will simply help other developers understand why gcc report those errors above, for example:
PKG_CHECK_MODULES(
[CMOCKA],
[cmocka >= 1.1.1],
[
AC_DEFINE([HAVE_CMOCKA], [1])
],
[
AC_MSG_ERROR([Please update cmocka to the newest version! https://cmocka.org/])
]
)
Sorry I missed your point. I didn't realize that we weren't checking for the version in the configure script. This is definitely the right thing to do. Since the cmocka API we're using is compatible with all 1.0 releases this check should probably be for any cmocka version >= 1.0
. Any chance I can get you to turn this into a PR?
I'm getting our repos confused. We have this check in tpm2-abrmd configure.ac, just not here in the TSS. It's a minor change so I'll just make that happen. Thanks for pointing this out @liuqun.
https://github.com/intel/tpm2-tss/blob/fb93568596419c4ac20031db898963abb0aca0ec/configure.ac#L21-L25
Failed to build tpm2-tss with libcmocka-dev<=0.4.1 on Debian 8.0 or older. Old release of libcmocka-dev<=0.4.1 on Debian 8.0 do not support "CMUnitTest" or "cmocka_unit_test". In the old release of /usr/inclue/cmocka.h, "unittest" was defined without prefix "cmocka" and "UnitTest" was defined without prefix "CM":
https://github.com/intel/tpm2-tss/blob/77305c06c39ca165f915657522b3bfd8e21e9b71/test/unit/tcti-device.c#L239-L256