[Buildroot] [PATCH 1/1] package/log4cpp: add -lpthread to LIBS

Thomas Petazzoni thomas.petazzoni at bootlin.com
Mon May 13 20:02:45 UTC 2019


Hello Fabrice,

Thanks for your investigation on this issue.

On Sat, 11 May 2019 12:10:48 +0200
Fabrice Fontaine <fontaine.fabrice at gmail.com> wrote:

> diff --git a/package/log4cpp/log4cpp.mk b/package/log4cpp/log4cpp.mk
> index 8664a54385..527ad49e53 100644
> --- a/package/log4cpp/log4cpp.mk
> +++ b/package/log4cpp/log4cpp.mk
> @@ -12,7 +12,7 @@ LOG4CPP_SUBDIR = log4cpp
>  LOG4CPP_LICENSE = LGPL-2.1+
>  LOG4CPP_LICENSE_FILES = log4cpp/COPYING
>  LOG4CPP_INSTALL_STAGING = YES
> -LOG4CPP_CONF_OPTS = --enable-doxygen=no --enable-dot=no
> +LOG4CPP_CONF_OPTS = --enable-doxygen=no --enable-dot=no LIBS=-lpthread

I don't think this is the right fix for the problem. Indeed, to me
log4cpp.pc is already correct:

prefix=/usr
exec_prefix=/usr
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: log4cpp
Description: C++ library for flexible logging, modeled after Log4j
Version: 1.1
Libs: -L${libdir} -llog4cpp  
Cflags: -I${includedir} -pthread -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -Os  

See the -pthread in Cflags ? This should be sufficient.

I believe the problem rather lies inside the src/Makefile.am of linknx.
It adds LOG4CPP_CFLAGS to AM_CPPFLAGS. But AM_CPPFLAGS are only used
when the pre-processor is involved, which is not the case at link time.

If you move $(LOG4CPP_CFLAGS) from AM_CPPFLAGS to AM_CXXFLAGS, it fixes
the problem. I believe this is a more correct fix, and is upstreamable
to linknx.

Could you cook such a patch ? :-)

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


More information about the buildroot mailing list