Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

canard.c 5.0.0: static random() conflicts with newlib's random() (fails to build on ESP-IDF)

Open Beginner friendly
#264 1 comment 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.