Hello!
On Wed, Jun 09, 2021 at 02:55:28AM +0000, 王 静凯 wrote:
> >Certainly there is a way to compile natively. Even if for some
> >reason, for example, due to lack of disk space, it is not possible
> >to compile right on the target hardware, you can always compile in
> >an emulated environment.
>
> Because there is no gcc tools on the target environment.(Or
> maybe it is exist but we could not get it.)
That's sad, but as long as you have a cross-compiler available,
you can cross-compile a compiler and use it for native
compilation.
> >If you nevertheless insist on cross-compiling, which is, as
> >outlined above, is not supported, the right approach would be to
> >check all the configure tests affected by your cross-compilation
> >changes to nginx configure, notably all feature tests with
> >"ngx_feature_run=yes" and all sizeof tests. Proper check would be
> >to obtain the test binary as produced for the test by nginx
> >configure and run it on the target system, and then make sure that
> >results produced by your patched configure match the results from
> >running test binaries on the target system.
>
> I have try to set ngx_feature_run to no to make sendfile() and
> sendfile64() work, but then the server will response
> “ERR_CONTENT_LENGTH_MISMATCH”.
There are multiple feature tests with ngx_feature_run=yes, and
each of these tests needs to be properly evaluated. Just setting
ngx_feature_run=no will likely result in incorrectly working
binary.
> And try to set ngx_size to 8, but it didn’t take effect.
Similarly, there are multiple sizeof tests, and each of these
tests needs to be properly evaluated. Just setting ngx_size for
all the tests to a fixed value is certainly wrong.
> Do you mean compiling all the test program and run on the target system?
Each feature test with ngx_feature_run=yes and each sizeof test
compiles a test program, and runs it to obtain the test result.
To properly cross-compile nginx you have to provide correct test
results yourself - that is, you have to run the test program on the
target system, record the result, and then use it in configure
instead of running the particular test program.
Note again that tests results are different for different tests.
In particular, simply returning ngx_size=4 from all the sizeof
tests is wrong and expected to cause problems like the one you are
facing. You have to properly check sizes of all the types, they
are different.
--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx