Skip to content

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

Closed
MatteoBax wants to merge 1 commit into
nodejs:mainfrom
MatteoBax:main
Closed

[deps/zlib]: Fixed cpu-features.h not found during building for Android aarch64#49828
MatteoBax wants to merge 1 commit into
nodejs:mainfrom
MatteoBax:main

Conversation

@MatteoBax

@MatteoBaxMatteoBax commented Sep 23, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp

@nodejs-github-botnodejs-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

bnoordhuis commented Sep 23, 2023

Copy link
Copy Markdown
Member

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
Copy Markdown
ContributorAuthor

I've done.

@Gonz-coding-co

This comment was marked as off-topic.

Comment threadandroid_configure.py Outdated
@lpincalpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 23, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 23, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@MatteoBaxMatteoBax 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 aarch64Sep 24, 2023
@MatteoBax

MatteoBax commented Sep 25, 2023

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
Member

@MatteoBax rebase and force push.

@bnoordhuis

Copy link
Copy Markdown
Member

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

@MatteoBax

Copy link
Copy Markdown
ContributorAuthor

I've done.

@bnoordhuis

Copy link
Copy Markdown
Member

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

@MatteoBax

Copy link
Copy Markdown
ContributorAuthor

I just squashed in a single commit.

@richardlaurichardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 28, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@zongou

Copy link
Copy Markdown

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

@MatteoBax

Copy link
Copy Markdown
ContributorAuthor

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

Ok

@MatteoBax

Copy link
Copy Markdown
ContributorAuthor

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

@richardlau

Copy link
Copy Markdown
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 <luigipinca@gmail.com>
@MatteoBax

MatteoBax commented Sep 29, 2023

Copy link
Copy Markdown
ContributorAuthor

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

@richardlaurichardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 29, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
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 <luigipinca@gmail.com>
Fixes: #49766
PR-URL: #49828
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
@richardlau

Copy link
Copy Markdown
Member

Landed in 16ac5e1.

@MatteoBax

MatteoBax commented Sep 29, 2023

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown

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

targos pushed a commit that referenced this pull request Nov 11, 2023
Fixed cpu-features.h not found issue.
Co-Authored-By: Luigi Pinca <luigipinca@gmail.com>
Fixes: #49766
PR-URL: #49828
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
@targostargos mentioned this pull request Nov 12, 2023
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 <luigipinca@gmail.com>
Fixes: nodejs#49766
PR-URL: nodejs#49828
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

buildIssues and PRs related to build files or the CI.needs-ciPRs 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

@MatteoBax@nodejs-github-bot@bnoordhuis@Gonz-coding-co@lpinca@zongou@richardlau