Opened 6 years ago

Closed 2 years ago

Last modified 2 years ago

#10304 closed defect (fixed)

libevent2 detection fails on FreeBSD 9.2

Reported by: hsn Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version: Tor: unspecified
Severity: Normal Keywords: tor-relay, build
Cc: Actual Points:
Parent ID: #6311 Points:
Reviewer: Sponsor:

Description

./configure --with-libevent-dir=/usr/local/lib/event2 ends with

checking for libevent directory... configure: WARNING: We found the libraries for libevent, but we could not find the C header files. You may need to install a devel package.

In freebsd libevent2 .so files are in /usr/local/lib/event2 and headers are in /usr/local/include/event2

There needs to be command line switch for setting libevent2 include path as well.

Child Tickets

Change History (21)

comment:1 Changed 6 years ago by hsn

This works for making git master branch to compile on FreeBSD 9.2:

setenv CPPFLAGS "-I/usr/local/include/event2 -I/usr/local/include"
./configure --with-libevent-dir=/usr/local/lib/event2

comment:2 Changed 6 years ago by nickm

So you're saying that, for example, the libevent2 header "util.h" is in /usr/local/include/event2/event/util.h ?

We could add that to the search path; it's a pretty weird choice for them to have put it there, though.

More medium-term, the right workaround is probably going to be getting pkgconfig working.

comment:3 Changed 6 years ago by hsn

no

ls /usr/local/include/event2
buffer.h dns.h http.h rpc_struct.h buffer_compat.h dns_compat.h
http_compat.h tag.h bufferevent.h dns_struct.h http_struct.h
tag_compat.h bufferevent_compat.h event-config.h keyvalq_struct.h thread.h bufferevent_ssl.h event.h listener.h util.h bufferevent_struct.h
event_compat.h rpc.h compat  event_struct.h rpc_compat.h

comment:4 Changed 6 years ago by nickm

Ah, that's fine. Those headers are supposed to be in an "event2" subdirectory of their include path, so that you can get them with "#include <event2/event.h>" and so on.

Is there also another event.h in /user/local/include or /usr/include or elsewhere?

comment:5 Changed 6 years ago by hsn

i deinstalled libevent1 from freebsd to make situation more clear.

configure script is looking first for <event.h> not for <event2/event.h>. There is no <event.h> in freebsd libevent2 installation.

configure:6634: gcc -c -g -O2 -I/usr/local/lib/event2 -I/usr/local/include -I${top_srcdir}/src/common conftest.c >&5conftest.c:56:19: error: event.h: No such file

checking for event2/event.h starts in configure.ac at line 443 but it never gets there because it fails earlier. Maybe reorder these checks?

comment:6 Changed 6 years ago by nickm

Hm. But <event.h> is a libevent2 header; it is supposed to be there. I am increasingly suspicious that the FreeBSD installation is doing something wrong. Does it work any better if you uninstall libevent2 and then reinstall it?

comment:7 Changed 6 years ago by nickm

Keywords: tor-relay build 025-backport added
Milestone: Tor: 0.2.6.x-final
Status: newneeds_information

comment:8 Changed 5 years ago by nickm

Milestone: Tor: 0.2.6.x-finalTor: 0.2.???

This can turn into 0.2.6 if somebody can reproduce it, or if somebody can answer my questions above

comment:9 Changed 5 years ago by nickm

Keywords: 026-triaged-1 added
Milestone: Tor: 0.2.???Tor: 0.2.6.x-final

Yawning reports that this "still happens with a clean install of libevent2 from ports (9.2-RELEASE)" and confirms that event2/event.h is installed, but event.h is not.

comment:10 Changed 5 years ago by yawning

The package contents are available from the port's pkg-plist file (All with a implicit /usr/local prefix):
http://svnweb.freebsd.org/ports/head/devel/libevent2/pkg-plist?revision=340714&view=markup

The package indeed does not contain /usr/local/include/event.h

For what it's worth, the security/tor package's Makefile does this to pick up libevent's location:

CONFIGURE_ENV= TOR_CPPFLAGS_libevent="-I${LOCALBASE}/include/event2 -I${LOCALBASE}/include" \
 	TOR_LDFLAGS_libevent="-L${LOCALBASE}/lib/event2" \
 	TOR_LIBEVENT_LIBS="${TOR_LIBEVENT_LIBS}"

Let me know if I can provide more information, but this should be sufficient to add the relevant special case.

comment:11 Changed 5 years ago by nickm

Hm. So, Libevent ships with two headers called event.h. One of them is the preferred Libevent 2 header, and goes somewhere where it can be included with "#include <event2/event.h>". The other header exists for backward compatibility with Libevent 1, and you are supposed to be able to include it with "#include <event.h>".

Because all Libevent versions install the "<event.h>" header, but only Libevent 2 installs the "<event2/event.h>" header, Tor searches for "<event.h>" in order to find out where the Libevent headers might be.

But in FreeBSD 9.2, apparently, the compatibility headers are installed in a subdirectory called "compat", so searching for "<event.h>" won't find them.

Here are our (non-exclusive) options as I see them:

  1. Let the FreeBSD ports maintainers continue to patch this situation in their Makefile. (Their nonstandard libevent installation: their problem.)
  2. Do a FreeBSD-specific workaround, where if we detect that you're running FreeBSD and you don't have a --with-libevent-dir option set, manually set the includes correctly.
  3. Tweak our search to look for event2/event.h in addition to event.h , or to try adding foo/event2/compat to our search path whenever we're trying foo/. (This would require some tweaking in the middle of the hairiest bit of acinclude.m4.)
  4. Finally start transitioning towards pkg-config. (Tweaking acinclude.m4 would also be required in this case too.)

For 0.2.5, the easiest options seems like 1 or 2. For 0.2.6 or maybe 0.2.???, I think 4 is our best option, and 3 is best avoided.

comment:12 Changed 5 years ago by yawning

Both the short and long term options suggested seems good to me.

1 is slightly less preferable to 2 for the "user building tor themselves instead of using the port" use case (I note that the port will build/install 0.2.4.21 which is old, but not 0.2.3.x old), but "look at /usr/ports/security/tor/Makefile for the options to pass to autoconf" may be sufficient.

comment:13 Changed 5 years ago by teor

Parent ID: #6311

Assigning #6311 as the parent of tasks that could be resolved by pkg-config

comment:14 Changed 5 years ago by nickm

Milestone: Tor: 0.2.6.x-finalTor: 0.2.???

comment:15 Changed 3 years ago by teor

Milestone: Tor: 0.2.???Tor: 0.3.???

Milestone renamed

comment:16 Changed 3 years ago by nickm

Keywords: tor-03-unspecified-201612 added
Milestone: Tor: 0.3.???Tor: unspecified

Finally admitting that 0.3.??? was a euphemism for Tor: unspecified all along.

comment:17 Changed 2 years ago by nickm

Keywords: tor-03-unspecified-201612 removed

Remove an old triaging keyword.

comment:18 Changed 2 years ago by nickm

Keywords: 026-triaged-1 removed

comment:19 Changed 2 years ago by nickm

Keywords: 025-backport removed

These are not ripe for 0.2.5, even if they do get fixed now

comment:20 Changed 2 years ago by nickm

Keywords: 025-backport added
Resolution: fixed
Severity: Normal
Status: needs_informationclosed

I think this might be better now that we only look for libevent 2. Please reopen if it's not.

comment:21 Changed 2 years ago by nickm

Keywords: 025-backport removed
Note: See TracTickets for help on using tickets.