nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

[BUG] stdio.h include nuttx/fs/fs.h nuttx/lib/lib.h Leading to duplicate definitions with third-party libraries

Open anjiahao1 opened this issue 4 months ago • 1 comments

Description / Steps to reproduce the issue

I have been using libarchive in nuttx, and everything was fine until stdio.h included the nuttx header file. There was a conflict between the header file in nuttx and libarchive. I think I should modify stdio.h so that stdio.h does not include any nuttx/*.h. I tried to delete nuttx/*.h but there were many compilation errors.

libarchive/libarchive/archive_read_open_filename.c:89:17: error: conflicting types for ‘file_read’; have ‘ssize_t(struct archive *, void *, const void **)’ {aka ‘long int(struct archive *, void *, const void **)’}
   89 | static ssize_t  file_read(struct archive *, void *, const void **buff);
      |                 ^~~~~~~~~
/home/ajh/work/archivefs/nuttx/include/nuttx/fs/fs.h:1426:9: note: previous declaration of ‘file_read’ with type ‘ssize_t(struct file *, void *, size_t)’ {aka ‘long int(struct file *, void *, long unsigned int)’}
 1426 | ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes);
      |         ^~~~~~~~~
libarchive/libarchive/archive_read_open_filename.c:90:17: error: conflicting types for ‘file_seek’; have ‘int64_t(struct archive *, void *, int64_t,  int)’ {aka ‘long int(struct archive *, void *, long int,  int)’}
   90 | static int64_t  file_seek(struct archive *, void *, int64_t request, int);
      |                 ^~~~~~~~~
/

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

ubunt24,04

NuttX Version

master

Issue Architecture

[Arch: all]

Issue Area

[Area: Api], [Area: Build System]

Verification

  • [X] I have verified before submitting the report.

anjiahao1 avatar Oct 14 '24 09:10 anjiahao1