canard.c 5.0.0: static random() conflicts with newlib's random() (fails to build on ESP-IDF)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 86/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c
- Domain
- embedded-iot
Research direction
Open canard.c and inspect the random() definition and its three call sites, including the call in chance(). Reproduce the build failure in an ESP-IDF project with libcanard 5.0.0 using the reported idf.py build command. Done when the component builds without the conflicting random() declaration.
Written by the indexing model from the issue text.
Description
canard.c in v5.0.0 defines static uint64_t random(canard_t* const self, const uint64_t bound)
(line 130). On ESP-IDF this fails to compile because newlib's <stdlib.h> declares
long random(void);, and it is pulled in indirectly by the headers canard.c includes.
v4.0.0 has no function with this name. This breaks the ESP registry package
opencyphal/libcanard 5.0.0.
Error (ESP-IDF v5.3.1, gcc 13.2.0, -std=gnu17 -D_GNU_SOURCE):
canard.c:130:17: error: conflicting types for 'random'; have 'uint64_t(canard_t * const, const uint64_t)'
Reproduce: in an ESP-IDF project add opencyphal/libcanard: "^5.0.0" to
main/idf_component.yml and run idf.py build.
Suggested fix: rename the helper, e.g. to canard_random. It appears 4 times in
canard.c: lines 130 (definition), 136 (chance()), 1933 and 1988. A new release would be
needed for the ESP registry package to pick it up.
- Dominant language
- C
- Stars
- 450
- Forks
- 220
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
espressif/esp-vision#16 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
libsdl-org/SDL#16577 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
halt_error adds a trailing newline for non-string input, contrary to the manualPossibly taken @Huang-404-Q claimed this today. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
MerginMaps/geodiff#272 ·