[syslog-ng] Syslog-ng-2.05 Segmentation Fault

Balazs Scheidler bazsi at balabit.hu
Tue Nov 13 09:21:22 CET 2007


On Tue, 2007-11-13 at 11:19 +1100, Daniel Szmandiuk wrote:
> I think I know the source of the problem. (with my very limited
> knowledge)
> 
> It looks like I have both the 32 & 64bit versions of GLIB2 installed and
> the configure script is picking up the 32bit version instead of the
> 64bit.
> 
> I've compared Tim's config.log with mine and can see differences like
> this:
> 
> Tims:
> CPPFLAGS=' -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
> -I/usr/local/include/eventlog    -D_GNU_SOURCE -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64'
> 
> Mine:
> CPPFLAGS=' -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
> -I/usr/include/eventlog   -D_BSD_SOURCE -D__BSD_SOURCE -D__FAVOR_BSD
> -DHAVE_NET_ETHERNET_H -D_GNU_SOURCE -D_LARGEFILE_SOURCE
> -D_FILE_OFFSET_BITS=64'
> 
> 
> I don't have /usr/include/glib-2.0, so in my case it is picking up
> /usr/lib/glib-2.0/include. In Tim's case /usr/lib64/glib-2.0/include
> 
> So question is why is the configure script not picking up my 64bit
> libraries? I suspect this is my binary seg faults...
> 
> How do I force ./configure to use /usr/lib64/glib-2.0/include instead of
> /usr/lib/glib-2.0/include?
> 

It all depends on pkg-config program and your PKG_CONFIG_PATH
environment variable, which defaults to /usr/lib/pkgconfig. I assume you
have both /usr/lib/pkgconfig/glib-2.0.pc
and /usr/lib64/pkgconfig/glib-2.0.pc, right?

I'm not sure how pkg-config should handle this situation, as it does not
really have an option to specify the target system type.

See also:

http://lists.freedesktop.org/archives/pkg-config/2005-December/000074.html

Until pkg-config gets something like this, the PKG_CONFIG_PATH has to be
specified manually.

All I can do is add a patch like this, which triggers an error in the
case above, however it does not work when cross-compiling.

Could you please check if this error message is actually triggered with
this patch without specifying PKG_CONFIG_PATH?

I've also pushed this patch to my git repository, so it might be easier
to check that out.

Thanks.

diff --git a/configure.in b/configure.in
index 75e4b2f..d100794 100644
--- a/configure.in
+++ b/configure.in
@@ -320,6 +320,30 @@ blb_cv_static_glib=yes,
 blb_cv_static_glib=no)])
 LIBS=$old_LIBS
 
+old_CPPFLAGS=$CPPFLAGS
+CPPFLAGS="$GLIB_CFLAGS"
+
+AC_CACHE_CHECK(sanity checking Glib headers,
+               blb_cv_glib_sane,
+[AC_TRY_RUN([
+#include <glib.h>
+
+int main()
+{
+  if (sizeof(long) != GLIB_SIZEOF_LONG)
+    return 1;
+  return 0;
+}
+],
+blb_cv_glib_sane=yes,
+blb_cv_glib_sane=no,
+blb_cv_glib_sane=yes)])
+CPPFLAGS=$old_CPPFLAGS
+
+if test "x$blb_cv_glib_sane" = "xno"; then
+       AC_MSG_ERROR([Glib headers inconsistent with current compiler setting. You might be using 32 bit Glib with a 64 bit compiler, check PKG_CONFIG_PATH])
+fi
+
 if test "x$enable_dynamic_linking" = "xyes" -a "x$enable_static_linking" = "xyes"; then
        AC_MSG_ERROR([You cannot specify dynamic and static linking at the same time.])
 fi


-- 
Bazsi



More information about the syslog-ng mailing list