diff mbox

libbsd 0.8.3: BBCLASSEXTEND to native and nativesdk

Message ID 1476952202-8842-1-git-send-email-koen.kooi@linaro.org
State Accepted
Commit b02cef58ee35dd277fff48538ce2803df1cbc4d5
Headers show

Commit Message

Koen Kooi Oct. 20, 2016, 8:30 a.m. UTC
Android-tools depends on it and to build the native versions of fastboot, adb, mkbootimg and others libbsd needs to support native builds.

Signed-off-by: Koen Kooi <koen.kooi@linaro.org>

---
 meta/recipes-support/libbsd/libbsd_0.8.3.bb | 2 ++
 1 file changed, 2 insertions(+)

-- 
2.4.11

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Ross Burton Oct. 20, 2016, 11:05 a.m. UTC | #1
On 20 October 2016 at 09:30, Koen Kooi <koen.kooi@linaro.org> wrote:

> +BBCLASSEXTEND = "native nativesdk"

>


The native form fails on Debian stable hosts:

| make[2]: Entering directory
'/data/poky-master/tmp-glibc/work/x86_64-linux/libbsd-native/0.8.3-r0/build/src'
| ../x86_64-linux-libtool  --tag=CC   --mode=compile gcc  -DHAVE_CONFIG_H
-I.. -isystem ../../libbsd-0.8.3/include/bsd/ -include ../config.h
-DLIBBSD_OVERLAY -DLIBBSD_DISABLE_DEPRECATED -D__REENTRANT
-isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include
 -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include -O2
-pipe -c -o getentropy.lo ../../libbsd-0.8.3/src/getentropy.c
| x86_64-linux-libtool: compile:  gcc -DHAVE_CONFIG_H -I.. -isystem
../../libbsd-0.8.3/include/bsd/ -include ../config.h -DLIBBSD_OVERLAY
-DLIBBSD_DISABLE_DEPRECATED -D__REENTRANT
-isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include
-isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include -O2
-pipe -c ../../libbsd-0.8.3/src/getentropy.c  -fPIC -DPIC -o
.libs/getentropy.o
| In file included from /usr/include/x86_64-linux-gnu/sys/syscall.h:31:0,
|                  from ../../libbsd-0.8.3/src/getentropy_linux.c:29,
|                  from ../../libbsd-0.8.3/src/getentropy.c:28:
| ../../libbsd-0.8.3/src/getentropy_linux.c: In function
‘getentropy_getrandom’:
| ../../libbsd-0.8.3/src/getentropy_linux.c:203:17: error: ‘__NR_getrandom’
undeclared (first use in this function)
|    ret = syscall(SYS_getrandom, buf, len, 0);
|                  ^
| ../../libbsd-0.8.3/src/getentropy_linux.c:203:17: note: each undeclared
identifier is reported only once for each function it appears in

It's not wrong - there's no actual definition of __NR_getrandom in
/usr/include here.

Ross
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Nicolas Dechesne Nov. 4, 2016, 9:25 p.m. UTC | #2
On Thu, Oct 20, 2016 at 1:05 PM, Burton, Ross <ross.burton@intel.com> wrote:
> On 20 October 2016 at 09:30, Koen Kooi <koen.kooi@linaro.org> wrote:
>>
>> +BBCLASSEXTEND = "native nativesdk"
>
>
> The native form fails on Debian stable hosts:
>
> | make[2]: Entering directory
> '/data/poky-master/tmp-glibc/work/x86_64-linux/libbsd-native/0.8.3-r0/build/src'
> | ../x86_64-linux-libtool  --tag=CC   --mode=compile gcc  -DHAVE_CONFIG_H
> -I.. -isystem ../../libbsd-0.8.3/include/bsd/ -include ../config.h
> -DLIBBSD_OVERLAY -DLIBBSD_DISABLE_DEPRECATED -D__REENTRANT
> -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include
> -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include -O2
> -pipe -c -o getentropy.lo ../../libbsd-0.8.3/src/getentropy.c
> | x86_64-linux-libtool: compile:  gcc -DHAVE_CONFIG_H -I.. -isystem
> ../../libbsd-0.8.3/include/bsd/ -include ../config.h -DLIBBSD_OVERLAY
> -DLIBBSD_DISABLE_DEPRECATED -D__REENTRANT
> -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include
> -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include -O2
> -pipe -c ../../libbsd-0.8.3/src/getentropy.c  -fPIC -DPIC -o
> .libs/getentropy.o
> | In file included from /usr/include/x86_64-linux-gnu/sys/syscall.h:31:0,
> |                  from ../../libbsd-0.8.3/src/getentropy_linux.c:29,
> |                  from ../../libbsd-0.8.3/src/getentropy.c:28:
> | ../../libbsd-0.8.3/src/getentropy_linux.c: In function
> ‘getentropy_getrandom’:
> | ../../libbsd-0.8.3/src/getentropy_linux.c:203:17: error: ‘__NR_getrandom’
> undeclared (first use in this function)
> |    ret = syscall(SYS_getrandom, buf, len, 0);
> |                  ^
> | ../../libbsd-0.8.3/src/getentropy_linux.c:203:17: note: each undeclared
> identifier is reported only once for each function it appears in
>
> It's not wrong - there's no actual definition of __NR_getrandom in
> /usr/include here.

hmm. that's odd. libbsd is supposed to work with system that have this
syscall, and with system without it. in the upstream source code, they
properly do it like this:

#ifdef SYS_getrandom
static int
getentropy_getrandom(void *buf, size_t len)
{
    int pre_errno = errno;
    int ret;
    if (len > 256)
        return (-1);
    do {
        ret = syscall(SYS_getrandom, buf, len, 0);
<...>
#endif

So in order to get the build error you are seeing, that means that
SYS_getrandom is define to NR_getrandom (in syscall.h), but that
NR_getrandom is not set to the right syscall ID. That makes it quite
inconsistent.. could we be mixing HOST and sysroot content here?

I don't have a debian stable system handy right now, i will have to setup one.

nico
Ross Burton Nov. 4, 2016, 11:24 p.m. UTC | #3
On 4 November 2016 at 21:25, Nicolas Dechesne <nicolas.dechesne@linaro.org>
wrote:

> So in order to get the build error you are seeing, that means that

> SYS_getrandom is define to NR_getrandom (in syscall.h), but that

> NR_getrandom is not set to the right syscall ID. That makes it quite

> inconsistent.. could we be mixing HOST and sysroot content here?

>


No, I checked the files in /usr on the host, as this is a native build it
should be linking against the host libc.

$ grep -r getrandom
x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom
x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom
x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

Yes, looks like Debian headers are a bit broken.

Ross
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Nicolas Dechesne Nov. 4, 2016, 11:47 p.m. UTC | #4
On Sat, Nov 5, 2016 at 12:24 AM, Burton, Ross <ross.burton@intel.com> wrote:
> On 4 November 2016 at 21:25, Nicolas Dechesne <nicolas.dechesne@linaro.org>

> wrote:

>>

>> So in order to get the build error you are seeing, that means that

>> SYS_getrandom is define to NR_getrandom (in syscall.h), but that

>> NR_getrandom is not set to the right syscall ID. That makes it quite

>> inconsistent.. could we be mixing HOST and sysroot content here?

>

>

> No, I checked the files in /usr on the host, as this is a native build it

> should be linking against the host libc.

>

> $ grep -r getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

>

> Yes, looks like Debian headers are a bit broken.


hmm. not for me...

root@nikaia:/usr/include# grep getrandom
/usr/include/x86_64-linux-gnu/bits/syscall.h

root@nikaia:/usr/include# dpkg -S /usr/include/x86_64-linux-gnu/bits/syscall.h
libc6-dev:amd64: /usr/include/x86_64-linux-gnu/bits/syscall.h

root@nikaia:/usr/include# dpkg -l | grep libc6-dev
ii  libc6-dev:amd64                2.19-18+deb8u6           amd64
  GNU C Library: Development Libraries and Header Files

this is from a fresh jessie debootstrap
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Khem Raj Nov. 5, 2016, 12:04 a.m. UTC | #5
On 10/20/16 4:05 AM, Burton, Ross wrote:
> 
> On 20 October 2016 at 09:30, Koen Kooi <koen.kooi@linaro.org
> <mailto:koen.kooi@linaro.org>> wrote:
> 
>     +BBCLASSEXTEND = "native nativesdk"
> 
> 
> The native form fails on Debian stable hosts:
> 
> | make[2]: Entering directory
> '/data/poky-master/tmp-glibc/work/x86_64-linux/libbsd-native/0.8.3-r0/build/src'
> | ../x86_64-linux-libtool  --tag=CC   --mode=compile gcc  -DHAVE_CONFIG_H  
> -I.. -isystem ../../libbsd-0.8.3/include/bsd/ -include ../config.h
> -DLIBBSD_OVERLAY -DLIBBSD_DISABLE_DEPRECATED -D__REENTRANT
> -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include
>  -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include -O2
> -pipe -c -o getentropy.lo ../../libbsd-0.8.3/src/getentropy.c
> | x86_64-linux-libtool: compile:  gcc -DHAVE_CONFIG_H -I.. -isystem
> ../../libbsd-0.8.3/include/bsd/ -include ../config.h -DLIBBSD_OVERLAY
> -DLIBBSD_DISABLE_DEPRECATED -D__REENTRANT
> -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include
> -isystem/data/poky-master/tmp-glibc/sysroots/x86_64-linux/usr/include -O2
> -pipe -c ../../libbsd-0.8.3/src/getentropy.c  -fPIC -DPIC -o .libs/getentropy.o
> | In file included from /usr/include/x86_64-linux-gnu/sys/syscall.h:31:0,
> |                  from ../../libbsd-0.8.3/src/getentropy_linux.c:29,
> |                  from ../../libbsd-0.8.3/src/getentropy.c:28:
> | ../../libbsd-0.8.3/src/getentropy_linux.c: In function ‘getentropy_getrandom’:
> | ../../libbsd-0.8.3/src/getentropy_linux.c:203:17: error: ‘__NR_getrandom’
> undeclared (first use in this function)
> |    ret = syscall(SYS_getrandom, buf, len, 0);
> |                  ^
> | ../../libbsd-0.8.3/src/getentropy_linux.c:203:17: note: each undeclared
> identifier is reported only once for each function it appears in
> 
> It's not wrong - there's no actual definition of __NR_getrandom in
> /usr/include here.


Do you have libbsd pre-installed on your build system ?

> 
> Ross
> 
>
Phil Blundell Nov. 5, 2016, 12:09 a.m. UTC | #6
On Fri, 2016-11-04 at 23:24 +0000, Burton, Ross wrote:
> > No, I checked the files in /usr on the host, as this is a native

build it should be linking against the host libc.
> 

> $ grep -r getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> 

> 

> Yes, looks like Debian headers are a bit broken.

> 

> 

> 


That would happen if your glibc was compiled against a newer version of
the kernel headers than you actually have installed (bits/syscall.h is
auto-generated from the kernel headers at build time). If this is a
clean Debian install then it does sound like they have messed up the
packaging somehow.

p.
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton Nov. 7, 2016, 9:28 a.m. UTC | #7
On 5 November 2016 at 00:09, Phil Blundell <pb@pbcl.net> wrote:

> That would happen if your glibc was compiled against a newer version of

> the kernel headers than you actually have installed (bits/syscall.h is

> auto-generated from the kernel headers at build time). If this is a clean

> Debian install then it does sound like they have messed up the packaging

> somehow.

>


Ah.  I might (cough) have a hybrid stable/testing setup as I needed a newer
kernel.  I'll have a look.

Ross
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton Nov. 7, 2016, 9:30 a.m. UTC | #8
On 7 November 2016 at 09:28, Burton, Ross <ross.burton@intel.com> wrote:

> Ah.  I might (cough) have a hybrid stable/testing setup as I needed a

> newer kernel.  I'll have a look.

>


$ grep -r getrandom
x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom
x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom
x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom
x86_64-linux-gnu/asm/unistd_x32.h:#define __NR_getrandom (__X32_SYSCALL_BIT
+ 318)
x86_64-linux-gnu/asm/unistd_64.h:#define __NR_getrandom 318
x86_64-linux-gnu/asm/unistd_32.h:#define __NR_getrandom 355

That's better.  Thanks Phil.

Ross
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Nicolas Dechesne Nov. 7, 2016, 9:42 a.m. UTC | #9
On Mon, Nov 7, 2016 at 10:30 AM, Burton, Ross <ross.burton@intel.com> wrote:
> On 7 November 2016 at 09:28, Burton, Ross <ross.burton@intel.com> wrote:

>>

>> Ah.  I might (cough) have a hybrid stable/testing setup as I needed a

>> newer kernel.  I'll have a look.

>

>

> $ grep -r getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> x86_64-linux-gnu/bits/syscall.h:#define SYS_getrandom __NR_getrandom

> x86_64-linux-gnu/asm/unistd_x32.h:#define __NR_getrandom (__X32_SYSCALL_BIT

> + 318)

> x86_64-linux-gnu/asm/unistd_64.h:#define __NR_getrandom 318

> x86_64-linux-gnu/asm/unistd_32.h:#define __NR_getrandom 355

>

> That's better.  Thanks Phil.


great. Does that mean that this patch can be merged or do you have any
other issue?

It's needed to get the android tools -native.. and we will need a
backport on morty too (but we will send that separately).
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Ross Burton Nov. 7, 2016, 9:54 a.m. UTC | #10
On 7 November 2016 at 09:42, Nicolas Dechesne <nicolas.dechesne@linaro.org>
wrote:

> great. Does that mean that this patch can be merged or do you have any

> other issue?

>


Yeah, it's queued in my staging branch now. Sorry for user error stalling
this.

Ross
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox

Patch

diff --git a/meta/recipes-support/libbsd/libbsd_0.8.3.bb b/meta/recipes-support/libbsd/libbsd_0.8.3.bb
index 92121ef..6f734ab 100644
--- a/meta/recipes-support/libbsd/libbsd_0.8.3.bb
+++ b/meta/recipes-support/libbsd/libbsd_0.8.3.bb
@@ -41,3 +41,5 @@  SRC_URI[md5sum] = "e935c1bb6cc98a4a43cb1da22795493a"
 SRC_URI[sha256sum] = "934b634f4dfd865b6482650b8f522c70ae65c463529de8be907b53c89c3a34a8"
 
 inherit autotools pkgconfig
+
+BBCLASSEXTEND = "native nativesdk"