Skip to contentSkip to conversation

package/nginx: override endianness

PATCH Superseded Nevo Hed 3 participants 6 messages Aug 30, 2021 – Aug 31, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Nevo Hed

author
#0 lore raw

PATCH 1/1 package/nginx: override endianness

Though several patches exist in buildroot's nginx package dir they do not seem to address endianness.

The test program generated my the script compiles but fails to run (as it is built for another architecture) but the script does not distinguish between the failure to run the program and an indication of certain endianness. As such the fallback of big-endian is used. This setting then causes http2 headers (anything not in the satic dictionary) to come out as undecipherble trash.

This commit includes a patch to the configure script to allow a --force-endianness=big|little flag as as setting that flag in buildroot's package makefile.

---
 ...-of-endianness-for-cross-compilation.patch | 115 ++++++++++++++++++
 package/nginx/nginx.mk                        |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644 package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +115 -0
new file mode 100644
index 0000000000..137ff6ea5d
@@ -0,0 +1,115 @@
+From b1a6b13d8ac2cade71bae508c7d20fbee6807e4e Mon Sep 17 00:00:00 2001
+From: Nevo Hed <[email protected]>
+Date: Mon, 30 Aug 2021 13:28:13 -0400
+Subject: [PATCH] Allow forcing of endianness for cross-compilation
+
+Signed-off-by: Nevo Hed <[email protected]>
+---
+ auto/endianness | 61 ++++++++++++++++++++++++++++++++-----------------
+ auto/options    |  6 +++++
+ 2 files changed, 46 insertions(+), 21 deletions(-)
+
+diff --git a/auto/endianness b/auto/endianness
+index 1b552b6b..4b2a3cd7 100644
+--- a/auto/endianness
++++ b/auto/endianness
+@@ -26,25 +26,44 @@ int main(void) {
+ 
+ END
+ 
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+-
+-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+-
+-if [ -x $NGX_AUTOTEST ]; then
+-    if $NGX_AUTOTEST >/dev/null 2>&1; then
+-        echo " little endian"
++case "${NGX_FORCE_ENDIANNESS}" in
++    little)
++        echo " little endian (forced)"
+         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+-    else
+-        echo " big endian"
+-    fi
+-
+-    rm -rf $NGX_AUTOTEST*
+-
+-else
+-    rm -rf $NGX_AUTOTEST*
+-
+-    echo
+-    echo "$0: error: cannot detect system byte ordering"
+-    exit 1
+-fi
++    ;;
++
++    big)
++        echo " big endian (forced)"
++    ;;
++
++    "")
++        ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++                  -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
++
++        eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
++
++        if [ -x $NGX_AUTOTEST ]; then
++            if $NGX_AUTOTEST >/dev/null 2>&1; then
++                echo " little endian"
++                have=NGX_HAVE_LITTLE_ENDIAN . auto/have
++            else
++                echo " big endian"
++            fi
++
++            rm -rf $NGX_AUTOTEST*
++
++        else
++            rm -rf $NGX_AUTOTEST*
++
++            echo
++            echo "$0: error: cannot detect system byte ordering"
++            exit 1
++        fi
++    ;;
++
++    *)
++        echo
++        echo "$0: error: invalid \"--force-endianness=${NGX_FORCE_ENDIANNESS}\""
++        exit 1
++    ;;
++esac
+diff --git a/auto/options b/auto/options
+index 80be906e..85a06456 100644
+--- a/auto/options
++++ b/auto/options
+@@ -17,6 +17,8 @@ NGX_USER=
+ NGX_GROUP=
+ NGX_BUILD=
+ 
++NGX_FORCE_ENDIANNESS=
++
+ CC=${CC:-cc}
+ CPP=
+ NGX_OBJS=objs
+@@ -196,6 +198,8 @@ do
+         --user=*)                        NGX_USER="$value"          ;;
+         --group=*)                       NGX_GROUP="$value"         ;;
+ 
++        --force-endianness=*)            NGX_FORCE_ENDIANNESS="$value" ;;
++
+         --crossbuild=*)                  NGX_PLATFORM="$value"      ;;
+ 
+         --build=*)                       NGX_BUILD="$value"         ;;
+@@ -432,6 +436,8 @@ cat << END
+   --build=NAME                       set build name
+   --builddir=DIR                     set build directory
+ 
++  --force-endianness=<big>|<little>  force endianness
++
+   --with-select_module               enable select module
+   --without-select_module            disable select module
+   --with-poll_module                 enable poll module
+-- 
+2.31.1
+
package/nginx/nginx.mk +1 -0
index 1f996cc613..31b6e276b7 100644
@@ -49,6 +49,7 @@ NGINX_CONF_ENV += \
 
 # prefix: nginx root configuration location
 NGINX_CONF_OPTS += \
+	--force-endianness=$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) \
 	--prefix=/usr \
 	--conf-path=/etc/nginx/nginx.conf \
 	--sbin-path=/usr/sbin/nginx \
Signature · 6 lines
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
author
#1 lore raw

Hi All

This is my first contribution attempt in buildroot.

Just noticed a couple of typos (missing words actually) in the top commit message. Should I wait for other feedback or work on replacement patch asap (won't be in office for at least 5 from now).

Quoted 161 lines · Nevo Hed

Though several patches exist in buildroot's nginx package dir they do not seem to address endianness.

The test program generated my the script compiles but fails to run (as it is built for another architecture) but the script does not distinguish between the failure to run the program and an indication of certain endianness. As such the fallback of big-endian is used. This setting then causes http2 headers (anything not in the satic dictionary) to come out as undecipherble trash.

This commit includes a patch to the configure script to allow a --force-endianness=big|little flag as as setting that flag in buildroot's package makefile.

---
 ...-of-endianness-for-cross-compilation.patch | 115 ++++++++++++++++++
 package/nginx/nginx.mk                        |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

diff --git a/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file mode 100644
index 0000000000..137ff6ea5d
--- /dev/null
+++
b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +53 -0
@@ -0,0 +1,115 @@
+From b1a6b13d8ac2cade71bae508c7d20fbee6807e4e Mon Sep 17 00:00:00 2001
+From: Nevo Hed <[email protected]>
+Date: Mon, 30 Aug 2021 13:28:13 -0400
+Subject: [PATCH] Allow forcing of endianness for cross-compilation
+
+Signed-off-by: Nevo Hed <[email protected]>
+---
+ auto/endianness | 61 ++++++++++++++++++++++++++++++++-----------------
+ auto/options    |  6 +++++
+ 2 files changed, 46 insertions(+), 21 deletions(-)
+
+diff --git a/auto/endianness b/auto/endianness
+index 1b552b6b..4b2a3cd7 100644
+--- a/auto/endianness
++++ b/auto/endianness
+@@ -26,25 +26,44 @@ int main(void) {
+
+ END
+
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+-
+-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+-
+-if [ -x $NGX_AUTOTEST ]; then
+-    if $NGX_AUTOTEST >/dev/null 2>&1; then
+-        echo " little endian"
++case "${NGX_FORCE_ENDIANNESS}" in
++    little)
++        echo " little endian (forced)"
+         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+-    else
+-        echo " big endian"
+-    fi
+-
+-    rm -rf $NGX_AUTOTEST*
+-
+-else
+-    rm -rf $NGX_AUTOTEST*
+-
+-    echo
+-    echo "$0: error: cannot detect system byte ordering"
+-    exit 1
+-fi
++    ;;
++
++    big)
++        echo " big endian (forced)"
++    ;;
++
++    "")
++        ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++                  -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT

$ngx_feature_libs"
++
++ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
++
++ if [ -x $NGX_AUTOTEST ]; then
++ if $NGX_AUTOTEST >/dev/null 2>&1; then
++ echo " little endian"
++ have=NGX_HAVE_LITTLE_ENDIAN . auto/have
++ else
++ echo " big endian"
++ fi
++
++ rm -rf $NGX_AUTOTEST*
++
++ else
++ rm -rf $NGX_AUTOTEST*
++

++            echo
++            echo "$0: error: cannot detect system byte ordering"
++            exit 1

++ fi
++ ;;
++
++ *)
++ echo
++ echo "$0: error: invalid
\"--force-endianness=${NGX_FORCE_ENDIANNESS}\""
++ exit 1
++ ;;
++esac

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +34 -0
+diff --git a/auto/options b/auto/options
+index 80be906e..85a06456 100644
+--- a/auto/options
++++ b/auto/options
+@@ -17,6 +17,8 @@ NGX_USER=
+ NGX_GROUP=
+ NGX_BUILD=
+
++NGX_FORCE_ENDIANNESS=
++
+ CC=${CC:-cc}
+ CPP=
+ NGX_OBJS=objs
+@@ -196,6 +198,8 @@ do
+         --user=*)                        NGX_USER="$value"          ;;
+         --group=*)                       NGX_GROUP="$value"         ;;
+
++        --force-endianness=*)            NGX_FORCE_ENDIANNESS="$value" ;;
++
+         --crossbuild=*)                  NGX_PLATFORM="$value"      ;;
+
+         --build=*)                       NGX_BUILD="$value"         ;;
+@@ -432,6 +436,8 @@ cat << END
+   --build=NAME                       set build name
+   --builddir=DIR                     set build directory
+
++  --force-endianness=<big>|<little>  force endianness
++
+   --with-select_module               enable select module
+   --without-select_module            disable select module
+   --with-poll_module                 enable poll module
+--
+2.31.1
+
package/nginx/nginx.mk +1 -1
index 1f996cc613..31b6e276b7 100644
@@ -49,6 +49,7 @@ NGINX_CONF_ENV += \
 
 # prefix: nginx root configuration location
 NGINX_CONF_OPTS += \
+       --force-endianness=$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) \
        --prefix=/usr \
        --conf-path=/etc/nginx/nginx.conf \
        --sbin-path=/usr/sbin/nginx \
--
Quoted 3 lines

2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw
Quoted 5 lines · Nevo Hed

This is my first contribution attempt in buildroot.

Just noticed a couple of typos (missing words actually) in the top commit message. Should I wait for other feedback or work on replacement patch asap (won't be in office for at least 5 from now).

You can do either.

In case you send v2 patch, make sure to mark this one as superseded in the Buildroot patchwork:

http://patchwork.ozlabs.org/project/buildroot/list/

baruch

Quoted 164 lines · Nevo Hed

Though several patches exist in buildroot's nginx package dir they do not seem to address endianness.

The test program generated my the script compiles but fails to run (as it is built for another architecture) but the script does not distinguish between the failure to run the program and an indication of certain endianness. As such the fallback of big-endian is used. This setting then causes http2 headers (anything not in the satic dictionary) to come out as undecipherble trash.

This commit includes a patch to the configure script to allow a --force-endianness=big|little flag as as setting that flag in buildroot's package makefile.

---

  ...-of-endianness-for-cross-compilation.patch | 115 ++++++++++++++++++
  package/nginx/nginx.mk                        |   1 +
  2 files changed, 116 insertions(+)

create mode 100644 package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

diff --git a/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file mode 100644
index 0000000000..137ff6ea5d
--- /dev/null
+++ b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch @@ -0,0 +1,115 @@
+From b1a6b13d8ac2cade71bae508c7d20fbee6807e4e Mon Sep 17 00:00:00 2001 +From: Nevo Hed <[email protected]>
+Date: Mon, 30 Aug 2021 13:28:13 -0400
+Subject: [PATCH] Allow forcing of endianness for cross-compilation
+
+Signed-off-by: Nevo Hed <[email protected]>

 +---
 + auto/endianness | 61 ++++++++++++++++++++++++++++++++-----------------
 + auto/options    |  6 +++++
 + 2 files changed, 46 insertions(+), 21 deletions(-)
 +
 +diff --git a/auto/endianness b/auto/endianness
 +index 1b552b6b..4b2a3cd7 100644
 +--- a/auto/endianness
 ++++ b/auto/endianness
 +@@ -26,25 +26,44 @@ int main(void) {
 + 
 + END
 + 
 +-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
 +-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
 +-
 +-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
 +-
 +-if [ -x $NGX_AUTOTEST ]; then
 +-    if $NGX_AUTOTEST >/dev/null 2>&1; then
 +-        echo " little endian"
 ++case "${NGX_FORCE_ENDIANNESS}" in
 ++    little)
 ++        echo " little endian (forced)"
 +         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
 +-    else
 +-        echo " big endian"
 +-    fi
 +-
 +-    rm -rf $NGX_AUTOTEST*
 +-
 +-else
 +-    rm -rf $NGX_AUTOTEST*
 +-
 +-    echo
 +-    echo "$0: error: cannot detect system byte ordering"
 +-    exit 1
 +-fi
 ++    ;;
 ++
 ++    big)
 ++        echo " big endian (forced)"
 ++    ;;
 ++
 ++    "")
 ++        ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
 ++                  -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
 ++
 ++        eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
 ++
 ++        if [ -x $NGX_AUTOTEST ]; then
 ++            if $NGX_AUTOTEST >/dev/null 2>&1; then
 ++                echo " little endian"
 ++                have=NGX_HAVE_LITTLE_ENDIAN . auto/have
 ++            else
 ++                echo " big endian"
 ++            fi
 ++
 ++            rm -rf $NGX_AUTOTEST*
 ++
 ++        else
 ++            rm -rf $NGX_AUTOTEST*
 ++
 ++            echo
 ++            echo "$0: error: cannot detect system byte ordering"
 ++            exit 1
 ++        fi
 ++    ;;
 ++
 ++    *)
 ++        echo
 ++        echo "$0: error: invalid \"--force-endianness=${NGX_FORCE_ENDIANNESS}\""
 ++        exit 1
 ++    ;;
 ++esac
 +diff --git a/auto/options b/auto/options
 +index 80be906e..85a06456 100644
 +--- a/auto/options
 ++++ b/auto/options
 +@@ -17,6 +17,8 @@ NGX_USER=
 + NGX_GROUP=
 + NGX_BUILD=
 + 
 ++NGX_FORCE_ENDIANNESS=
 ++
 + CC=${CC:-cc}
 + CPP=
 + NGX_OBJS=objs
 +@@ -196,6 +198,8 @@ do
 +         --user=*)                        NGX_USER="$value"          ;;
 +         --group=*)                       NGX_GROUP="$value"         ;;
 + 
 ++        --force-endianness=*)            NGX_FORCE_ENDIANNESS="$value" ;;
 ++
 +         --crossbuild=*)                  NGX_PLATFORM="$value"      ;;
 + 
 +         --build=*)                       NGX_BUILD="$value"         ;;
 +@@ -432,6 +436,8 @@ cat << END
 +   --build=NAME                       set build name
 +   --builddir=DIR                     set build directory
 + 
 ++  --force-endianness=<big>|<little>  force endianness
 ++
 +   --with-select_module               enable select module
 +   --without-select_module            disable select module
 +   --with-poll_module                 enable poll module

+--
+2.31.1
+
diff --git a/package/nginx/nginx.mk b/package/nginx/nginx.mk index 1f996cc613..31b6e276b7 100644
--- a/package/nginx/nginx.mk
+++ b/package/nginx/nginx.mk
@@ -49,6 +49,7 @@ NGINX_CONF_ENV += \

# prefix: nginx root configuration location
NGINX_CONF_OPTS += \

 +       --force-endianness=$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) \
         --prefix=/usr \
         --conf-path=/etc/nginx/nginx.conf \
         --sbin-path=/usr/sbin/nginx \

--
2.31.1

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 7 lines
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - [email protected] - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot
#3 lore raw
In reply to Nevo Hed
Quoted 27 lines · Nevo Hed

Though several patches exist in buildroot's nginx package dir they do not seem to address endianness.

The test program generated my the script compiles but fails to run (as it is built for another architecture) but the script does not distinguish between the failure to run the program and an indication of certain endianness. As such the fallback of big-endian is used. This setting then causes http2 headers (anything not in the satic dictionary) to come out as undecipherble trash.

This commit includes a patch to the configure script to allow a --force-endianness=big|little flag as as setting that flag in buildroot's package makefile.

---
 ...-of-endianness-for-cross-compilation.patch | 115 ++++++++++++++++++
 package/nginx/nginx.mk                        |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644 package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +0 -0
new file mode 100644
index 0000000000..137ff6ea5d

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch line 6

Quoted 6 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +6 -0
@@ -0,0 +1,115 @@
+From b1a6b13d8ac2cade71bae508c7d20fbee6807e4e Mon Sep 17 00:00:00 2001
+From: Nevo Hed <[email protected]>
+Date: Mon, 30 Aug 2021 13:28:13 -0400
+Subject: [PATCH] Allow forcing of endianness for cross-compilation
+
+Signed-off-by: Nevo Hed <[email protected]>

Ideally, you should have sent the patch upstream and you should add a reference
to the upstream contribution. In this case, it can be as simple as:

Upstream-status: Invalid (upstream doesn't support cross-compilation) See https://trac.nginx.org/nginx/ticket/2240

Regards,
Arnout

Quoted 115 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +109 -0
+---
+ auto/endianness | 61 ++++++++++++++++++++++++++++++++-----------------
+ auto/options    |  6 +++++
+ 2 files changed, 46 insertions(+), 21 deletions(-)
+
+diff --git a/auto/endianness b/auto/endianness
+index 1b552b6b..4b2a3cd7 100644
+--- a/auto/endianness
++++ b/auto/endianness
+@@ -26,25 +26,44 @@ int main(void) {
+ 
+ END
+ 
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+-
+-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+-
+-if [ -x $NGX_AUTOTEST ]; then
+-    if $NGX_AUTOTEST >/dev/null 2>&1; then
+-        echo " little endian"
++case "${NGX_FORCE_ENDIANNESS}" in
++    little)
++        echo " little endian (forced)"
+         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+-    else
+-        echo " big endian"
+-    fi
+-
+-    rm -rf $NGX_AUTOTEST*
+-
+-else
+-    rm -rf $NGX_AUTOTEST*
+-
+-    echo
+-    echo "$0: error: cannot detect system byte ordering"
+-    exit 1
+-fi
++    ;;
++
++    big)
++        echo " big endian (forced)"
++    ;;
++
++    "")
++        ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++                  -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
++
++        eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
++
++        if [ -x $NGX_AUTOTEST ]; then
++            if $NGX_AUTOTEST >/dev/null 2>&1; then
++                echo " little endian"
++                have=NGX_HAVE_LITTLE_ENDIAN . auto/have
++            else
++                echo " big endian"
++            fi
++
++            rm -rf $NGX_AUTOTEST*
++
++        else
++            rm -rf $NGX_AUTOTEST*
++
++            echo
++            echo "$0: error: cannot detect system byte ordering"
++            exit 1
++        fi
++    ;;
++
++    *)
++        echo
++        echo "$0: error: invalid \"--force-endianness=${NGX_FORCE_ENDIANNESS}\""
++        exit 1
++    ;;
++esac
+diff --git a/auto/options b/auto/options
+index 80be906e..85a06456 100644
+--- a/auto/options
++++ b/auto/options
+@@ -17,6 +17,8 @@ NGX_USER=
+ NGX_GROUP=
+ NGX_BUILD=
+ 
++NGX_FORCE_ENDIANNESS=
++
+ CC=${CC:-cc}
+ CPP=
+ NGX_OBJS=objs
+@@ -196,6 +198,8 @@ do
+         --user=*)                        NGX_USER="$value"          ;;
+         --group=*)                       NGX_GROUP="$value"         ;;
+ 
++        --force-endianness=*)            NGX_FORCE_ENDIANNESS="$value" ;;
++
+         --crossbuild=*)                  NGX_PLATFORM="$value"      ;;
+ 
+         --build=*)                       NGX_BUILD="$value"         ;;
+@@ -432,6 +436,8 @@ cat << END
+   --build=NAME                       set build name
+   --builddir=DIR                     set build directory
+ 
++  --force-endianness=<big>|<little>  force endianness
++
+   --with-select_module               enable select module
+   --without-select_module            disable select module
+   --with-poll_module                 enable poll module
+-- 
+2.31.1
+
package/nginx/nginx.mk +0 -0
index 1f996cc613..31b6e276b7 100644

package/nginx/nginx.mk NGINX_CONF_ENV += \ · line 55

Quoted 7 lines
package/nginx/nginx.mk +1 -0
@@ -49,6 +49,7 @@ NGINX_CONF_ENV += \
 
 # prefix: nginx root configuration location
 NGINX_CONF_OPTS += \
+	--force-endianness=$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) \
 	--prefix=/usr \
 	--conf-path=/etc/nginx/nginx.conf \
 	--sbin-path=/usr/sbin/nginx \

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

author
#4 lore raw

Yes Arnout, That link is my report to nginx.

I will add that comment to my patch, but quick question - will that go on my inner or outer patch?
I don't see the word 'upstream' in any of the current nginx patches and most of them deal with unsupported cross-compilation

Quoted 171 lines · Arnout Vandecappelle
Quoted 14 lines · Nevo Hed

Though several patches exist in buildroot's nginx package dir they do not seem to address endianness.

The test program generated my the script compiles but fails to run (as it is built for another architecture) but the script does not distinguish between the failure to run the program and an indication of certain endianness. As such the fallback of big-endian is used. This setting then causes http2 headers (anything not in the satic dictionary) to come out as undecipherble trash.

This commit includes a patch to the configure script to allow a --force-endianness=big|little flag as as setting that flag in buildroot's package makefile.

Quoted 6 lines
---
 ...-of-endianness-for-cross-compilation.patch | 115 ++++++++++++++++++
 package/nginx/nginx.mk                        |   1 +
 2 files changed, 116 insertions(+)
 create mode 100644

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

Quoted 2 lines

diff --git

a/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

Quoted 4 lines

new file mode 100644
index 0000000000..137ff6ea5d
--- /dev/null
+++

b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch line 6

Quoted 7 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +6 -0
@@ -0,0 +1,115 @@
+From b1a6b13d8ac2cade71bae508c7d20fbee6807e4e Mon Sep 17 00:00:00 2001
+From: Nevo Hed <[email protected]>
+Date: Mon, 30 Aug 2021 13:28:13 -0400
+Subject: [PATCH] Allow forcing of endianness for cross-compilation
+
+Signed-off-by: Nevo Hed <[email protected]>

Ideally, you should have sent the patch upstream and you should add a
reference
to the upstream contribution. In this case, it can be as simple as:

Upstream-status: Invalid (upstream doesn't support cross-compilation) See https://trac.nginx.org/nginx/ticket/2240

Regards,
Arnout

Quoted 5 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +5 -0
+---
+ auto/endianness | 61 ++++++++++++++++++++++++++++++++-----------------
+ auto/options    |  6 +++++
+ 2 files changed, 46 insertions(+), 21 deletions(-)
+

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

Quoted 10 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +10 -0
+diff --git a/auto/endianness b/auto/endianness
+index 1b552b6b..4b2a3cd7 100644
+--- a/auto/endianness
++++ b/auto/endianness
+@@ -26,25 +26,44 @@ int main(void) {
+
+ END
+
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT

$ngx_feature_libs"

Quoted 22 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +22 -0
+-
+-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+-
+-if [ -x $NGX_AUTOTEST ]; then
+-    if $NGX_AUTOTEST >/dev/null 2>&1; then
+-        echo " little endian"
++case "${NGX_FORCE_ENDIANNESS}" in
++    little)
++        echo " little endian (forced)"
+         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+-    else
+-        echo " big endian"
+-    fi
+-
+-    rm -rf $NGX_AUTOTEST*
+-
+-else
+-    rm -rf $NGX_AUTOTEST*
+-
+-    echo
+-    echo "$0: error: cannot detect system byte ordering"
+-    exit 1

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

Quoted 10 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +10 -0
+-fi
++    ;;
++
++    big)
++        echo " big endian (forced)"
++    ;;
++
++    "")
++        ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++                  -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT

$ngx_feature_libs"

Quoted 15 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +15 -0
++
++        eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
++
++        if [ -x $NGX_AUTOTEST ]; then
++            if $NGX_AUTOTEST >/dev/null 2>&1; then
++                echo " little endian"
++                have=NGX_HAVE_LITTLE_ENDIAN . auto/have
++            else
++                echo " big endian"
++            fi
++
++            rm -rf $NGX_AUTOTEST*
++
++        else
++            rm -rf $NGX_AUTOTEST*

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

Quoted 10 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +10 -0
++
++            echo
++            echo "$0: error: cannot detect system byte ordering"
++            exit 1
++        fi
++    ;;
++
++    *)
++        echo
++        echo "$0: error: invalid

\"--force-endianness=${NGX_FORCE_ENDIANNESS}\""

Quoted 11 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +11 -0
++        exit 1
++    ;;
++esac
+diff --git a/auto/options b/auto/options
+index 80be906e..85a06456 100644
+--- a/auto/options
++++ b/auto/options
+@@ -17,6 +17,8 @@ NGX_USER=
+ NGX_GROUP=
+ NGX_BUILD=
+

package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch

Quoted 10 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +10 -0
++NGX_FORCE_ENDIANNESS=
++
+ CC=${CC:-cc}
+ CPP=
+ NGX_OBJS=objs
+@@ -196,6 +198,8 @@ do
+         --user=*)                        NGX_USER="$value"          ;;
+         --group=*)                       NGX_GROUP="$value"         ;;
+
++        --force-endianness=*)            NGX_FORCE_ENDIANNESS="$value"

;;

Quoted 22 lines
package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch new file +16 -0
++
+         --crossbuild=*)                  NGX_PLATFORM="$value"      ;;
+
+         --build=*)                       NGX_BUILD="$value"         ;;
+@@ -432,6 +436,8 @@ cat << END
+   --build=NAME                       set build name
+   --builddir=DIR                     set build directory
+
++  --force-endianness=<big>|<little>  force endianness
++
+   --with-select_module               enable select module
+   --without-select_module            disable select module
+   --with-poll_module                 enable poll module
+--
+2.31.1
+
package/nginx/nginx.mk +0 -0
index 1f996cc613..31b6e276b7 100644
@@ -49,6 +49,7 @@ NGINX_CONF_ENV += \
 
Quoted 8 lines

package/nginx/nginx.mk NGINX_CONF_ENV += \ · line 55

Quoted 7 lines
package/nginx/nginx.mk +1 -0
 # prefix: nginx root configuration location
 NGINX_CONF_OPTS += \
+     --force-endianness=$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) \
      --prefix=/usr \
      --conf-path=/etc/nginx/nginx.conf \
      --sbin-path=/usr/sbin/nginx \

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot

#5 lore raw
Quoted 4 lines · Nevo Hed

Yes Arnout, That link is my report to nginx.

I will add that comment to my patch, but quick question - will that go on my inner or outer patch?

The inner patch.

Quoted 2 lines

I don't see the word 'upstream' in any of the current nginx patches and most of them deal with unsupported cross-compilation

Most of the patches are very old and we didn't have that "rule" back then. The
rule is also not very strict - we often overlook it while applying.

Note: small changes like this (and the spelling fixes in the commit message) we
can make while applying, but of course it's much appreciated if you send a v2 with all the fixes.

Regards,
Arnout

Quoted 177 lines

On Tue, Aug 31, 2021 at 9:45 AM Arnout Vandecappelle <[email protected] <mailto:[email protected]>> wrote:

    On 30/08/2021 22:53, Nevo Hed wrote:
    > Though several patches exist in buildroot's nginx package dir they do
    > not seem to address endianness.
    >
    > The test program generated my the script compiles but fails to run (as
    > it is built for another architecture) but the script does not
    > distinguish between the failure to run the program and an indication
    > of certain endianness.  As such the fallback of big-endian is used.
    > This setting then causes http2 headers (anything not in the satic
    > dictionary) to come out as undecipherble trash.
    >
    > This commit includes a patch to the configure script to allow a
    > `--force-endianness=big|little` flag as as setting that flag in
    > buildroot's package makefile.
    >
    > Signed-off-by: Nevo Hed <[email protected]
    <mailto:nhed%[email protected]>>
    > ---
    >  ...-of-endianness-for-cross-compilation.patch | 115 ++++++++++++++++++
    >  package/nginx/nginx.mk <http://nginx.mk>                        |   1 +
    >  2 files changed, 116 insertions(+)
    >  create mode 100644
    package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
    >
    > diff --git
    a/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
    b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
    > new file mode 100644
    > index 0000000000..137ff6ea5d
    > --- /dev/null
    > +++
    b/package/nginx/0010-Allow-forcing-of-endianness-for-cross-compilation.patch
    > @@ -0,0 +1,115 @@
    > +From b1a6b13d8ac2cade71bae508c7d20fbee6807e4e Mon Sep 17 00:00:00 2001
    > +From: Nevo Hed <[email protected]
    <mailto:nhed%[email protected]>>
    > +Date: Mon, 30 Aug 2021 13:28:13 -0400
    > +Subject: [PATCH] Allow forcing of endianness for cross-compilation
    > +
    > +Signed-off-by: Nevo Hed <[email protected]
    <mailto:nhed%[email protected]>>

     Ideally, you should have sent the patch upstream and you should add a reference
    to the upstream contribution. In this case, it can be as simple as:

    Upstream-status: Invalid (upstream doesn't support cross-compilation)
    See https://trac.nginx.org/nginx/ticket/2240
    <https://trac.nginx.org/nginx/ticket/2240>


     Regards,
     Arnout

    > +---
    > + auto/endianness | 61 ++++++++++++++++++++++++++++++++-----------------
    > + auto/options    |  6 +++++
    > + 2 files changed, 46 insertions(+), 21 deletions(-)
    > +
    > +diff --git a/auto/endianness b/auto/endianness
    > +index 1b552b6b..4b2a3cd7 100644
    > +--- a/auto/endianness
    > ++++ b/auto/endianness
    > +@@ -26,25 +26,44 @@ int main(void) {
    > +
    > + END
    > +
    > +-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
    > +-          -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
    > +-
    > +-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
    > +-
    > +-if [ -x $NGX_AUTOTEST ]; then
    > +-    if $NGX_AUTOTEST >/dev/null 2>&1; then
    > +-        echo " little endian"
    > ++case "${NGX_FORCE_ENDIANNESS}" in
    > ++    little)
    > ++        echo " little endian (forced)"
    > +         have=NGX_HAVE_LITTLE_ENDIAN . auto/have
    > +-    else
    > +-        echo " big endian"
    > +-    fi
    > +-
    > +-    rm -rf $NGX_AUTOTEST*
    > +-
    > +-else
    > +-    rm -rf $NGX_AUTOTEST*
    > +-
    > +-    echo
    > +-    echo "$0: error: cannot detect system byte ordering"
    > +-    exit 1
    > +-fi
    > ++    ;;
    > ++
    > ++    big)
    > ++        echo " big endian (forced)"
    > ++    ;;
    > ++
    > ++    "")
    > ++        ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
    > ++                  -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT
    $ngx_feature_libs"
    > ++
    > ++        eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
    > ++
    > ++        if [ -x $NGX_AUTOTEST ]; then
    > ++            if $NGX_AUTOTEST >/dev/null 2>&1; then
    > ++                echo " little endian"
    > ++                have=NGX_HAVE_LITTLE_ENDIAN . auto/have
    > ++            else
    > ++                echo " big endian"
    > ++            fi
    > ++
    > ++            rm -rf $NGX_AUTOTEST*
    > ++
    > ++        else
    > ++            rm -rf $NGX_AUTOTEST*
    > ++
    > ++            echo
    > ++            echo "$0: error: cannot detect system byte ordering"
    > ++            exit 1
    > ++        fi
    > ++    ;;
    > ++
    > ++    *)
    > ++        echo
    > ++        echo "$0: error: invalid
    \"--force-endianness=${NGX_FORCE_ENDIANNESS}\""
    > ++        exit 1
    > ++    ;;
    > ++esac
    > +diff --git a/auto/options b/auto/options
    > +index 80be906e..85a06456 100644
    > +--- a/auto/options
    > ++++ b/auto/options
    > +@@ -17,6 +17,8 @@ NGX_USER=
    > + NGX_GROUP=
    > + NGX_BUILD=
    > +
    > ++NGX_FORCE_ENDIANNESS=
    > ++
    > + CC=${CC:-cc}
    > + CPP=
    > + NGX_OBJS=objs
    > +@@ -196,6 +198,8 @@ do
    > +         --user=*)                        NGX_USER="$value"          ;;
    > +         --group=*)                       NGX_GROUP="$value"         ;;
    > +
    > ++        --force-endianness=*)            NGX_FORCE_ENDIANNESS="$value" ;;
    > ++
    > +         --crossbuild=*)                  NGX_PLATFORM="$value"      ;;
    > +
    > +         --build=*)                       NGX_BUILD="$value"         ;;
    > +@@ -432,6 +436,8 @@ cat << END
    > +   --build=NAME                       set build name
    > +   --builddir=DIR                     set build directory
    > +
    > ++  --force-endianness=<big>|<little>  force endianness
    > ++
    > +   --with-select_module               enable select module
    > +   --without-select_module            disable select module
    > +   --with-poll_module                 enable poll module
    > +--
    > +2.31.1
    > +
    > diff --git a/package/nginx/nginx.mk <http://nginx.mk>
    b/package/nginx/nginx.mk <http://nginx.mk>
    > index 1f996cc613..31b6e276b7 100644
    > --- a/package/nginx/nginx.mk <http://nginx.mk>
    > +++ b/package/nginx/nginx.mk <http://nginx.mk>
    > @@ -49,6 +49,7 @@ NGINX_CONF_ENV += \
Quoted 9 lines
    > 
    >  # prefix: nginx root configuration location
    >  NGINX_CONF_OPTS += \
    > +     --force-endianness=$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN))) \
    >       --prefix=/usr \
    >       --conf-path=/etc/nginx/nginx.conf \
    >       --sbin-path=/usr/sbin/nginx \
    >

_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot