Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#2240 closed defect (invalid)

little endian not set when cross compilation for little endian targets

Reported by: nhed@… Owned by:
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: Cc: nhed@…
uname -a: Linux mytarget 5.4.0.29 #1 SMP PREEMPT Thu Aug 26 14:49:15 EDT 2021 aarch64 GNU/Linux
nginx -V: nginx version: nginx/1.21.0
built by gcc 8.2.1 20180802 (GNU Toolchain for the A-profile Architecture 8.2-2019.01 (arm-rel-8.28))
built with OpenSSL 1.1.1g 21 Apr 2020
TLS SNI support enabled
configure arguments: --crossbuild=Linux::aarch64 --with-cc=.../buildroot/output/host/bin/aarch64-linux-gnu-gcc --with-cpp=.../buildroot/output/host/bin/aarch64-linux-gnu-gcc --with-ld-opt=' -Wl,-z,relro' --with-debug --prefix=/usr --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --pid-path=/run/nginx.pid --lock-path=/run/lock/nginx.lock --user=www-data --group=www-data --error-log-path=/dev/null --http-log-path=/dev/null --http-client-body-temp-path=/var/cache/nginx/client-body --http-proxy-temp-path=/var/cache/nginx/proxy --http-fastcgi-temp-path=/var/cache/nginx/fastcgi --http-scgi-temp-path=/var/cache/nginx/scgi --http-uwsgi-temp-path=/var/cache/nginx/uwsgi --with-pcre --without-select_module --without-poll_module --without-http-cache --with-http_v2_module --with-http_ssl_module --with-debug --with-cc-opt='-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -ggdb -fstack-protector-all -Wl,-z,relro -D_FORTIFY_SOURCE=1'

Description

This causes corrupt http2 headers

Default seems to be big endian and auto/endianness does not seem
to distinguish between failure to run (or preventing from running
cross-compiled executable). It was not obvious to me how to pass
this as a parameter so my workaround is to add the define to the
generated header post configure.

The uname -a field is for the target, so adding here the uname -a for the build host

Linux mylaptop 5.12.6-200.fc33.x86_64 #1 SMP Sat May 22 20:43:23 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Change History (4)

comment:1 by Maxim Dounin, 3 years ago

Resolution: invalid
Status: newclosed

Cross-compilation is not supported by nginx, and your attempts to cross-compile nginx are expected to fail, notably in auto/sizeof. If you are using 3rd party patches which make it look like cross-compilation is supported (it is not, as clearly shown by multiple reports, see ticket #1928 for an example), you may want to report this to the source where you've obtained these patches. Consider building natively instead.

comment:2 by nhed@…, 3 years ago

for context i'm building under buildroot

Seeing the --crossbuild option in the config sure made it look like cross-compilation is supported, my bad.

http://hg.nginx.org/nginx/file/tip/auto/options#l199

My target is an embedded system, building natively is not that practical.

comment:3 by nhed@…, 3 years ago

but additionally - this issue i'm reporting here is probably the cause of the #1928 that you mentioned. If you have a --crossbuild field why not allow someone to pass in the desired endianess?

comment:4 by Maxim Dounin, 3 years ago

this issue i'm reporting here is probably the cause of the #1928 that you mentioned

Sure, it was explicitly pointed out in the ticket.

If you have a --crossbuild field why not allow someone to pass in the desired endianess?

The --crossbuild configure option was used for compilation of Windows binaries on Unix systems using wine. And it is not really supported either, and intentionally not documented neither in ./configure --help nor in the documentation.

Note: See TracTickets for help on using tickets.