Topic: Getting errors when building wolftpm for Windows TBS API using MSYS2.

Hi,

I try to build wolftpm dll for windows using MSYS2. I follow this instruction https://www.wolfssl.com/documentation/m … er02.html. wolfssl and wolftpm I get from git repository. I am able to build wolfssl. When I run "make" command for building tpm I get errors:

# make
make -j3  all-am
make[1]: Entering directory '/home/Administrator/wolftpm'
  CC       examples/native/native_test.o
  CC       examples/wrap/wrap_test.o
  CC       examples/bench/bench.o
In file included from In file included from examples/native/native_test.c:29examples/wrap/wrap_test.c:30:
:
./examples/tpm_test.h:./examples/tpm_test.h: In function ' In function 'gettime_secsgettime_secs':
':
./examples/tpm_test.h:106:17: ./examples/tpm_test.h:106:17:error:  cast from function call of type 'error: ULONGLONGcast from function call of type '' {aka 'ULONGLONGlong l
ong unsigned int' {aka ''} to non-matching type 'long long unsigned intdouble'} to non-matching type '' [double-Werror=bad-function-cast' []
  106 |         return (-Werror=bad-function-cast(]
  106 |         return (double)GetTickCount64())/1000.0;
      |                 (^double)GetTickCount64())/1000.0;
      |
^
./examples/tpm_test.h:100:43: error: unused parameter 'reset' [-Werror=unused-parameter]
  100 |     static inline double gettime_secs(int reset)
      |                                       ~~~~^~~~~
./examples/tpm_test.h:100:43: error: unused parameter 'reset' [-Werror=unused-parameter]
  100 |     static inline double gettime_secs(int reset)
      |                                       ~~~~^~~~~
In file included from In file included from examples/native/native_test.c:24examples/wrap/wrap_test.c:24:
:
In file included from examples/native/native_test.c:                                                    In function '              :
TPM2_Native_TestArgs                                           ':
':
 In function '                         ./wolftpm/tpm2.h:1673:87:              ':
error:                                     comparison of integer expressions of different signedness: '                                                             int   er
ror: ' and '                                        unsigned int                     ' [           -Werror=sign-compare                                          ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)                          ==         TPM_E_COMMAND_BLOCKED)
      |                                                                                        TPM_E_COMMAND_BLOCKED)
      |                                                                                          ^~

]
                        ./wolftpm/tpm2.h:1673:87:                            double)GetTickCount64())/1000.0;
      |                 note:        in definition of macro '
WOLFTPM_IS_COMMAND_UNAVAILABLEWOLFTPM_IS_COMMAND_UNAVAILABLE./examples/tpm_test.h:100:43:'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) '
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)  ====error:  TPM_E_COMMAND_BLOCKED)
      |                                                                                        TPM_E_COMMAND_BLOCKED)
      |                                                                                                         ^~^~reset

' [./wolftpm/tpm2.h:1673:87:-Werror=unused-parameter ]
  100 |     static inline double gettime_secs(error: int resetcomparison of integer expressions of different signedness: ')
      |                                       int~~~~^~~~~' and '
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
                                      error: unsigned intunused variable '' [nvIndex-Werror=sign-compare' []
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) -Werror=unused-variable==]
  160 |     TPMI_RH_NV_INDEX  TPM_E_COMMAND_BLOCKED)
      |                                                                                       nvIndex^~;
      |
^~~~~~~./wolftpm/tpm2.h:1673:87:
 examples/bench/bench.c:25note: :
                        examples/bench/bench.c:WOLFTPM_IS_COMMAND_UNAVAILABLE In function ''
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (cod   bench_sym_aes==':
 TPM_E_COMMAND_BLOCKED)
      |
error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare./wolftpm/tpm2.h:1673:87: error: comparison of integer expre
ssions of different signedness: ']
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) int==' and ' TPM_E_COMMAND_BLOCKED)
      |                                                                                       unsigned int^~' [
                                             ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABL                                                           TPM_E_COMMAND_BLOCKED)
      |                                                                                       in definition of macro '
'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)                              TPM_E_COMMAND_BLOCKED)
      |                                                                                       note: ^~in definition of macro '
WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
examples/bench/bench.c: In function 'TPM2_Wrapper_BenchArgs':
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) ==./wolftpm/tpm2.h:1673:87: TPM_E_COMMAND_BLOCKED)
      |                                                                                        ^~error:
comparison of integer expressions of different signedness: './wolftpm/tpm2.h:1673:87:int ' and 'note: unsigned intin definition of macro '' [WOLFTPM_IS_COMMAND_UNAVAILABLE-
Werror=sign-compare'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) ==== TPM_E_COMMAND_BLOCKED)
      |                                                                                        TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~^~

./wolftpm/tpm2.h:1673:87:./wolftpm/tpm2.h:1673:87:  error: note: comparison of integer expressions of different signedness: 'in definition of macro 'intWOLFTPM_IS_COMMAND_U
NAVAILABLE' and ''
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) unsigned int==' [ TPM_E_COMMAND_BLOCKED)
      |                                                                                       -Werror=sign-compare^~]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)
                            TPM_E_COMMAND_BLOCKED)
      |
comparison of integer expressions of different signedness: '                             ' and '                                          ' [                              -
Werror=sign-compare'
 1673 | #define WOL                                                                           ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)      TPM_E_COMMAND_BLOCKED)
      |                                                                                        TPM_E_COMMAND_BLOCKED)
      |

./wolftpm/tpm2.h:1673:87:./wolftpm/tpm2.h:1673:87:  error: note: comparison of integer expressions of different signedness: 'in definition of macro 'intWOLFTPM_IS_COMMAND_U
NAVAILABLE' and ''
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) unsigned int==' [ TPM_E_COMMAND_BLOCKED)
      |                                                                                       -Werror=sign-compare^~]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)
                            TPM_E_COMMAND_BLOCKED)
      |
comparison of integer expressions of different signedness: '                             ' and '                                          ' [                              -
Werror=sign-compare'
 1673 | #define WOL                                                                           ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)      TPM_E_COMMAND_BLOCKED)
      |                                                                                        TPM_E_COMMAND_BLOCKED)
      |

./wolftpm/tpm2.h:1673:87:./wolftpm/tpm2.h:1673:87:  error: note: comparison of integer expressions of different signedness: 'in definition of macro 'intWOLFTPM_IS_COMMAND_U
NAVAILABLE' and ''
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) unsigned int==' [ TPM_E_COMMAND_BLOCKED)
      |                                                                                       -Werror=sign-compare^~]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)
                            TPM_E_COMMAND_BLOCKED)
      |
comparison of integer expressions of different signedness: '                             ' and '                                          ' [                              -
Werror=sign-compare'
 1673 | #define WOL                                                                           ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)      TPM_E_COMMAND_BLOCKED)
      |                                                                                        TPM_E_COMMAND_BLOCKED)
      |

./wolftpm/tpm2.h:1673:87:./wolftpm/tpm2.h:1673:87:  error: note: comparison of integer expressions of different signedness: 'in definition of macro 'intWOLFTPM_IS_COMMAND_U
NAVAILABLE' and ''
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) unsigned int==' [ TPM_E_COMMAND_BLOCKED)
      |                                                                                       -Werror=sign-compare^~]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)
                            TPM_E_COMMAND_BLOCKED)
      |
comparison of integer expressions of different signedness: '                             ' and '                                          ' [                              -
Werror=sign-compare'
 1673 | #define WOL                                                                           ]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)      TPM_E_COMMAND_BLOCKED)
      |                                                                                        TPM_E_COMMAND_BLOCKED)
      |

./wolftpm/tpm2.h:1673:87:./wolftpm/tpm2.h:1673:87:  error: note: comparison of integer expressions of different signedness: 'in definition of macro 'intWOLFTPM_IS_COMMAND_U
NAVAILABLE' and ''
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) unsigned int==' [ TPM_E_COMMAND_BLOCKED)
      |                                                                                       -Werror=sign-compare^~]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)
                                   TPM_E_COMMAND_BLOCKED)
      |
unused variable '                                      ' [                                                     ]
   82 |     word32                                           '
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code)  = 0;
      |            ==^~~~~~~~~~~~ TPM_E_COMMAND_BLOCKED)
      |
^~
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: error: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Werror=sign-compare]
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
./wolftpm/tpm2.h:1673:87: note: in definition of macro 'WOLFTPM_IS_COMMAND_UNAVAILABLE'
 1673 | #define WOLFTPM_IS_COMMAND_UNAVAILABLE(code) ((code) == TPM_RC_COMMAND_CODE || (code) == TPM_E_COMMAND_BLOCKED)
      |                                                                                       ^~
cc1.exe: all warnings being treated as errors
cc1.exe: all warnings being treated as errors
cc1.exe: all warnings being treated as errors
make[1]: *** [Makefile:1994: examples/wrap/wrap_test.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:1994: examples/bench/bench.o] Error 1
make[1]: *** [Makefile:1994: examples/native/native_test.o] Error 1
make[1]: Leaving directory '/home/Administrator/wolftpm'
make: *** [Makefile:1407: all] Error 2

If I download wolftpm from the site https://www.wolfssl.com/download/ it builds successfully but with a lot of warnings. Can you please help me to figure out what went wrong?

Thanks,
Rostyslav

Share

Re: Getting errors when building wolftpm for Windows TBS API using MSYS2.

Hey Rostyslav,

I've checked our winapi building with the msys2 compiler it seems it was more strict about typecasting than when we last tested it. I've pushed an update to fix the compiler errors and tested it on my windows vm with tpm. These changes have been merged into the master branch, can you please pull my changes and try again and confirm it builds okay?

Best Wishes,
John Bland

Share

Re: Getting errors when building wolftpm for Windows TBS API using MSYS2.

Hi John,

I have built wolfssl and wolftpm dll with the msys2 compiler without errors and warnings. Thanks a lot.

Rostyslav

Share

Re: Getting errors when building wolftpm for Windows TBS API using MSYS2.

The msys2 engine seemed to be stricter about typecasting when we were building our winapi than it was in our previous tests. The new version was tried on my Windows virtual machine with tpm, and then it was sent out to fix the compiler problems.

5 (edited by AndyMurray 2024-09-12 01:30:49)

Re: Getting errors when building wolftpm for Windows TBS API using MSYS2.

Players must navigate a delicate emotional landscape in ai girlfriend simulator   , where managing an AI girlfriend’s affection is key. The objective is to prevent her love from becoming obsessively possessive through strategic decision-making. Each interaction has the potential to affect the relationship’s stability, making careful choices essential.

Share