diff mbox

[2/6] package/libbsd: new package

Message ID 76440f71466575498fd576fc04cbbdc7cda8d6f3.1360433324.git.yann.morin.1998@free.fr
State Deferred
Headers show

Commit Message

Yann E. MORIN Feb. 9, 2013, 6:09 p.m. UTC
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 package/Config.in        |    1 +
 package/libbsd/Config.in |   10 ++++++++++
 package/libbsd/libbsd.mk |   21 +++++++++++++++++++++
 3 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 package/libbsd/Config.in
 create mode 100644 package/libbsd/libbsd.mk

Comments

Nathan Lynch May 8, 2013, 2:09 a.m. UTC | #1
Hello Yann,

On Sat, 2013-02-09 at 19:09 +0100, Yann E. MORIN wrote:
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  package/Config.in        |    1 +
>  package/libbsd/Config.in |   10 ++++++++++
>  package/libbsd/libbsd.mk |   21 +++++++++++++++++++++
>  3 files changed, 32 insertions(+), 0 deletions(-)
>  create mode 100644 package/libbsd/Config.in
>  create mode 100644 package/libbsd/libbsd.mk

This is a few months old by now, but for what it's worth:

Acked-by: Nathan Lynch <ntl@pobox.com>

I happen to use libbsd for a mips target but hadn't gotten around to
submitting it myself.

I see you've posted patches adding libbsd a few times over the last few
months; it looks like it was related to your qemu efforts but not
committed so far.  Are you still working on having it included?

Any ideas on this libbsd build error with mips (which seems to lack an
a.out.h)?  I've hacked around it locally by just hacking nlist.c out of
the build, but that's not exactly satisfactory.  The error can be
recreated by using the following config and setting BR2_PACKAGE_LIBBSD=y
on current master with your patch applied:

http://autobuild.buildroot.org/toolchains/configs/free-electrons/br-mipsel-o32-full.config

libbsd 0.4.2 Building
PATH="/home/nathanl/devel/buildroot.git/output/host/bin:/home/nathanl/devel/buildroot.git/output/host/usr/bin:/home/nathanl/devel/buildroot.git/output/host/usr/sbin/:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/nathanl/.local/bin:/home/nathanl/bin" PERLLIB="/home/nathanl/devel/buildroot.git/output/host/usr/lib/perl"  /usr/bin/make -j16  -C /home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2/
make[1]: Entering directory `/home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2'
/usr/bin/make  all-recursive
make[2]: Entering directory `/home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2'
Making all in include
make[3]: Entering directory `/home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2/include'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2/include'
Making all in man
make[3]: Entering directory `/home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2/man'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2/man'
Making all in src
make[3]: Entering directory `/home/nathanl/devel/buildroot.git/output/build/libbsd-0.4.2/src'
  CC     arc4random.lo
  CC     bsd_getopt.lo
  CC     closefrom.lo
  CC     dehumanize_number.lo
  CC     err.lo
  CC     expand_number.lo
  CC     fgetln.lo
  CC     flopen.lo
  CC     fmtcheck.lo
  CC     getpeereid.lo
  CC     fpurge.lo
  CC     md5.lo
  CC     md5hl.lo
  CC     humanize_number.lo
  CC     heapsort.lo
  CC     inet_net_pton.lo
  CC     merge.lo
  CC     nlist.lo
  CC     pidfile.lo
  CC     progname.lo
  CC     radixsort.lo
  CC     readpassphrase.lo
In file included from nlist.c:42:0:
/home/nathanl/devel/buildroot.git/output/host/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/include/a.out.h:1:25: fatal error: linux/a.out.h: No such file or directory
compilation terminated.
Yann E. MORIN May 8, 2013, 11:08 a.m. UTC | #2
Nathan, All,

On Tue, May 07, 2013 at 09:09:15PM -0500, Nathan Lynch wrote:
> On Sat, 2013-02-09 at 19:09 +0100, Yann E. MORIN wrote:
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > ---
> >  package/Config.in        |    1 +
> >  package/libbsd/Config.in |   10 ++++++++++
> >  package/libbsd/libbsd.mk |   21 +++++++++++++++++++++
> >  3 files changed, 32 insertions(+), 0 deletions(-)
> >  create mode 100644 package/libbsd/Config.in
> >  create mode 100644 package/libbsd/libbsd.mk
> 
> This is a few months old by now, but for what it's worth:
> 
> Acked-by: Nathan Lynch <ntl@pobox.com>

Thanks. :-)

> I happen to use libbsd for a mips target but hadn't gotten around to
> submitting it myself.
> 
> I see you've posted patches adding libbsd a few times over the last few
> months; it looks like it was related to your qemu efforts but not
> committed so far.  Are you still working on having it included?

Well, it's been two Buildroot Developpers' Day that we said this stuff
would be added upstream, so yes, it will eventually get upstreamed.

But I need to rework all the QEMU patches first, since there has been
two new versions released since I first started working on it.

As for the preliminary packages, I'll resubmit them shortly, but I'm
afraid they won't make it in this cycle, it's a bit too late. But if
people are interested (like you are), they can help poke Peter to speed
up inclusion when the next window opens (start of June, after 2013.05 is
released). ;-)

> Any ideas on this libbsd build error with mips (which seems to lack an
> a.out.h)?

No, sorry, never ever tried on MIPS. And indeed, MIPS does not install
a.out.h THere's only 4 archs exporting the a.out.h header: alpha, arm,
m68k and x86; all other archs supsedly do not support running a.out
executables, so there is no reason to export a.out.h for those archs.

> I've hacked around it locally by just hacking nlist.c out of
> the build, but that's not exactly satisfactory.

I've looked at how Debian builds libbsd, but they have strictly 0 patch
on libbsd, and yet they have a MIPS package. Weird...

Can you try to just remove the a.out.h include and see if it still
compiles? If not, then maybe we should patch configure.ac to check for
a.out.h, and src/Makefile.am to not add nlist.c to the build if a.out.h
is not found.

But I'm afraid nlist.c contains important functions that would be missed
by other packages, so the best is to somehow getrid of including a.out.h
in the first place.

Also, has libbsd upstream done something about it yet?

Regards,
Yann E. MORIN.
Nathan Lynch May 9, 2013, 3:55 a.m. UTC | #3
On Wed, 2013-05-08 at 13:08 +0200, Yann E. MORIN wrote:
> On Tue, May 07, 2013 at 09:09:15PM -0500, Nathan Lynch wrote:
> 
> > I happen to use libbsd for a mips target but hadn't gotten around to
> > submitting it myself.
> > 
> > I see you've posted patches adding libbsd a few times over the last few
> > months; it looks like it was related to your qemu efforts but not
> > committed so far.  Are you still working on having it included?
> 
> Well, it's been two Buildroot Developpers' Day that we said this stuff
> would be added upstream, so yes, it will eventually get upstreamed.
> 
> But I need to rework all the QEMU patches first, since there has been
> two new versions released since I first started working on it.
> 
> As for the preliminary packages, I'll resubmit them shortly, but I'm
> afraid they won't make it in this cycle, it's a bit too late. But if
> people are interested (like you are), they can help poke Peter to speed
> up inclusion when the next window opens (start of June, after 2013.05 is
> released). ;-)

Sure :-)


> > Any ideas on this libbsd build error with mips (which seems to lack an
> > a.out.h)?
> 
> No, sorry, never ever tried on MIPS. And indeed, MIPS does not install
> a.out.h THere's only 4 archs exporting the a.out.h header: alpha, arm,
> m68k and x86; all other archs supsedly do not support running a.out
> executables, so there is no reason to export a.out.h for those archs.
> 
> > I've hacked around it locally by just hacking nlist.c out of
> > the build, but that's not exactly satisfactory.
> 
> I've looked at how Debian builds libbsd, but they have strictly 0 patch
> on libbsd, and yet they have a MIPS package. Weird...

I think it's a uClibc vs [e]glibc thing.  Looks like the valgrind
package has had a similar issue; see: 

package/valgrind/valgrind-dont-include-a-out-header.patch

and

http://lists.uclibc.org/pipermail/uclibc/2011-November/045920.html


> Can you try to just remove the a.out.h include and see if it still
> compiles?

It does not, it apparently needs the definition of struct nlist, struct
exec, and some constants:

nlist.c:58:39: warning: 'struct nlist' declared inside parameter list [enabled by default]
nlist.c:58:39: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
nlist.c:58:12: error: prototype declaration
nlist.c:129:51: error: invalid application of 'sizeof' to incomplete type 'struct exec' 
nlist.c:154:15: error: dereferencing pointer to incomplete type
nlist.c:193:38: error: 'N_STAB' undeclared (first use in this function)
nlist.c:398:16: error: 'N_UNDF' undeclared (first use in this function)
nlist.c:402:7: error: 'N_FN' undeclared (first use in this function)
nlist.c:402:14: error: 'N_ABS' undeclared (first use in this function)
nlist.c:411:36: error: 'N_DATA' undeclared (first use in this function)
nlist.c:411:45: error: 'N_TEXT' undeclared (first use in this function)
nlist.c:412:37: error: 'N_BSS' undeclared (first use in this function)
nlist.c:419:17: error: 'N_EXT' undeclared (first use in this function)


>  If not, then maybe we should patch configure.ac to check for
> a.out.h, and src/Makefile.am to not add nlist.c to the build if a.out.h
> is not found.
> 
> But I'm afraid nlist.c contains important functions that would be missed
> by other packages, so the best is to somehow getrid of including a.out.h
> in the first place.

I agree.  Perhaps a patch like the one valgrind uses could be an interim
solution.


> Also, has libbsd upstream done something about it yet?

AFAIK this has not been addressed (or reported) upstream.

I'll see what I can figure out on this but it will probably be the
weekend before I have more to report.
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index 2fad94d..ab09181 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -541,6 +541,7 @@  source "package/libargtable2/Config.in"
 source "package/argp-standalone/Config.in"
 source "package/boost/Config.in"
 source "package/libatomic_ops/Config.in"
+source "package/libbsd/Config.in"
 source "package/libcap/Config.in"
 source "package/libcap-ng/Config.in"
 source "package/libdaemon/Config.in"
diff --git a/package/libbsd/Config.in b/package/libbsd/Config.in
new file mode 100644
index 0000000..7f2b55a
--- /dev/null
+++ b/package/libbsd/Config.in
@@ -0,0 +1,10 @@ 
+config BR2_PACKAGE_LIBBSD
+	bool "libbsd"
+	help
+	  This library provides useful functions commonly found on BSD
+	  systems, and lacking on others like GNU systems, thus making
+	  it easier to port projects with strong BSD origins, without
+	  needing to embed the same code over and over again on each
+	  project.
+	  
+	  http://libbsd.freedesktop.org/
diff --git a/package/libbsd/libbsd.mk b/package/libbsd/libbsd.mk
new file mode 100644
index 0000000..3af1002
--- /dev/null
+++ b/package/libbsd/libbsd.mk
@@ -0,0 +1,21 @@ 
+#############################################################
+#
+# libbsd
+#
+#############################################################
+
+LIBBSD_VERSION         = 0.4.2
+LIBBSD_SOURCE          = libbsd-$(LIBBSD_VERSION).tar.gz
+LIBBSD_SITE            = http://libbsd.freedesktop.org/releases
+LIBBSD_LICENSE         = BSD-3c MIT
+LIBBSD_LICENSE_FILES   = LICENSE
+
+# man-pages are BSD-4c, so that license only matters
+# if doc is kept in the target rootfs
+ifeq ($(BR2_HAVE_DOCUMENTATION),y)
+LIBBSD_LICENSE        += (libraries), BSD-4c (documentation)
+endif
+
+LIBBSD_INSTALL_STAGING = YES
+
+$(eval $(autotools-package))