#26249 closed defect (fixed)

Update libevent to prevent broken compilation when targetting macOS 10.7

Reported by: gk Owned by: tbb-team
Priority: Very High Milestone:
Component: Applications/Tor Browser Version:
Severity: Normal Keywords: tbb-rbm, ff60-esr, TorBrowserTeam201805R, GeorgKoppen201805
Cc: boklm Actual Points:
Parent ID: #24632 Points:
Reviewer: Sponsor:

Description

Switching our toolchain to target macOS 10.7 using the 10.11 SDK breaks compilation of libevent:

evutil.c:428:16: error: variable has incomplete type 'struct _timeb'
        struct _timeb tb;
                      ^
evutil.c:428:9: note: forward declaration of 'struct _timeb'
        struct _timeb tb;
               ^
evutil.c:441:2: warning: implicit declaration of function '_ftime' is invalid in C99 [-Wimplicit-function-declaration]
        _ftime(&tb);
        ^
In file included from evutil_rand.c:125:
././arc4random.c:465:1: error: static declaration of 'arc4random_addrandom' follows non-static declaration
arc4random_addrandom(const unsigned char *dat, int datlen)
^
/var/tmp/dist/macosx-toolchain/SDK//usr/include/stdlib.h:244:7: note: previous declaration is here
void     arc4random_addrandom(unsigned char * /*dat*/, int /*datlen*/);
         ^
In file included from evutil_rand.c:125:
././arc4random.c:497:1: error: static declaration of 'arc4random_buf' follows non-static declaration
arc4random_buf(void *_buf, size_t n)
^
/var/tmp/dist/macosx-toolchain/SDK//usr/include/stdlib.h:245:7: note: previous declaration is here
void     arc4random_buf(void * /*buf*/, size_t /*nbytes*/) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
         ^
2 errors generated.

The error in evutils.c is fixed in the latest stable version, 2.1.8, which we might want to use from now on. However the arc4random.c ones persist, even on master.

Child Tickets

Change History (7)

comment:1 Changed 17 months ago by gk

Cc: nickm added
Status: newneeds_information

Nick, do you have an opinion on the right fix for the arc4random issues?

comment:2 Changed 17 months ago by gk

Cc: nickm removed
Status: needs_informationnew

Okay, hold on, I think this was just an error in the new toolchain (taking Nick off this bug to avoid bug spam)

comment:3 Changed 17 months ago by gk

We are still getting an error:

bufferevent_openssl.c:66:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
         ^
1 error generated.

That is fixed in a revision which is not included in any stable release yet. Nevertheless, it's easier to backport the fix to 2.1.8, so we are switching to that stable version while we are at it. With that compilation is still working on all supported platform/architecture combinations and the result is at least running on my Linux x86_64 box. So, I am slightly optimistic that we are good with the fix.

The patch is pretty self-contained and forthcoming...

comment:4 Changed 17 months ago by gk

Keywords: TorBrowserTeam201805R added; TorBrowserTeam201805 removed
Status: newneeds_review

bug_26249 (https://gitweb.torproject.org/user/gk/tor-browser-build.git/commit/?h=bug_26249&id=ef90f3c7881467df0500674dae84d44e247d459c) in my public tor-browser-build repo has a potential fix. I singled that one out as it affects our Linux builds, too, and the change could get more coverage in our nightlies if it would get merged earlier.

comment:5 Changed 17 months ago by gk

Cc: boklm added

comment:6 Changed 17 months ago by boklm

This patch looks good to me. I did not check that it is fixing the macOS issue (as it depends on other fixes), but is seems useful to merge it now to start using it in the Windows and Linux builds earlier.

I pushed it to master as commit ef90f3c7881467df0500674dae84d44e247d459c.

comment:7 Changed 17 months ago by boklm

Resolution: fixed
Status: needs_reviewclosed
Note: See TracTickets for help on using tickets.