silicon-heaven / libshv

GNU Lesser General Public License v3.0
0 stars 12 forks source link

compat.h redifine ssize_t to incompatible type #512

Closed robertobucher closed 1 week ago

robertobucher commented 1 week ago

In the (new) compat.h file, there is a redefinition of the type ssize_t to int64_t instead of the usual int.

These gives some errors if we compile libshv for NuttX. I can now avoid errors by simply add a

-D_ssize_t_defined

to the compilation flags, but I need to know if I have to put this definitively in my Makefile.

syyyr commented 1 week ago

Hi,

sorry for the incompatible change. I have fixed the issue in the latest version of libshv. Please try it to see if it fixes your issue.

robertobucher commented 1 week ago

SOrry but not solved with the last modification. I can set a -D_ssize_t_defined in my Makefile and it solve the problem without additional modifications in your code.

syyyr commented 1 week ago

Can you please send the whole output of your compilation including the error message you get? Also, do you know how ssize_t is defined in NuttX? Does it have a different define guard than __ssize_t_defined?

robertobucher commented 1 week ago

In file included from /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include/shv/chainpack/ccpcp.h:3, from /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include/shv/chainpack/cchainpack.h:3, from /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/cchainpack.c:1: Here the error:

arm-none-eabi-gcc -c  -I/home/bucher/CACSD/pysimCoder/CodeGen/Common/include -I../include -Wstrict-prototypes -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -mlittle-endian -march=armv7e-m -mtune=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -Wa,-mthumb -Wa,-mimplicit-it=always -mlong-calls -fno-common -DWITHOUT_MLOCK  -fomit-frame-pointer --param=min-pagesize=0 -fno-common -Wall -Wshadow -Wundef -ffunction-sections -fdata-sections -isystem /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/devices/../nuttx-export/include -I/home/bucher/CACSD/pysimCoder/CodeGen/Common/shv/include -I/home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include -I/home/bucher/CACSD/pysimCoder/ExtLibs/ulut serialOut.c
arm-none-eabi-gcc -c  -I/home/bucher/CACSD/pysimCoder/CodeGen/Common/include -I../include -Wstrict-prototypes -Wno-attributes -Wno-unknown-pragmas -Wno-psabi -mlittle-endian -march=armv7e-m -mtune=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb -Wa,-mthumb -Wa,-mimplicit-it=always -mlong-calls -fno-common -DWITHOUT_MLOCK  -fomit-frame-pointer --param=min-pagesize=0 -fno-common -Wall -Wshadow -Wundef -ffunction-sections -fdata-sections -isystem /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/devices/../nuttx-export/include -I/home/bucher/CACSD/pysimCoder/CodeGen/Common/shv/include -I/home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include -I/home/bucher/CACSD/pysimCoder/ExtLibs/ulut /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/cchainpack.c
In file included from /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include/shv/chainpack/ccpcp.h:3,
                 from /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include/shv/chainpack/cchainpack.h:3,
                 from /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/cchainpack.c:1:
/home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include/shv/chainpack/compat.h:10:18: error: conflicting types for 'ssize_t'; have 'intmax_t' {aka 'long long int'}
   10 | typedef intmax_t ssize_t;
      |                  ^~~~~~~
In file included from /home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export_f7/include/unistd.h:30,
                 from /home/bucher/CACSD/pysimCoder/ExtLibs/libshv/libshvchainpack/c/include/shv/chainpack/compat.h:4:
/home/bucher/CACSD/pysimCoder/CodeGen/nuttx/nuttx-export_f7/include/sys/types.h:136:22: note: previous declaration of 'ssize_t' with type 'ssize_t' {aka 'int'}
  136 | typedef _ssize_t     ssize_t;
      |                      ^~~~~~~
make: *** [Makefile:167: cchainpack.o] Error 1
syyyr commented 1 week ago

I have changed the code so that it defines ssize_t only on Windows (which is why the compat.h header exists anyway). This should hopefully fix your issue. Sorry for the inconvenience, and thank you for your cooperation and the bug report.