Skip to contentSkip to conversation

package/lighttpd: fix build on musl

PATCH Andreas Ziegler 2 participants 3 messages Oct 27, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Fabrice,

Quoted 51 lines · Fabrice Fontaine

Fix the following build failure on musl raised since bump to version 1.4.60 in commit d62b7f54f00291a50274409fb5510527fd725ffe:

In file included from buffer.h:404,

                 from array.h:5,
                 from array.c:3:
ck.h:24:14: error: expected ';' before 'typedef'
   24 | __BEGIN_DECLS
      |              ^
      |              ;
......
   29 | typedef size_t rsize_t;
      | ~~~~~~~

Fixes:
-
http://autobuild.buildroot.org/results/0d56a44449e89773499051b35f21ec83bfab4ca6

---
 ...-__BEGIN_DECLS-__END_DECLS-if-needed.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644

package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch

diff --git a/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch b/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch new file mode 100644
index 0000000000..cd64f18794
--- /dev/null
+++
b/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch

(quoted diff) +17 -0
@@ -0,0 +1,39 @@
+From cf4dfbe15ef8ead3a7eda974af7d804d447f00db Mon Sep 17 00:00:00 2001
+From: Glenn Strauss <[email protected]>
+Date: Mon, 4 Oct 2021 09:51:22 -0400
+Subject: [PATCH] [core] define __BEGIN_DECLS, __END_DECLS if needed
+
+[Retrieved from:
+https://github.com/lighttpd/lighttpd1.4/commit/cf4dfbe15ef8ead3a7eda974af7d804d447f00db]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/first.h | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/src/first.h b/src/first.h
+index df747ba46..9d0428ae6 100644
+--- a/src/first.h
++++ b/src/first.h
+@@ -39,6 +39,22 @@

Review line 27

Quoted 10 lines
(quoted diff) +10 -0
+ #include <sys/types.h>
+ #include <stddef.h>
+
++#ifndef __BEGIN_DECLS
++#ifdef __cplusplus
++#define __BEGIN_DECLS extern "C" {
++#else
++#define __BEGIN_DECLS
++#endif
++#endif

Instead of creating your own declarations of _*_DECLS, you might just add the missing <sys/cdefs.h> to ck.h; this seems to be the only place the problem occurs.

The header is part of glibc, but not of musl; within Buildroot it is automatically added by musl-compat-headers, which is selected if you use musl.

Kind regards,
Andreas

Quoted 13 lines
(quoted diff) +12 -1
++
++#ifndef __END_DECLS
++#ifdef __cplusplus
++#define __END_DECLS }
++#else
++#define __END_DECLS
++#endif
++#endif
++
+ #if defined HAVE_STDINT_H
+ # include <stdint.h>
+ #elif defined HAVE_INTTYPES_H
--
Quoted 1 line

2.33.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Andreas,

Quoted 72 lines · Andreas Ziegler

Hi Fabrice,

Quoted 51 lines · Fabrice Fontaine

Fix the following build failure on musl raised since bump to version 1.4.60 in commit d62b7f54f00291a50274409fb5510527fd725ffe:

In file included from buffer.h:404,

                 from array.h:5,
                 from array.c:3:
ck.h:24:14: error: expected ';' before 'typedef'
   24 | __BEGIN_DECLS
      |              ^
      |              ;
......
   29 | typedef size_t rsize_t;
      | ~~~~~~~

Fixes:
-
http://autobuild.buildroot.org/results/0d56a44449e89773499051b35f21ec83bfab4ca6

---
 ...-__BEGIN_DECLS-__END_DECLS-if-needed.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644

package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch

diff --git a/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch b/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch new file mode 100644
index 0000000000..cd64f18794
--- /dev/null
+++
b/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch

(quoted diff) +17 -0
@@ -0,0 +1,39 @@
+From cf4dfbe15ef8ead3a7eda974af7d804d447f00db Mon Sep 17 00:00:00 2001
+From: Glenn Strauss <[email protected]>
+Date: Mon, 4 Oct 2021 09:51:22 -0400
+Subject: [PATCH] [core] define __BEGIN_DECLS, __END_DECLS if needed
+
+[Retrieved from:
+https://github.com/lighttpd/lighttpd1.4/commit/cf4dfbe15ef8ead3a7eda974af7d804d447f00db]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/first.h | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/src/first.h b/src/first.h
+index df747ba46..9d0428ae6 100644
+--- a/src/first.h
++++ b/src/first.h
+@@ -39,6 +39,22 @@

Review line 27

Quoted 10 lines
(quoted diff) +10 -0
+ #include <sys/types.h>
+ #include <stddef.h>
+
++#ifndef __BEGIN_DECLS
++#ifdef __cplusplus
++#define __BEGIN_DECLS extern "C" {
++#else
++#define __BEGIN_DECLS
++#endif
++#endif

Instead of creating your own declarations of _*_DECLS, you might just add the missing <sys/cdefs.h> to ck.h; this seems to be the only place the problem occurs.

Quoted 3 lines

The header is part of glibc, but not of musl; within Buildroot it is automatically added by musl-compat-headers, which is selected if you use musl.

This is an upstream patch and I don't know if they will accept to replace it with your proposal even if it seems better. Feel free to send a PR to https://github.com/lighttpd/lighttpd1.4 and a v2 of this patch.

Quoted 18 lines

Kind regards,
Andreas

Quoted 14 lines
(quoted diff) +12 -1
++
++#ifndef __END_DECLS
++#ifdef __cplusplus
++#define __END_DECLS }
++#else
++#define __END_DECLS
++#endif
++#endif
++
+ #if defined HAVE_STDINT_H
+ # include <stdint.h>
+ #elif defined HAVE_INTTYPES_H
--

2.33.0

Best Regards,

Fabrice
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

author Tested-by
#3 lore raw

Hi Fabrice,

Quoted 75 lines · Fabrice Fontaine

Hi Andreas,

Quoted 72 lines · Andreas Ziegler

Hi Fabrice,

Quoted 51 lines · Fabrice Fontaine

Fix the following build failure on musl raised since bump to version 1.4.60 in commit d62b7f54f00291a50274409fb5510527fd725ffe:

In file included from buffer.h:404,

                 from array.h:5,
                 from array.c:3:
ck.h:24:14: error: expected ';' before 'typedef'
   24 | __BEGIN_DECLS
      |              ^
      |              ;
......
   29 | typedef size_t rsize_t;
      | ~~~~~~~

Fixes:
-
http://autobuild.buildroot.org/results/0d56a44449e89773499051b35f21ec83bfab4ca6

---
 ...-__BEGIN_DECLS-__END_DECLS-if-needed.patch | 39 +++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644

package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch

diff --git a/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch b/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch new file mode 100644
index 0000000000..cd64f18794
--- /dev/null
+++
b/package/lighttpd/0002-core-define-__BEGIN_DECLS-__END_DECLS-if-needed.patch

(quoted diff) +17 -0
@@ -0,0 +1,39 @@
+From cf4dfbe15ef8ead3a7eda974af7d804d447f00db Mon Sep 17 00:00:00 2001
+From: Glenn Strauss <[email protected]>
+Date: Mon, 4 Oct 2021 09:51:22 -0400
+Subject: [PATCH] [core] define __BEGIN_DECLS, __END_DECLS if needed
+
+[Retrieved from:
+https://github.com/lighttpd/lighttpd1.4/commit/cf4dfbe15ef8ead3a7eda974af7d804d447f00db]
+Signed-off-by: Fabrice Fontaine <[email protected]>
+---
+ src/first.h | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/src/first.h b/src/first.h
+index df747ba46..9d0428ae6 100644
+--- a/src/first.h
++++ b/src/first.h
+@@ -39,6 +39,22 @@

Review line 27

Quoted 10 lines
(quoted diff) +10 -0
+ #include <sys/types.h>
+ #include <stddef.h>
+
++#ifndef __BEGIN_DECLS
++#ifdef __cplusplus
++#define __BEGIN_DECLS extern "C" {
++#else
++#define __BEGIN_DECLS
++#endif
++#endif

Instead of creating your own declarations of _*_DECLS, you might just add the missing <sys/cdefs.h> to ck.h; this seems to be the only place the problem occurs.

Quoted 7 lines
Quoted 3 lines

The header is part of glibc, but not of musl; within Buildroot it is automatically added by musl-compat-headers, which is selected if you use musl.

This is an upstream patch and I don't know if they will accept to replace it with your proposal even if it seems better. Feel free to send a PR to https://github.com/lighttpd/lighttpd1.4 and a v2 of this patch.

No, probably not. My idea is highly Buildroot specific and will not work outside of this environment. Since the change will be incorporated in the next lighttpd release anyway, I withdraw any objections.

Quoted 18 lines
Quoted 18 lines

Kind regards,
Andreas

Quoted 14 lines
(quoted diff) +12 -1
++
++#ifndef __END_DECLS
++#ifdef __cplusplus
++#define __END_DECLS }
++#else
++#define __END_DECLS
++#endif
++#endif
++
+ #if defined HAVE_STDINT_H
+ # include <stdint.h>
+ #elif defined HAVE_INTTYPES_H
--

2.33.0

Quoted 3 lines

Best Regards,

Fabrice

Kind regards,
Andreas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot