Message ID | 20231121094154.3406211-1-wenlin.kang@windriver.com |
---|---|
State | New |
Headers | show |
Series | libxcrypt: fixed some build error for nativesdk with mingw | expand |
On Tue, 2023-11-21 at 01:41 -0800, wenlin.kang@windriver.com via lists.openembedded.org wrote: > From: Wenlin Kang <wenlin.kang@windriver.com> > > Steps to reproduce > 1) add layer meta-mingw > 2) add line in local.conf > SDKMACHINE = "x86_64-mingw32" > 3) bitbake nativesdk-libxcrypt > > Fixed: > 1. pedantic error > | ../git/lib/crypt.c:316:24: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic] > | 316 | SYMVER_crypt_gensalt_rn; > | | > > 2. conversion error > | ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes': > | ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion] > | 140 | ssize_t nread = read (fd, buf, buflen); > > Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> > --- > ...dom-bytes.c-fixed-conversion-error-w.patch | 47 +++++++++++++++++++ > meta/recipes-core/libxcrypt/libxcrypt.inc | 6 ++- > 2 files changed, 52 insertions(+), 1 deletion(-) > create mode 100644 meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch > > diff --git a/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch > new file mode 100644 > index 0000000000..3846f76674 > --- /dev/null > +++ b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch > @@ -0,0 +1,47 @@ > +From ff99091eb8a6b9e6edc567f6d2552183fbaacec3 Mon Sep 17 00:00:00 2001 > +From: Wenlin Kang <wenlin.kang@windriver.com> > +Date: Mon, 6 Nov 2023 14:43:28 +0800 > +Subject: [PATCH] lib/util-get-random-bytes.c: fixed conversion error with > + mingw > + > +With x86_64-w64-mingw32-gcc. get below error: > +| ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes': > +| ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion] > +| 140 | ssize_t nread = read (fd, buf, buflen); > +| | ^~~~~~ > + > +In util-get-random-bytes.c, has get_random_bytes(void *buf, size_t buflen), > +but in mingw-w64-mingw-w64/mingw-w64-headers/crt/io.h, read() has "unsigned int" > +read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount), and has: > + #ifdef _WIN64 > + __MINGW_EXTENSION typedef unsigned __int64 size_t; > + #else > + typedef unsigned int size_t; > + #endif /* _WIN64 */ > + > +Upstream-Status: Pending > + > +Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> > +--- > + lib/util-get-random-bytes.c | 4 ++++ > + 1 file changed, 4 insertions(+) > + > +diff --git a/lib/util-get-random-bytes.c b/lib/util-get-random-bytes.c > +index 79816db..68cd378 100644 > +--- a/lib/util-get-random-bytes.c > ++++ b/lib/util-get-random-bytes.c > +@@ -137,7 +137,11 @@ get_random_bytes(void *buf, size_t buflen) > + dev_urandom_doesnt_work = true; > + else > + { > ++#ifdef _WIN64 > ++ ssize_t nread = read (fd, buf, (unsigned int)buflen); > ++#else > + ssize_t nread = read (fd, buf, buflen); > ++#endif > + if (nread < 0 || (size_t)nread < buflen) > + dev_urandom_doesnt_work = true; > + > +-- > +2.25.1 > + > diff --git a/meta/recipes-core/libxcrypt/libxcrypt.inc b/meta/recipes-core/libxcrypt/libxcrypt.inc > index ba93d91aef..b93d56b4dc 100644 > --- a/meta/recipes-core/libxcrypt/libxcrypt.inc > +++ b/meta/recipes-core/libxcrypt/libxcrypt.inc > @@ -13,7 +13,9 @@ SRC_URI = "git://github.com/besser82/libxcrypt.git;branch=${SRCBRANCH};protocol= > SRCREV = "f531a36aa916a22ef2ce7d270ba381e264250cbf" > SRCBRANCH ?= "master" > > -SRC_URI += "file://fix_cflags_handling.patch" > +SRC_URI += "file://fix_cflags_handling.patch \ > + file://0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch \ > + " > > PROVIDES = "virtual/crypt" > > @@ -26,4 +28,6 @@ CPPFLAGS:append:class-nativesdk = " -Wno-error" > API = "--disable-obsolete-api" > EXTRA_OECONF += "${API}" > > +CFLAGS:append:class-nativesdk = " -Wno-pedantic" > + > BBCLASSEXTEND = "native nativesdk" Should this go to meta-mingw instead of OE-Core? Shouldn't something be submitted upstream? This certainly isn't the kind of patch we want to carry. Cheers, Richard
On Tue, Nov 21, 2023 at 2:42 PM Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > On Tue, 2023-11-21 at 01:41 -0800, wenlin.kang@windriver.com via > lists.openembedded.org wrote: > > From: Wenlin Kang <wenlin.kang@windriver.com> > > > > Steps to reproduce > > 1) add layer meta-mingw > > 2) add line in local.conf > > SDKMACHINE = "x86_64-mingw32" > > 3) bitbake nativesdk-libxcrypt > > > > Fixed: > > 1. pedantic error > > | ../git/lib/crypt.c:316:24: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic] > > | 316 | SYMVER_crypt_gensalt_rn; > > | | > > > > 2. conversion error > > | ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes': > > | ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion] > > | 140 | ssize_t nread = read (fd, buf, buflen); > > > > Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> > > --- > > ...dom-bytes.c-fixed-conversion-error-w.patch | 47 +++++++++++++++++++ > > meta/recipes-core/libxcrypt/libxcrypt.inc | 6 ++- > > 2 files changed, 52 insertions(+), 1 deletion(-) > > create mode 100644 meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch > > > > diff --git a/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch > > new file mode 100644 > > index 0000000000..3846f76674 > > --- /dev/null > > +++ b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch > > @@ -0,0 +1,47 @@ > > +From ff99091eb8a6b9e6edc567f6d2552183fbaacec3 Mon Sep 17 00:00:00 2001 > > +From: Wenlin Kang <wenlin.kang@windriver.com> > > +Date: Mon, 6 Nov 2023 14:43:28 +0800 > > +Subject: [PATCH] lib/util-get-random-bytes.c: fixed conversion error with > > + mingw > > + > > +With x86_64-w64-mingw32-gcc. get below error: > > +| ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes': > > +| ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion] > > +| 140 | ssize_t nread = read (fd, buf, buflen); > > +| | ^~~~~~ > > + > > +In util-get-random-bytes.c, has get_random_bytes(void *buf, size_t buflen), > > +but in mingw-w64-mingw-w64/mingw-w64-headers/crt/io.h, read() has "unsigned int" > > +read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount), and has: > > + #ifdef _WIN64 > > + __MINGW_EXTENSION typedef unsigned __int64 size_t; > > + #else > > + typedef unsigned int size_t; > > + #endif /* _WIN64 */ > > + > > +Upstream-Status: Pending > > + > > +Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> > > +--- > > + lib/util-get-random-bytes.c | 4 ++++ > > + 1 file changed, 4 insertions(+) > > + > > +diff --git a/lib/util-get-random-bytes.c b/lib/util-get-random-bytes.c > > +index 79816db..68cd378 100644 > > +--- a/lib/util-get-random-bytes.c > > ++++ b/lib/util-get-random-bytes.c > > +@@ -137,7 +137,11 @@ get_random_bytes(void *buf, size_t buflen) > > + dev_urandom_doesnt_work = true; > > + else > > + { > > ++#ifdef _WIN64 > > ++ ssize_t nread = read (fd, buf, (unsigned int)buflen); > > ++#else > > + ssize_t nread = read (fd, buf, buflen); > > ++#endif > > + if (nread < 0 || (size_t)nread < buflen) > > + dev_urandom_doesnt_work = true; > > + > > +-- > > +2.25.1 > > + > > diff --git a/meta/recipes-core/libxcrypt/libxcrypt.inc b/meta/recipes-core/libxcrypt/libxcrypt.inc > > index ba93d91aef..b93d56b4dc 100644 > > --- a/meta/recipes-core/libxcrypt/libxcrypt.inc > > +++ b/meta/recipes-core/libxcrypt/libxcrypt.inc > > @@ -13,7 +13,9 @@ SRC_URI = "git://github.com/besser82/libxcrypt.git;branch=${SRCBRANCH};protocol= > > SRCREV = "f531a36aa916a22ef2ce7d270ba381e264250cbf" > > SRCBRANCH ?= "master" > > > > -SRC_URI += "file://fix_cflags_handling.patch" > > +SRC_URI += "file://fix_cflags_handling.patch \ > > + file://0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch \ > > + " > > > > PROVIDES = "virtual/crypt" > > > > @@ -26,4 +28,6 @@ CPPFLAGS:append:class-nativesdk = " -Wno-error" > > API = "--disable-obsolete-api" > > EXTRA_OECONF += "${API}" > > > > +CFLAGS:append:class-nativesdk = " -Wno-pedantic" > > + > > BBCLASSEXTEND = "native nativesdk" > > Should this go to meta-mingw instead of OE-Core? Shouldn't something be > submitted upstream? This certainly isn't the kind of patch we want to > carry. > yeah I tend to agree, even though they are backports but the nature of fixes is very windows specific > Cheers, > > Richard > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#190994): https://lists.openembedded.org/g/openembedded-core/message/190994 > Mute This Topic: https://lists.openembedded.org/mt/102725680/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
On 11/22/2023 06:44, Khem Raj wrote: > CAUTION: This email comes from a non Wind River email account! > Do not click links or open attachments unless you recognize the sender and know the content is safe. > > On Tue, Nov 21, 2023 at 2:42 PM Richard Purdie > <richard.purdie@linuxfoundation.org> wrote: >> On Tue, 2023-11-21 at 01:41 -0800, wenlin.kang@windriver.com via >> lists.openembedded.org wrote: >>> From: Wenlin Kang <wenlin.kang@windriver.com> >>> >>> Steps to reproduce >>> 1) add layer meta-mingw >>> 2) add line in local.conf >>> SDKMACHINE = "x86_64-mingw32" >>> 3) bitbake nativesdk-libxcrypt >>> >>> Fixed: >>> 1. pedantic error >>> | ../git/lib/crypt.c:316:24: error: ISO C does not allow extra ';' outside of a function [-Werror=pedantic] >>> | 316 | SYMVER_crypt_gensalt_rn; >>> | | >>> >>> 2. conversion error >>> | ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes': >>> | ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion] >>> | 140 | ssize_t nread = read (fd, buf, buflen); >>> >>> Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> >>> --- >>> ...dom-bytes.c-fixed-conversion-error-w.patch | 47 +++++++++++++++++++ >>> meta/recipes-core/libxcrypt/libxcrypt.inc | 6 ++- >>> 2 files changed, 52 insertions(+), 1 deletion(-) >>> create mode 100644 meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch >>> >>> diff --git a/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch >>> new file mode 100644 >>> index 0000000000..3846f76674 >>> --- /dev/null >>> +++ b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch >>> @@ -0,0 +1,47 @@ >>> +From ff99091eb8a6b9e6edc567f6d2552183fbaacec3 Mon Sep 17 00:00:00 2001 >>> +From: Wenlin Kang <wenlin.kang@windriver.com> >>> +Date: Mon, 6 Nov 2023 14:43:28 +0800 >>> +Subject: [PATCH] lib/util-get-random-bytes.c: fixed conversion error with >>> + mingw >>> + >>> +With x86_64-w64-mingw32-gcc. get below error: >>> +| ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes': >>> +| ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion] >>> +| 140 | ssize_t nread = read (fd, buf, buflen); >>> +| | ^~~~~~ >>> + >>> +In util-get-random-bytes.c, has get_random_bytes(void *buf, size_t buflen), >>> +but in mingw-w64-mingw-w64/mingw-w64-headers/crt/io.h, read() has "unsigned int" >>> +read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount), and has: >>> + #ifdef _WIN64 >>> + __MINGW_EXTENSION typedef unsigned __int64 size_t; >>> + #else >>> + typedef unsigned int size_t; >>> + #endif /* _WIN64 */ >>> + >>> +Upstream-Status: Pending >>> + >>> +Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> >>> +--- >>> + lib/util-get-random-bytes.c | 4 ++++ >>> + 1 file changed, 4 insertions(+) >>> + >>> +diff --git a/lib/util-get-random-bytes.c b/lib/util-get-random-bytes.c >>> +index 79816db..68cd378 100644 >>> +--- a/lib/util-get-random-bytes.c >>> ++++ b/lib/util-get-random-bytes.c >>> +@@ -137,7 +137,11 @@ get_random_bytes(void *buf, size_t buflen) >>> + dev_urandom_doesnt_work = true; >>> + else >>> + { >>> ++#ifdef _WIN64 >>> ++ ssize_t nread = read (fd, buf, (unsigned int)buflen); >>> ++#else >>> + ssize_t nread = read (fd, buf, buflen); >>> ++#endif >>> + if (nread < 0 || (size_t)nread < buflen) >>> + dev_urandom_doesnt_work = true; >>> + >>> +-- >>> +2.25.1 >>> + >>> diff --git a/meta/recipes-core/libxcrypt/libxcrypt.inc b/meta/recipes-core/libxcrypt/libxcrypt.inc >>> index ba93d91aef..b93d56b4dc 100644 >>> --- a/meta/recipes-core/libxcrypt/libxcrypt.inc >>> +++ b/meta/recipes-core/libxcrypt/libxcrypt.inc >>> @@ -13,7 +13,9 @@ SRC_URI = "git://github.com/besser82/libxcrypt.git;branch=${SRCBRANCH};protocol= >>> SRCREV = "f531a36aa916a22ef2ce7d270ba381e264250cbf" >>> SRCBRANCH ?= "master" >>> >>> -SRC_URI += "file://fix_cflags_handling.patch" >>> +SRC_URI += "file://fix_cflags_handling.patch \ >>> + file://0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch \ >>> + " >>> >>> PROVIDES = "virtual/crypt" >>> >>> @@ -26,4 +28,6 @@ CPPFLAGS:append:class-nativesdk = " -Wno-error" >>> API = "--disable-obsolete-api" >>> EXTRA_OECONF += "${API}" >>> >>> +CFLAGS:append:class-nativesdk = " -Wno-pedantic" >>> + >>> BBCLASSEXTEND = "native nativesdk" >> Should this go to meta-mingw instead of OE-Core? Shouldn't something be >> submitted upstream? This certainly isn't the kind of patch we want to >> carry. >> > yeah I tend to agree, even though they are backports but the nature of > fixes is very > windows specific Okay, thanks for your comments, I will send it to upstream and meta-mingw. > >> Cheers, >> >> Richard >> >> -=-=-=-=-=-=-=-=-=-=-=- >> Links: You receive all messages sent to this group. >> View/Reply Online (#190994): https://lists.openembedded.org/g/openembedded-core/message/190994 >> Mute This Topic: https://lists.openembedded.org/mt/102725680/1997914 >> Group Owner: openembedded-core+owner@lists.openembedded.org >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com] >> -=-=-=-=-=-=-=-=-=-=-=- >>
diff --git a/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch new file mode 100644 index 0000000000..3846f76674 --- /dev/null +++ b/meta/recipes-core/libxcrypt/files/0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch @@ -0,0 +1,47 @@ +From ff99091eb8a6b9e6edc567f6d2552183fbaacec3 Mon Sep 17 00:00:00 2001 +From: Wenlin Kang <wenlin.kang@windriver.com> +Date: Mon, 6 Nov 2023 14:43:28 +0800 +Subject: [PATCH] lib/util-get-random-bytes.c: fixed conversion error with + mingw + +With x86_64-w64-mingw32-gcc. get below error: +| ../git/lib/util-get-random-bytes.c: In function '_crypt_get_random_bytes': +| ../git/lib/util-get-random-bytes.c:140:42: error: conversion from 'size_t' {aka 'long long unsigned int'} to 'unsigned int' may change value [-Werror=conversion] +| 140 | ssize_t nread = read (fd, buf, buflen); +| | ^~~~~~ + +In util-get-random-bytes.c, has get_random_bytes(void *buf, size_t buflen), +but in mingw-w64-mingw-w64/mingw-w64-headers/crt/io.h, read() has "unsigned int" +read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount), and has: + #ifdef _WIN64 + __MINGW_EXTENSION typedef unsigned __int64 size_t; + #else + typedef unsigned int size_t; + #endif /* _WIN64 */ + +Upstream-Status: Pending + +Signed-off-by: Wenlin Kang <wenlin.kang@windriver.com> +--- + lib/util-get-random-bytes.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/util-get-random-bytes.c b/lib/util-get-random-bytes.c +index 79816db..68cd378 100644 +--- a/lib/util-get-random-bytes.c ++++ b/lib/util-get-random-bytes.c +@@ -137,7 +137,11 @@ get_random_bytes(void *buf, size_t buflen) + dev_urandom_doesnt_work = true; + else + { ++#ifdef _WIN64 ++ ssize_t nread = read (fd, buf, (unsigned int)buflen); ++#else + ssize_t nread = read (fd, buf, buflen); ++#endif + if (nread < 0 || (size_t)nread < buflen) + dev_urandom_doesnt_work = true; + +-- +2.25.1 + diff --git a/meta/recipes-core/libxcrypt/libxcrypt.inc b/meta/recipes-core/libxcrypt/libxcrypt.inc index ba93d91aef..b93d56b4dc 100644 --- a/meta/recipes-core/libxcrypt/libxcrypt.inc +++ b/meta/recipes-core/libxcrypt/libxcrypt.inc @@ -13,7 +13,9 @@ SRC_URI = "git://github.com/besser82/libxcrypt.git;branch=${SRCBRANCH};protocol= SRCREV = "f531a36aa916a22ef2ce7d270ba381e264250cbf" SRCBRANCH ?= "master" -SRC_URI += "file://fix_cflags_handling.patch" +SRC_URI += "file://fix_cflags_handling.patch \ + file://0001-lib-util-get-random-bytes.c-fixed-conversion-error-w.patch \ + " PROVIDES = "virtual/crypt" @@ -26,4 +28,6 @@ CPPFLAGS:append:class-nativesdk = " -Wno-error" API = "--disable-obsolete-api" EXTRA_OECONF += "${API}" +CFLAGS:append:class-nativesdk = " -Wno-pedantic" + BBCLASSEXTEND = "native nativesdk"