Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rand: fix build error with autotools + LibreSSL #12274

Closed
wants to merge 1 commit into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Nov 5, 2023

autotools unexpectedly detects arc4random because it is also looking
into dependency libs. One dependency, LibreSSL, happens to publish an
arc4random function (via its shared lib before v3.7, also via static
lib as of v3.8.2). When trying to use this function in lib/rand.c,
its protoype is missing. To fix that, curl included a prototype, but
that used a C99 type without including stdint.h, causing:

../../lib/rand.c:37:1: error: unknown type name 'uint32_t'
   37 | uint32_t arc4random(void);
      | ^
1 error generated.

This patch improves this by dropping the local prototype and instead
limiting arc4random use for non-OpenSSL builds. OpenSSL builds provide
their own random source anyway.

The better fix would be to teach autotools to not link dependency libs
while detecting arc4random.

LibreSSL publishing a non-namespaced arc4random tracked here:
libressl/portable#928

Regression from 755ddbe #10672

Fixes #12257
Closes #12274

autotools unexpectedly detects `arc4random` because it is also looking
into dependency libs. One dependency, LibreSSL, happens to publish an
`arc4random` function (via its shared lib before v3.7, also via static
lib as of v3.8.2). When trying to use this function in `lib/rand.c`,
its protoype is missing. To fix that, curl included a prototype, but
that used a C99 type without including `stdint.h`, causing:

```
../../lib/rand.c:37:1: error: unknown type name 'uint32_t'
   37 | uint32_t arc4random(void);
      | ^
1 error generated.
```

This patch improves this by dropping the local prototype and instead
limiting `arc4random` use for non-OpenSSL builds. OpenSSL builds provide
their own random source anyway.

The better fix would be to teach autotools to not link dependency libs
while detecting `arc4random`.

LibreSSL publishing a non-namespaced `arc4random` tracked here:
libressl/portable#928

Regression from 755ddbe curl#10672

Fixes curl#12257
Closes #xxxxx
@vszakats vszakats closed this in 7925ba4 Nov 6, 2023
@vszakats vszakats deleted the rand-arc4random branch November 6, 2023 10:13
vszakats added a commit to curl/curl-for-win that referenced this pull request Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

autotools + libressl builds fail with: unknown type name 'uint32_t'
2 participants