[ 
https://issues.apache.org/jira/browse/THRIFT-1547?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Roger Meier resolved THRIFT-1547.
---------------------------------
    Resolution: Cannot Reproduce
      Assignee:     (was: Jake Farrell)

> Problems building against static libevent
> -----------------------------------------
>
>                 Key: THRIFT-1547
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1547
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>    Affects Versions: 0.8
>         Environment: Thrift trunk on Ubuntu 11.10
>            Reporter: Diwaker Gupta
>            Priority: Minor
>
> We don't depend on the platform supplied libevent when building Thrift -- we 
> point to our own build. Further, we build libevent statically, so there are 
> no shared objects to link against.
> Unfortunate, the Thrift configure scripts fail to detect libevent. There are 
> two problems. First, when static linking libevent, it complains about missing 
> references to clock_gettime etc. This is easily fixed by settings LIBS to 
> '-lrt' when running 'configure'. Thrift still fails to detect libevent 
> because of the second issue: even with -lrt available, 'configure' is not 
> able to compile the levent test program. This is because the GNU linked 
> ('ld') is sensitive to the order in which libraries are specified.
> Specifically, libraries that depend on other libraries should appear first 
> (see [1], [2]). The following patch fixes the problem:
> {noformat}
> diff --git aclocal/ax_lib_event.m4 aclocal/ax_lib_event.m4
> index 91de828..2049444 100644
> --- aclocal/ax_lib_event.m4
> +++ aclocal/ax_lib_event.m4
> @@ -59,7 +59,7 @@ AC_DEFUN([AX_LIB_EVENT_DO_CHECK],
>            # Prepare the environment for compilation.
>            CPPFLAGS="$CPPFLAGS $LIBEVENT_CPPFLAGS"
>            LDFLAGS="$LDFLAGS $LIBEVENT_LDFLAGS"
> -          LIBS="$LIBS $LIBEVENT_LIBS"
> +          LIBS="$LIBEVENT_LIBS $LIBS"
>            export CPPFLAGS
>            export LDFLAGS
>            export LIBS
> {noformat}
> Note: this doesn't affect zlib because it doesn't have any dependencies on 
> system libraries.
> [1] http://stackoverflow.com/a/409470/852987
> [2] http://www.network-theory.co.uk/docs/gccintro/gccintro_18.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to