Skip to contentSkip to conversation

Some misc fixes and improvements

Buildroot New Thomas Petazzoni 2 participants 12 messages Mar 9, 2013 – Mar 10, 2013

lore
Share & tools
lore
#0 lore raw

Hello,

Here is a small set of 5 fixes/improvements, mainly related to noMMU build issues.

Thomas

#1 lore raw

PATCH 1/5 aircrack-ng: disable on non-MMU systems

aircrack-ng uses fork() and therefore fails to build on non-MMU systems:

aircrack-ng.o: In function `_clean_exit':
aircrack-ng.c:(.text+0x555c): undefined reference to `_fork'
collect2: ld returned 1 exit status

---
 package/aircrack-ng/Config.in |    1 +
 1 file changed, 1 insertion(+)
package/aircrack-ng/Config.in +1 -0
index 419f991..319b7c4 100644
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_AIRCRACK_NG
 	bool "aircrack-ng"
 	depends on BR2_LARGEFILE
+	depends on BR2_USE_MMU # uses fork()
 	select BR2_PACKAGE_OPENSSL
 	select BR2_PACKAGE_IW # runtime
 	help
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/5 aircrack-ng: disable on non-MMU systems

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> aircrack-ng uses fork() and therefore fails to build on non-MMU Thomas> systems:

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 2/5 alsa-lib: fix noMMU build

In reply to Thomas Petazzoni

Add a patch to use vfork() instead of fork().

---
 package/alsa-lib/alsa-lib-no-mmu.patch |   44 ++++++++++++++++++++++++++++++++
 package/alsa-lib/alsa-lib.mk           |    1 +
 2 files changed, 45 insertions(+)
 create mode 100644 package/alsa-lib/alsa-lib-no-mmu.patch
package/alsa-lib/alsa-lib-no-mmu.patch new file +44 -0
new file mode 100644
index 0000000..317676a
@@ -0,0 +1,44 @@
+Don't use fork() on noMMU platforms
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+Index: alsa-lib-1.0.26/configure.in
+===================================================================
+--- alsa-lib-1.0.26.orig/configure.in	2012-09-06 10:55:14.000000000 +0200
++++ alsa-lib-1.0.26/configure.in	2013-03-09 16:22:08.000000000 +0100
+@@ -66,6 +66,8 @@
+ AM_CONDITIONAL(ALSA_HSEARCH_R, [test "x$HAVE_HSEARCH_R" != xyes])
+ AC_CHECK_FUNCS([uselocale])
+ 
++AC_CHECK_FUNC([fork])
++
+ SAVE_LIBRARY_VERSION
+ AC_SUBST(LIBTOOL_VERSION_INFO)
+ 
+Index: alsa-lib-1.0.26/src/pcm/pcm_direct.c
+===================================================================
+--- alsa-lib-1.0.26.orig/src/pcm/pcm_direct.c	2012-09-06 10:55:14.000000000 +0200
++++ alsa-lib-1.0.26/src/pcm/pcm_direct.c	2013-03-09 16:22:51.000000000 +0100
+@@ -424,13 +424,21 @@
+ 		close(dmix->server_fd);
+ 		return ret;
+ 	}
+-	
++
++#ifdef HAVE_FORK
+ 	ret = fork();
++#else
++	ret = vfork();
++#endif
+ 	if (ret < 0) {
+ 		close(dmix->server_fd);
+ 		return ret;
+ 	} else if (ret == 0) {
++#ifdef HAVE_FORK
+ 		ret = fork();
++#else
++		ret = vfork();
++#endif
+ 		if (ret == 0)
+ 			server_job(dmix);
+ 		_exit(EXIT_SUCCESS);
package/alsa-lib/alsa-lib.mk +1 -0
index ba222db..2856407 100644
@@ -11,6 +11,7 @@ ALSA_LIB_LICENSE = LGPLv2.1+
 ALSA_LIB_LICENSE_FILES = COPYING
 ALSA_LIB_INSTALL_STAGING = YES
 ALSA_LIB_CFLAGS=$(TARGET_CFLAGS)
+ALSA_LIB_AUTORECONF = YES
 ALSA_LIB_CONF_OPT = --with-alsa-devdir=$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_DEVDIR)) \
 		    --with-pcm-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_PCM_PLUGINS))" \
 		    --with-ctl-plugins="$(call qstrip,$(BR2_PACKAGE_ALSA_LIB_CTL_PLUGINS))" \
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH 2/5 alsa-lib: fix noMMU build

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Add a patch to use vfork() instead of fork().
Thomas> Signed-off-by: Thomas Petazzoni <[email protected]> Thomas> ---

 Thomas>  package/alsa-lib/alsa-lib-no-mmu.patch |   44 ++++++++++++++++++++++++++++++++
 Thomas>  package/alsa-lib/alsa-lib.mk           |    1 +

Thomas> 2 files changed, 45 insertions(+)
Thomas> create mode 100644 package/alsa-lib/alsa-lib-no-mmu.patch

Thomas> diff --git a/package/alsa-lib/alsa-lib-no-mmu.patch b/package/alsa-lib/alsa-lib-no-mmu.patch Thomas> new file mode 100644
Thomas> index 0000000..317676a
Thomas> --- /dev/null
Thomas> +++ b/package/alsa-lib/alsa-lib-no-mmu.patch
Thomas> @@ -0,0 +1,44 @@
Thomas> +Don't use fork() on noMMU platforms
Thomas> +
Thomas> +Signed-off-by: Thomas Petazzoni <[email protected]> Thomas> +
Thomas> +Index: alsa-lib-1.0.26/configure.in
Thomas> +===================================================================
Thomas> +--- alsa-lib-1.0.26.orig/configure.in 2012-09-06 10:55:14.000000000 +0200
Thomas> ++++ alsa-lib-1.0.26/configure.in 2013-03-09 16:22:08.000000000 +0100
Thomas> +@@ -66,6 +66,8 @@
Thomas> + AM_CONDITIONAL(ALSA_HSEARCH_R, [test "x$HAVE_HSEARCH_R" != xyes])
Thomas> + AC_CHECK_FUNCS([uselocale])
Thomas> +
Thomas> ++AC_CHECK_FUNC([fork])
Thomas> ++
Thomas> + SAVE_LIBRARY_VERSION
Thomas> + AC_SUBST(LIBTOOL_VERSION_INFO)
Thomas> +
Thomas> +Index: alsa-lib-1.0.26/src/pcm/pcm_direct.c
Thomas> +===================================================================
Thomas> +--- alsa-lib-1.0.26.orig/src/pcm/pcm_direct.c 2012-09-06 10:55:14.000000000 +0200
Thomas> ++++ alsa-lib-1.0.26/src/pcm/pcm_direct.c 2013-03-09 16:22:51.000000000 +0100
Thomas> +@@ -424,13 +424,21 @@
Thomas> + close(dmix->server_fd);
Thomas> + return ret;
Thomas> + }
Thomas> +-
Thomas> ++
Thomas> ++#ifdef HAVE_FORK
Thomas> + ret = fork();
Thomas> ++#else
Thomas> ++ ret = vfork();

Are you sending this upstream? What's the reason for the HAVE_FORK check? Why not just always use vfork() instead? That should work fine on mmu as well (and be a tiny bit faster).

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 2/5 alsa-lib: fix noMMU build

Dear Peter Korsgaard,

Quoted 3 lines · Peter Korsgaard

Are you sending this upstream? What's the reason for the HAVE_FORK check? Why not just always use vfork() instead? That should work fine on mmu as well (and be a tiny bit faster).

I could possibly send this upstream, yes. The reason to use HAVE_FORK is to not change the MMU code, which probably is going to make the patch easier to get merged upstream, and also because that's the way the Blackfin people handled the problem.

Best regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 2/5 alsa-lib: fix noMMU build

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Dear Peter Korsgaard,

Quoted 3 lines · Peter Korsgaard
Quoted 3 lines

Are you sending this upstream? What's the reason for the HAVE_FORK check? Why not just always use vfork() instead? That should work fine on mmu as well (and be a tiny bit faster).

Thomas> I could possibly send this upstream, yes. The reason to use Thomas> HAVE_FORK is to not change the MMU code, which probably is Thomas> going to make the patch easier to get merged upstream, and also Thomas> because that's the way the Blackfin people handled the problem.

I would say just the opposite. As you know, you have to be careful (because parent/child is sharing memory) when you convert from fork to vfork, so as a maintainer I wouldn't like to only do it for a very small subset of machines (that he probably cannot easily test himself).

Either the conversion is correct, and should be done for everyone so it keeps working or it shouldn't be done.

Signature · 1 line
Bye, Peter Korsgaard
#7 lore raw

PATCH 3/5 libglib2: don't build tests

In reply to Thomas Petazzoni

Add a patch that provides an additional --disable-tests option to the configure script.

Disabling the build of tests has two benefits:
* Prevents the build of a lot of code that doesn't build on noMMU platforms.
* Reduces the build time.

---
 package/libglib2/libglib2-no-tests.patch |  117 ++++++++++++++++++++++++++++++
 package/libglib2/libglib2.mk             |    7 +-
 2 files changed, 123 insertions(+), 1 deletion(-)
 create mode 100644 package/libglib2/libglib2-no-tests.patch
package/libglib2/libglib2-no-tests.patch new file +117 -0
new file mode 100644
index 0000000..81b5af2
@@ -0,0 +1,117 @@
+Add a --disable-tests option to the configure script
+
+Disabling the build of tests has two benefits:
+ * Prevents the build of a lot of code that doesn't build on noMMU
+   platforms.
+ * Reduces the build time.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+Index: libglib2-2.30.3/Makefile.am
+===================================================================
+--- libglib2-2.30.3.orig/Makefile.am	2012-03-11 22:43:28.000000000 +0100
++++ libglib2-2.30.3/Makefile.am	2013-03-09 17:32:01.000000000 +0100
+@@ -6,7 +6,11 @@
+ 
+ ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
+ 
+-SUBDIRS = . m4macros glib gmodule gthread gobject gio tests po docs
++if BUILD_TESTS
++TEST_SUBDIR = tests
++endif
++
++SUBDIRS = . m4macros glib gmodule gthread gobject gio $(TEST_SUBDIR) po docs
+ DIST_SUBDIRS = $(SUBDIRS) build
+ 
+ bin_SCRIPTS = glib-gettextize
+Index: libglib2-2.30.3/gio/Makefile.am
+===================================================================
+--- libglib2-2.30.3.orig/gio/Makefile.am	2012-03-11 22:44:19.000000000 +0100
++++ libglib2-2.30.3/gio/Makefile.am	2013-03-09 17:32:38.000000000 +0100
+@@ -282,7 +282,11 @@
+ 
+ endif
+ 
+-SUBDIRS += tests
++if BUILD_TESTS
++TEST_SUBDIR = tests
++endif
++
++SUBDIRS += $(TEST_SUBDIR)
+ 
+ libgio_2_0_la_SOURCES =		\
+ 	gappinfo.c 		\
+Index: libglib2-2.30.3/configure.ac
+===================================================================
+--- libglib2-2.30.3.orig/configure.ac	2013-03-09 17:30:55.000000000 +0100
++++ libglib2-2.30.3/configure.ac	2013-03-09 17:37:27.000000000 +0100
+@@ -234,11 +234,18 @@
+               [AC_HELP_STRING([--disable-rebuilds],
+                               [disable all source autogeneration rules])],,
+               [enable_rebuilds=yes])
++AC_ARG_ENABLE(tests,
++		[AC_HELP_STRING([--disable-tests],
++				[disable all tests])],
++		enable_tests=${enableval},
++		enable_tests=yes)
+ 
+ if test "x$enable_threads" != "xyes"; then
+   enable_threads=no
+ fi
+ 
++AM_CONDITIONAL(BUILD_TESTS, [test x$enable_tests = xyes])
++
+ AC_MSG_CHECKING([whether to enable garbage collector friendliness])
+ if test "x$enable_gc_friendly" = "xyes"; then
+   AC_DEFINE(ENABLE_GC_FRIENDLY_DEFAULT, 1, [Whether to enable GC friendliness by default])
+Index: libglib2-2.30.3/glib/Makefile.am
+===================================================================
+--- libglib2-2.30.3.orig/glib/Makefile.am	2012-03-11 22:43:28.000000000 +0100
++++ libglib2-2.30.3/glib/Makefile.am	2013-03-09 18:02:59.000000000 +0100
+@@ -42,7 +42,11 @@
+ gregex_h =
+ endif
+ 
+-SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
++if BUILD_TESTS
++TEST_SUBDIR = tests
++endif
++
++SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . $(TEST_SUBDIR)
+ 
+ DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
+ 
+Index: libglib2-2.30.3/gobject/Makefile.am
+===================================================================
+--- libglib2-2.30.3.orig/gobject/Makefile.am	2012-03-11 22:43:29.000000000 +0100
++++ libglib2-2.30.3/gobject/Makefile.am	2013-03-09 18:03:40.000000000 +0100
+@@ -4,7 +4,11 @@
+ ## Process this file with automake to produce Makefile.in
+ include $(top_srcdir)/Makefile.decl
+ 
+-SUBDIRS = . tests
++if BUILD_TESTS
++TEST_SUBDIR = tests
++endif
++
++SUBDIRS = . $(TEST_SUBDIR)
+ 
+ BUILT_SOURCES=
+ CLEANFILES=
+Index: libglib2-2.30.3/gthread/Makefile.am
+===================================================================
+--- libglib2-2.30.3.orig/gthread/Makefile.am	2012-03-11 22:43:29.000000000 +0100
++++ libglib2-2.30.3/gthread/Makefile.am	2013-03-09 18:04:16.000000000 +0100
+@@ -1,7 +1,11 @@
+ ## Process this file with automake to produce Makefile.in
+ include $(top_srcdir)/Makefile.decl
+ 
+-SUBDIRS = . tests
++if BUILD_TESTS
++TEST_SUBDIR = tests
++endif
++
++SUBDIRS = . $(TEST_SUBDIR)
+ DIST_SUBDIRS = tests
+ 
+ AM_CPPFLAGS = 				\
package/libglib2/libglib2.mk +6 -1
index 278e635..b108b89 100644
@@ -9,6 +9,8 @@ LIBGLIB2_VERSION = $(LIBGLIB2_VERSION_MAJOR).$(LIBGLIB2_VERSION_MINOR)
 LIBGLIB2_SOURCE = glib-$(LIBGLIB2_VERSION).tar.xz
 LIBGLIB2_SITE = http://ftp.gnome.org/pub/gnome/sources/glib/$(LIBGLIB2_VERSION_MAJOR)
 
+LIBGLIB2_AUTORECONF = YES
+HOST_LIBGLIB2_AUTORECONF = YES
 LIBGLIB2_INSTALL_STAGING = YES
 LIBGLIB2_INSTALL_STAGING_OPT = DESTDIR=$(STAGING_DIR) LDFLAGS=-L$(STAGING_DIR)/usr/lib install
 
@@ -61,7 +63,10 @@ HOST_LIBGLIB2_CONF_OPT = \
 		--enable-debug=no \
 		--disable-dtrace \
 		--disable-systemtap \
-		--disable-gcov
+		--disable-gcov \
+		--disable-tests
+
+LIBGLIB2_CONF_OPT += --disable-tests
 
 LIBGLIB2_DEPENDENCIES = host-pkgconf host-libglib2 libffi zlib $(if $(BR2_NEEDS_GETTEXT),gettext)
 
Signature · 1 line
1.7.9.5
#8 lore raw

PATCH 3/5 libglib2: don't build tests

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> Add a patch that provides an additional --disable-tests option to the Thomas> configure script.

Thomas> Disabling the build of tests has two benefits:
Thomas> * Prevents the build of a lot of code that doesn't build on noMMU
Thomas> platforms.
Thomas> * Reduces the build time.

Committed, thanks. Please try sending it upstream.

Signature · 1 line
Bye, Peter Korsgaard
#9 lore raw

PATCH 4/5 libglib2: fix noMMU build

In reply to Thomas Petazzoni
---
 package/libglib2/libglib2-nommu.patch |  109 +++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 package/libglib2/libglib2-nommu.patch
package/libglib2/libglib2-nommu.patch new file +109 -0
new file mode 100644
index 0000000..364dbe9
@@ -0,0 +1,109 @@
+Fix build on noMMU platforms
+
+Use vfork() instead fork() on noMMU platforms.
+
+Signed-off-by: Thomas Petazzoni <[email protected]>
+
+Index: libglib2-2.30.3/configure.ac
+===================================================================
+--- libglib2-2.30.3.orig/configure.ac	2013-03-09 17:25:38.000000000 +0100
++++ libglib2-2.30.3/configure.ac	2013-03-09 17:30:55.000000000 +0100
+@@ -578,7 +578,7 @@
+ # Checks for library functions.
+ AC_FUNC_VPRINTF
+ AC_FUNC_ALLOCA
+-AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2)
++AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2 fork)
+ AC_CHECK_FUNCS(atexit on_exit timegm gmtime_r)
+ 
+ dnl don't use AC_CHECK_FUNCS here, otherwise HAVE_QSORT_R will
+Index: libglib2-2.30.3/gio/libasyncns/asyncns.c
+===================================================================
+--- libglib2-2.30.3.orig/gio/libasyncns/asyncns.c	2013-03-09 17:25:38.000000000 +0100
++++ libglib2-2.30.3/gio/libasyncns/asyncns.c	2013-03-09 17:30:55.000000000 +0100
+@@ -804,8 +804,13 @@
+     for (asyncns->valid_workers = 0; asyncns->valid_workers < n_proc; asyncns->valid_workers++) {
+ 
+ #ifndef HAVE_PTHREAD
++#ifdef HAVE_FORK
+         if ((asyncns->workers[asyncns->valid_workers] = fork()) < 0)
+             goto fail;
++#else
++        if ((asyncns->workers[asyncns->valid_workers] = vfork()) < 0)
++            goto fail;
++#endif
+         else if (asyncns->workers[asyncns->valid_workers] == 0) {
+             int ret;
+ 
+Index: libglib2-2.30.3/glib/gbacktrace.c
+===================================================================
+--- libglib2-2.30.3.orig/glib/gbacktrace.c	2013-03-09 17:25:38.000000000 +0100
++++ libglib2-2.30.3/glib/gbacktrace.c	2013-03-09 17:30:55.000000000 +0100
+@@ -240,7 +240,11 @@
+   args[1] = (gchar*) prg_name;
+   args[2] = buf;
+ 
++#ifdef HAVE_FORK
+   pid = fork ();
++#else
++  pid = vfork ();
++#endif
+   if (pid == 0)
+     {
+       stack_trace (args);
+@@ -293,7 +297,11 @@
+       _exit (0);
+     }
+ 
++#ifdef HAVE_FORK
+   pid = fork ();
++#else
++  pid = vfork ();
++#endif
+   if (pid == 0)
+     {
+       close (0); dup (in_fd[0]);   /* set the stdin to the in pipe */
+Index: libglib2-2.30.3/glib/gspawn.c
+===================================================================
+--- libglib2-2.30.3.orig/glib/gspawn.c	2013-03-09 17:25:38.000000000 +0100
++++ libglib2-2.30.3/glib/gspawn.c	2013-03-09 17:30:55.000000000 +0100
+@@ -1228,7 +1228,11 @@
+   if (standard_error && !make_pipe (stderr_pipe, error))
+     goto cleanup_and_fail;
+ 
++#ifdef HAVE_FORK
+   pid = fork ();
++#else
++  pid = vfork ();
++#endif
+ 
+   if (pid < 0)
+     {
+@@ -1278,7 +1282,11 @@
+            */
+           GPid grandchild_pid;
+ 
++#ifdef HAVE_FORK
+           grandchild_pid = fork ();
++#else
++	  grandchild_pid = vfork ();
++#endif
+ 
+           if (grandchild_pid < 0)
+             {
+Index: libglib2-2.30.3/glib/gtestutils.c
+===================================================================
+--- libglib2-2.30.3.orig/glib/gtestutils.c	2013-03-09 17:25:38.000000000 +0100
++++ libglib2-2.30.3/glib/gtestutils.c	2013-03-09 17:30:55.000000000 +0100
+@@ -1716,7 +1716,11 @@
+   if (pipe (stdout_pipe) < 0 || pipe (stderr_pipe) < 0 || pipe (stdtst_pipe) < 0)
+     g_error ("failed to create pipes to fork test program: %s", g_strerror (errno));
+   signal (SIGCHLD, SIG_DFL);
++#ifdef HAVE_FORK
+   test_trap_last_pid = fork ();
++#else
++  test_trap_last_pid = vfork ();
++#endif
+   if (test_trap_last_pid < 0)
+     g_error ("failed to fork test program: %s", g_strerror (errno));
+   if (test_trap_last_pid == 0)  /* child */
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH 5/5 libglib2: use system pcre when available

In reply to Thomas Petazzoni

By default, glib builds its own internal copy of the pcre library, but it also allows to use the one available from the system. Use this possibility when pcre is already selected in the Buildroot configuration.

---
 package/libglib2/libglib2.mk |    7 +++++++
 1 file changed, 7 insertions(+)
package/libglib2/libglib2.mk +7 -0
index b108b89..4ca6ca3 100644
@@ -81,6 +81,13 @@ LIBGLIB2_CONF_OPT += --with-libiconv=gnu
 LIBGLIB2_DEPENDENCIES += libiconv
 endif
 
+ifeq ($(BR2_PACKAGE_PCRE),y)
+LIBGLIB2_CONF_OPT += --with-pcre=system
+LIBGLIB2_DEPENDENCIES += pcre
+else
+LIBGLIB2_CONF_OPT += --with-pcre=internal
+endif
+
 define LIBGLIB2_REMOVE_DEV_FILES
 	rm -rf $(TARGET_DIR)/usr/lib/glib-2.0
 	rm -rf $(TARGET_DIR)/usr/share/glib-2.0/gettext
Signature · 1 line
1.7.9.5
#11 lore raw

PATCH 5/5 libglib2: use system pcre when available

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Thomas> By default, glib builds its own internal copy of the pcre library, but Thomas> it also allows to use the one available from the system. Use this Thomas> possibility when pcre is already selected in the Buildroot Thomas> configuration.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard