Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#5161 closed defect (fixed)

build error: redundant redeclaration of ‘environ’

Reported by: arma Owned by:
Priority: Medium Milestone: Tor: 0.2.3.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


git commit efb7b9dec13 added

/* FreeBSD needs this; it doesn't seem to hurt other platforms. */
extern char **environ;

But on my Debian testing with --enable-gcc-warnings, I get

compat.c:1667:15: error: redundant redeclaration of ‘environ’ [-Werror=redundant-decls]
/usr/include/unistd.h:542:15: note: previous declaration of ‘environ’ was here
cc1: all warnings being treated as errors

Child Tickets

Change History (9)

comment:1 Changed 9 years ago by arma

Commenting out the environ in compat.c does in fact solve the problem for me. But it presumably reintroduces the problem for the freebsd people.

comment:2 Changed 9 years ago by rransom

I don't know what to check for with #ifdef. Can we make autoconf test whether environ is already defined for us?

comment:3 Changed 9 years ago by Sebastian

Branch bug5161 for some autoconf stuff, and some more comments explaining the situation.

comment:4 Changed 9 years ago by Sebastian

Status: newneeds_review

comment:5 Changed 9 years ago by stars

Hi Sebastian,

I have tested your branch sebastian/bug5161 and work for me ... Thanks very much to have fixed it :-)

Best Regards


comment:6 Changed 9 years ago by ln5

Compiles on FreeBSD 8.2-RELEASE-p6 amd64 (with compiler from base) with the following flags

CFLAGS = -g -I /usr/local/include/event2 -Wall -fno-strict-aliasing -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -Wold-style-definition -Waddress -Wmissing-noreturn -Wstrict-overflow=1 -Wnormalized=id -Woverride-init

comment:7 Changed 9 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Looks good; merging. Thanks!

comment:8 Changed 8 years ago by nickm

Keywords: tor-client added

comment:9 Changed 8 years ago by nickm

Component: Tor ClientTor
Note: See TracTickets for help on using tickets.