Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deps/zlib]: Fixed cpu-features.h not found during building for Android aarch64 #49828

Closed
wants to merge 1 commit into from

Conversation

MatteoBax
Copy link
Contributor

@MatteoBax MatteoBax commented Sep 23, 2023

Fixed #49766

I fixed cpu-features.h not found during building for Android aarch64 but now the building problems are:


../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:49:21: error: call to undeclared function 'ntohs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return (int64_t)ntohs(n.n16);
                    ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:53:21: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return (int64_t)ntohl(n.n32);
                    ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:69:7: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = nghttp3_htonl64(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:73:32: note: expanded from macro 'nghttp3_htonl64'
#    define nghttp3_htonl64(N) nghttp3_bswap64(N)
                               ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:60:17: note: expanded from macro 'nghttp3_bswap64'
    ((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32)))
                ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:74:7: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = nghttp3_htonl64(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:73:32: note: expanded from macro 'nghttp3_htonl64'
#    define nghttp3_htonl64(N) nghttp3_bswap64(N)
                               ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:60:17: note: expanded from macro 'nghttp3_bswap64'
    ((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32)))
                ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:79:7: error: call to undeclared function 'htonl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htonl(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:84:7: error: call to undeclared function 'htonl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htonl(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:89:7: error: call to undeclared function 'htons'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htons(n);
      ^
7 errors generated.


To solve this problem I created an environment variable called NDK_PATH that points to the ndk installation folder.
In the common.gypi file I added another argument to cflags which contains the path to the cpu-features.h file.

I changed only release configuration.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/gyp

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run. labels Sep 23, 2023
@bnoordhuis
Copy link
Member

bnoordhuis commented Sep 23, 2023

Thanks for the pull request. I don't think it's appropriate to modify the user's .bashrc, and using shell syntax in the build scripts is suboptimal, but what you can do instead is:

  1. print an error in android_configure when NDK_PATH is unset
  2. add it as (for example) android_ndk_path=... to GYP_DEFINES
  3. use -I<(android_ndk_path)/sources/android/cpufeatures syntax in the gyp file

@MatteoBax
Copy link
Contributor Author

I've done.

@Gonz-coding-co

This comment was marked as off-topic.

android_configure.py Outdated Show resolved Hide resolved
@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 23, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 23, 2023
@nodejs-github-bot
Copy link
Collaborator

@MatteoBax MatteoBax changed the title Fixed cpu-features.h not found during building for Android aarch64 [deps/zlib]: Fixed cpu-features.h not found during building for Android aarch64 Sep 24, 2023
@MatteoBax
Copy link
Contributor Author

MatteoBax commented Sep 25, 2023

How do I change the first commit message?
If I don't change it, it's not possible to merge the pull request.

@lpinca
Copy link
Member

lpinca commented Sep 25, 2023

@MatteoBax rebase and force push.

@bnoordhuis
Copy link
Member

@MatteoBax try rebase + squash (git rebase -i) + force-push instead of merge

@MatteoBax
Copy link
Contributor Author

I've done.

@bnoordhuis
Copy link
Member

Can you squash into a single commit? I still count 6.

@MatteoBax
Copy link
Contributor Author

I just squashed in a single commit.

@richardlau richardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2023
@nodejs-github-bot
Copy link
Collaborator

@zongou
Copy link

zongou commented Sep 28, 2023

In case you encounter anymore problem building for android, check out my this action.
Test build nodejs android

@MatteoBax
Copy link
Contributor Author

In case you encounter anymore problem building for android, check out my this action.
Test build nodejs android

Ok

@MatteoBax
Copy link
Contributor Author

What shall I do that node-test-commit, node-test-commit-osx and node-test-pull-request checks failed?

@richardlau
Copy link
Member

What shall I do that node-test-commit, node-test-commit-osx and node-test-pull-request checks failed?

@MatteoBax the node-test-commit-osx build failed because while it was queued to run this PR was force pushed and git removed the old commit that the check was scheduled to run on.

One of those force pushes has introduced additional unrelated changes to this PR to tools/osx-notarize.sh. If you could undo those changes I can restart the CI runs -- once we've started CI runs please do not update the PR unless asked to do so as every new commit or force push would require us to restart the CI runs from the beginning again.

zlib: fixes #49766

fixed cpu-features.h not found issue

Co-Authored-By: Luigi Pinca <[email protected]>
@MatteoBax
Copy link
Contributor Author

MatteoBax commented Sep 29, 2023

I've done.
It was my mistake, sorry.

@richardlau richardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2023
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2023
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

richardlau pushed a commit that referenced this pull request Sep 29, 2023
Fixed cpu-features.h not found issue.

Co-Authored-By: Luigi Pinca <[email protected]>
Fixes: #49766
PR-URL: #49828
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
@richardlau
Copy link
Member

Landed in 16ac5e1.

@richardlau richardlau closed this Sep 29, 2023
@MatteoBax
Copy link
Contributor Author

MatteoBax commented Sep 29, 2023

In case you encounter anymore problem building for android, check out my this action. Test build nodejs android

If i add -Wno-implicit-function-declaration option to cflags these problems disappear.Did you do this too?


../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:49:21: error: call to undeclared function 'ntohs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return (int64_t)ntohs(n.n16);
                    ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:53:21: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return (int64_t)ntohl(n.n32);
                    ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:69:7: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = nghttp3_htonl64(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:73:32: note: expanded from macro 'nghttp3_htonl64'
#    define nghttp3_htonl64(N) nghttp3_bswap64(N)
                               ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:60:17: note: expanded from macro 'nghttp3_bswap64'
    ((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32)))
                ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:74:7: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = nghttp3_htonl64(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:73:32: note: expanded from macro 'nghttp3_htonl64'
#    define nghttp3_htonl64(N) nghttp3_bswap64(N)
                               ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:60:17: note: expanded from macro 'nghttp3_bswap64'
    ((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32)))
                ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:79:7: error: call to undeclared function 'htonl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htonl(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:84:7: error: call to undeclared function 'htonl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htonl(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:89:7: error: call to undeclared function 'htons'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htons(n);
      ^
7 errors generated.


The next problems are:

../deps/v8/src/base/debug/stack_trace_posix.cc:156:9: error: use of undeclared identifier 'backtrace_symbols'
        backtrace_symbols(trace, static_cast<int>(size)));
        ^
../deps/v8/src/base/debug/stack_trace_posix.cc:371:32: error: use of undeclared identifier 'backtrace'; did you mean 'StackTrace'?
  count_ = static_cast<size_t>(backtrace(trace_, arraysize(trace_)));
                               ^
../deps/v8/src/base/debug/stack_trace.h:41:22: note: 'StackTrace' declared here
class V8_BASE_EXPORT StackTrace {
                     ^
2 errors generated.

How did you fix them?

I can only compile with your workflow.

@zongou I think it's best if you open a pull request to resolve these issues.

@zongou
Copy link

zongou commented Sep 29, 2023

In case you encounter anymore problem building for android, check out my this action. Test build nodejs android

If i add -Wno-implicit-function-declaration option to cflags these problems disappear.Did you do this too?


../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:49:21: error: call to undeclared function 'ntohs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return (int64_t)ntohs(n.n16);
                    ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:53:21: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    return (int64_t)ntohl(n.n32);
                    ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:69:7: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = nghttp3_htonl64(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:73:32: note: expanded from macro 'nghttp3_htonl64'
#    define nghttp3_htonl64(N) nghttp3_bswap64(N)
                               ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:60:17: note: expanded from macro 'nghttp3_bswap64'
    ((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32)))
                ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:74:7: error: call to undeclared function 'ntohl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = nghttp3_htonl64(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:73:32: note: expanded from macro 'nghttp3_htonl64'
#    define nghttp3_htonl64(N) nghttp3_bswap64(N)
                               ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.h:60:17: note: expanded from macro 'nghttp3_bswap64'
    ((uint64_t)(ntohl((uint32_t)(N))) << 32 | ntohl((uint32_t)((N) >> 32)))
                ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:79:7: error: call to undeclared function 'htonl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htonl(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:84:7: error: call to undeclared function 'htonl'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htonl(n);
      ^
../deps/ngtcp2/nghttp3/lib/nghttp3_conv.c:89:7: error: call to undeclared function 'htons'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  n = htons(n);
      ^
7 errors generated.

The next problems are:

../deps/v8/src/base/debug/stack_trace_posix.cc:156:9: error: use of undeclared identifier 'backtrace_symbols'
        backtrace_symbols(trace, static_cast<int>(size)));
        ^
../deps/v8/src/base/debug/stack_trace_posix.cc:371:32: error: use of undeclared identifier 'backtrace'; did you mean 'StackTrace'?
  count_ = static_cast<size_t>(backtrace(trace_, arraysize(trace_)));
                               ^
../deps/v8/src/base/debug/stack_trace.h:41:22: note: 'StackTrace' declared here
class V8_BASE_EXPORT StackTrace {
                     ^
2 errors generated.

How did you fix them?

I can only compile with your workflow.

@zongou I think it's best if you open a pull request to resolve these issues.

i did not encounter this problem, i guess this step have skipped this problem

echo > test/cctest/test_crypto_clienthello.cc

alexfernandez pushed a commit to alexfernandez/node that referenced this pull request Nov 1, 2023
Fixed cpu-features.h not found issue.

Co-Authored-By: Luigi Pinca <[email protected]>
Fixes: nodejs#49766
PR-URL: nodejs#49828
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
targos pushed a commit that referenced this pull request Nov 11, 2023
Fixed cpu-features.h not found issue.

Co-Authored-By: Luigi Pinca <[email protected]>
Fixes: #49766
PR-URL: #49828
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
debadree25 pushed a commit to debadree25/node that referenced this pull request Apr 15, 2024
Fixed cpu-features.h not found issue.

Co-Authored-By: Luigi Pinca <[email protected]>
Fixes: nodejs#49766
PR-URL: nodejs#49828
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[deps/zlib] Android arm64 build fails due to missing cpufeatures library
7 participants