All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Port: Add glib checks for cross compilation
@ 2017-08-08 19:19 Michael Jeanson
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Jeanson @ 2017-08-08 19:19 UTC (permalink / raw)
  To: lttng-dev; +Cc: jgalar

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 configure.ac | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/configure.ac b/configure.ac
index b9bb6b4..6625b58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -626,6 +626,30 @@ AC_SUBST(AM_CPPFLAGS)
 # Add glib to global link libs
 LIBS="$LIBS $GLIB_LIBS"
 
+# Check that the current size_t matches the size that glib thinks it should
+# be. This catches problems on multi-arch where people try to do a 32-bit
+# build while pointing at 64-bit glib headers. This is a common error because
+# glib.h is not platform specific but it includes glibconfig.h which is and
+# is usually installed in a non-standard path.
+
+save_CFLAGS=${CFLAGS}
+CFLAGS="${CFLAGS} ${AM_CFLAGS}"
+AC_COMPILE_IFELSE([
+  AC_LANG_PROGRAM([dnl
+#include <glib.h>
+#include <unistd.h>
+  ], [dnl
+G_STATIC_ASSERT(sizeof(size_t) == GLIB_SIZEOF_SIZE_T);
+  ])
+],[:],[
+  AC_MSG_ERROR([dnl
+sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T. You probably need to set
+PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build
+target.
+  ])
+])
+CFLAGS=${save_CFLAGS}
+
 # Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name'
 # to rename babeltrace.bin to babeltrace at install time.
 program_transform_name="s&babeltrace\.bin&babeltrace&;s&babeltrace-log\.bin&babeltrace-log&;$program_transform_name"
-- 
2.7.4

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Port: Add glib checks for cross compilation
       [not found] <1502219952-17302-1-git-send-email-mjeanson@efficios.com>
@ 2017-08-10 19:21 ` Jérémie Galarneau
  0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2017-08-10 19:21 UTC (permalink / raw)
  To: Michael Jeanson; +Cc: lttng-dev, Jeremie Galarneau

Merged, thanks!

Jérémie

On 8 August 2017 at 15:19, Michael Jeanson <mjeanson@efficios.com> wrote:
> Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> ---
>  configure.ac | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/configure.ac b/configure.ac
> index b9bb6b4..6625b58 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -626,6 +626,30 @@ AC_SUBST(AM_CPPFLAGS)
>  # Add glib to global link libs
>  LIBS="$LIBS $GLIB_LIBS"
>
> +# Check that the current size_t matches the size that glib thinks it should
> +# be. This catches problems on multi-arch where people try to do a 32-bit
> +# build while pointing at 64-bit glib headers. This is a common error because
> +# glib.h is not platform specific but it includes glibconfig.h which is and
> +# is usually installed in a non-standard path.
> +
> +save_CFLAGS=${CFLAGS}
> +CFLAGS="${CFLAGS} ${AM_CFLAGS}"
> +AC_COMPILE_IFELSE([
> +  AC_LANG_PROGRAM([dnl
> +#include <glib.h>
> +#include <unistd.h>
> +  ], [dnl
> +G_STATIC_ASSERT(sizeof(size_t) == GLIB_SIZEOF_SIZE_T);
> +  ])
> +],[:],[
> +  AC_MSG_ERROR([dnl
> +sizeof(size_t) doesn't match GLIB_SIZEOF_SIZE_T. You probably need to set
> +PKG_CONFIG_LIBDIR to point to the right pkg-config files for your build
> +target.
> +  ])
> +])
> +CFLAGS=${save_CFLAGS}
> +
>  # Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name'
>  # to rename babeltrace.bin to babeltrace at install time.
>  program_transform_name="s&babeltrace\.bin&babeltrace&;s&babeltrace-log\.bin&babeltrace-log&;$program_transform_name"
> --
> 2.7.4
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-10 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-08 19:19 [PATCH] Port: Add glib checks for cross compilation Michael Jeanson
     [not found] <1502219952-17302-1-git-send-email-mjeanson@efficios.com>
2017-08-10 19:21 ` Jérémie Galarneau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.