apache / apache/nuttx

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

Open
#14,260 1 comment 0 reactions 1 assignee Claimed by @GUIDINGLI View on GitHub
Arch: all Area: Api Area: Build system
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.