Skip to content

Build error on linux due to arc4random_buf #1

Description

@hkparker

When building on linux, I get the following error:

# github.com/gen2brain/go-libtor/libtor
In file included from ../../../../pkg/mod/github.com/gen2brain/go-libtor@v1.2.0/libtor/../linux/libevent/compat/../evutil_rand.c:134,
                 from ../../../../pkg/mod/github.com/gen2brain/go-libtor@v1.2.0/libtor/linux_libevent_evutil_rand.go:9:
../../../../pkg/mod/github.com/gen2brain/go-libtor@v1.2.0/libtor/../linux/libevent/compat/.././arc4random.c:471:1: error: static declaration of ‘arc4random_buf’ follows non-static declaration
  471 | arc4random_buf(void *buf_, size_t n)
      | ^~~~~~~~~~~~~~
In file included from ../../../../pkg/mod/github.com/gen2brain/go-libtor@v1.2.0/libtor/../linux/libevent/compat/../util-internal.h:37,
                 from ../../../../pkg/mod/github.com/gen2brain/go-libtor@v1.2.0/libtor/../linux/libevent/compat/../evutil_rand.c:40:
/usr/include/stdlib.h:542:13: note: previous declaration of ‘arc4random_buf’ with type ‘void(void *, size_t)’ {aka ‘void(void *, long unsigned int)’}
  542 | extern void arc4random_buf (void *__buf, size_t __size)
      |             ^~~~~~~~~~~~~~

I tried just commenting out these lines and it fixed my build, but I'm not really sure if that's an appropriate fix. If it is, I'm happy to PR removing these lines, but I figured it's worth discussing first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions