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

tools: use Ubuntu 24.04 and Clang on GitHub actions #53212

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

targos
Copy link
Member

@targos targos commented May 30, 2024

This puts us closer to what V8 really supports.
GCC is still covered a lot by Jenkins CI.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/actions

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label May 30, 2024
@targos
Copy link
Member Author

targos commented May 30, 2024

Default Clang on ubuntu-24.04 is 18.1.3

@targos
Copy link
Member Author

targos commented May 30, 2024

ubuntu-24.04 is currently unreliable.

@targos targos marked this pull request as draft May 30, 2024 09:01
@targos
Copy link
Member Author

targos commented May 30, 2024

@targos targos marked this pull request as ready for review May 31, 2024 08:12
@targos
Copy link
Member Author

targos commented May 31, 2024

Looks like we've got something broken with the Clang build config:

=== release test-benchmark-napi ===
Path: benchmark/test-benchmark-napi
Error: --- stderr ---
node:internal/modules/cjs/loader:1215
  throw err;
  ^

Error: Cannot find module './build/Release/addon'
Require stack:
- /home/runner/work/node/node/benchmark/napi/ref/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1212:15)
    at Module._load (node:internal/modules/cjs/loader:1038:27)
    at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
    at Module.require (node:internal/modules/cjs/loader:1297:12)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (/home/runner/work/node/node/benchmark/napi/ref/index.js:3:15)
    at Module._compile (node:internal/modules/cjs/loader:1460:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)
    at Module._load (node:internal/modules/cjs/loader:1091:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/runner/work/node/node/benchmark/napi/ref/index.js' ]
}

Node.js v23.0.0-pre
node:assert:126
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

1 !== 0

    at ChildProcess.<anonymous> (/home/runner/work/node/node/test/common/benchmark.js:28:12)
    at ChildProcess.emit (node:events:520:28)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 1,
  expected: 0,
  operator: 'strictEqual'
}

Node.js v23.0.0-pre
Command: out/Release/node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /home/runner/work/node/node/test/benchmark/test-benchmark-napi.js

@richardlau
Copy link
Member

The addon didn't build:

https://github.com/nodejs/node/actions/runs/9315062604/job/25640471713?pr=53212#step:7:5466

../addon.c:53:37: error: incompatible function pointer types passing 'void (napi_env, void *, void *)' (aka 'void (struct napi_env__ *, void *, void *)') to parameter of type 'node_api_nogc_finalize' (aka 'void (*)(const struct napi_env__ *, void *, void *)') [-Wincompatible-function-pointer-types]
   53 |                                     IncrementCounter,
      |                                     ^~~~~~~~~~~~~~~~
../addon.c:7:27: note: expanded from macro 'NAPI_CALL'
    7 |     napi_status status = (call);                      \
      |                           ^~~~
/home/runner/work/node/node/out/Release/addons_headers/include/node/js_native_api.h:523:43: note: passing argument to parameter 'finalize_cb' here
  523 |                    node_api_nogc_finalize finalize_cb,
      |                                           ^
1 error generated.
make[2]: *** [addon.target.mk:106: Release/obj.target/addon/addon.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/home/runner/work/node/node/deps/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Linux 6.8.0-1007-azure
gyp ERR! command "/home/runner/work/node/node/out/Release/node" "/home/runner/work/node/node/deps/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--directory" "/home/runner/work/node/node/benchmark/napi/ref" "--nodedir" "/home/runner/work/node/node/out/Release/addons_headers" "--python" "/opt/hostedtoolcache/Python/3.12.3/x64/bin/python3" "--loglevel" "info"
gyp ERR! cwd /home/runner/work/node/node/benchmark/napi/ref
gyp ERR! node -v v23.0.0-pre
gyp ERR! node-gyp -v v10.1.0
gyp ERR! not ok 

@targos
Copy link
Member Author

targos commented May 31, 2024

Oh, interesting. I wouldn't expect tests to run if part of the build failed.

@targos
Copy link
Member Author

targos commented May 31, 2024

@nodejs/node-api Could one of you have a look?

IIUC the bug is in

static void
IncrementCounter(napi_env env, void* data, void* hint) {
size_t* count = data;
(*count) = (*count) + 1;
}
static napi_value
NewWeak(napi_env env, napi_callback_info info) {
napi_value result;
void* instance_data;
NAPI_CALL(env, napi_create_object(env, &result));
NAPI_CALL(env, napi_get_instance_data(env, &instance_data));
NAPI_CALL(env, napi_add_finalizer(env,
result,
instance_data,
IncrementCounter,
NULL,
NULL));

@KevinEady
Copy link
Contributor

Would either need to remove

#define NAPI_EXPERIMENTAL

Or change the type of IncrementCounter's env parameter to node_api_nogc_env. I'll bring this up for discussion in today's 31 May Node-API meeting.

@mhdawson
Copy link
Member

We discussed today in the node-api team meeting, @targos can you just remove #define NAPI_EXPERIMENTAL from node/benchmark/napi/ref/addon.c as part of your PR? We think that is the right thing to do in this case.

@mhdawson
Copy link
Member

With further discussion it would also be great if you could change line 38 to

IncrementCounter(node_api_nogc_env env, void* data, void* hint) {

In your PR. It won't be neeed without NAPI_EXPERIMENTAL but would be needed later. If that is not possible let @mhdawson know and he'll take a look at doing it.

targos added a commit to targos/node that referenced this pull request May 31, 2024
targos added a commit to targos/node that referenced this pull request May 31, 2024
@targos
Copy link
Member Author

targos commented May 31, 2024

Thanks! I opened a separate PR: #53233 and also added the change here to see if it works with Clang.

targos added a commit to targos/node that referenced this pull request May 31, 2024
nodejs-github-bot pushed a commit that referenced this pull request Jun 2, 2024
Refs: #53212 (comment)
PR-URL: #53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
targos added a commit that referenced this pull request Jun 3, 2024
Refs: #53212 (comment)
PR-URL: #53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
@targos targos changed the title tools: build with Clang on GitHub actions tools: use Ubuntu 22.04 and Clang on GitHub actions Jun 3, 2024
@targos
Copy link
Member Author

targos commented Jun 3, 2024

Here's a run for the daily built-lto workflow: https://github.com/targos/node/actions/runs/9348019879

@targos
Copy link
Member Author

targos commented Jun 3, 2024

@targos
Copy link
Member Author

targos commented Jun 3, 2024

Problem with LTO build:

[102/4178] LINK torque
FAILED: torque 
clang++ -pthread -rdynamic -fno-lto -m64 -m64  -flto  -o torque -Wl,--start-group obj/deps/v8/src/torque/torque.torque.o obj/tools/v8_gypfiles/libtorque_base.a obj/tools/v8_gypfiles/libv8_libbase.a  -ldl -lrt -Wl,--end-group
/usr/bin/ld: /usr/lib/llvm-18/bin/../lib/LLVMgold.so: error loading plugin: /usr/lib/llvm-18/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

@targos
Copy link
Member Author

targos commented Jun 3, 2024

@targos
Copy link
Member Author

targos commented Jun 3, 2024

llvm-18-linker-tools is already the newest version (1:18.1.3-1).
llvm-18-linker-tools set to manually installed.

There's also:

bfd plugin: LLVM gold plugin has failed to create LTO module: Unknown attribute kind (91) (Producer: 'LLVM18.1.3' Reader: 'LLVM 17.0.6')

/cc @gengjiawen who added the job.

@gengjiawen
Copy link
Member

@targos need to resolve conflicts.

This puts us closer to what V8 actively supports.
GCC is still covered a lot by Jenkins CI.

Co-authored-by: Moshe Atlow <[email protected]>
@targos
Copy link
Member Author

targos commented Jun 6, 2024

@MoLow can you review one last time? The setup is working now.

@targos targos added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 10, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 10, 2024
@nodejs-github-bot nodejs-github-bot merged commit db09f62 into nodejs:main Jun 10, 2024
21 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in db09f62

@targos targos deleted the clang-gha branch June 10, 2024 09:41
targos added a commit that referenced this pull request Jun 20, 2024
This puts us closer to what V8 actively supports.
GCC is still covered a lot by Jenkins CI.

Co-authored-by: Moshe Atlow <[email protected]>
PR-URL: #53212
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
eliphazbouye pushed a commit to eliphazbouye/node that referenced this pull request Jun 20, 2024
Refs: nodejs#53212 (comment)
PR-URL: nodejs#53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
eliphazbouye pushed a commit to eliphazbouye/node that referenced this pull request Jun 20, 2024
This puts us closer to what V8 actively supports.
GCC is still covered a lot by Jenkins CI.

Co-authored-by: Moshe Atlow <[email protected]>
PR-URL: nodejs#53212
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
Refs: nodejs#53212 (comment)
PR-URL: nodejs#53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
This puts us closer to what V8 actively supports.
GCC is still covered a lot by Jenkins CI.

Co-authored-by: Moshe Atlow <[email protected]>
PR-URL: nodejs#53212
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
richardlau pushed a commit that referenced this pull request Jul 19, 2024
Refs: #53212 (comment)
PR-URL: #53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
richardlau pushed a commit that referenced this pull request Jul 19, 2024
Refs: #53212 (comment)
PR-URL: #53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Jul 19, 2024
This puts us closer to what V8 actively supports.
GCC is still covered a lot by Jenkins CI.

Co-authored-by: Moshe Atlow <[email protected]>
PR-URL: #53212
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
marco-ippolito pushed a commit that referenced this pull request Jul 19, 2024
This puts us closer to what V8 actively supports.
GCC is still covered a lot by Jenkins CI.

Co-authored-by: Moshe Atlow <[email protected]>
PR-URL: #53212
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
trevnorris pushed a commit to nodesource/nsolid that referenced this pull request Aug 22, 2024
Refs: nodejs/node#53212 (comment)
PR-URL: nodejs/node#53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
trevnorris pushed a commit to nodesource/nsolid that referenced this pull request Aug 23, 2024
Refs: nodejs/node#53212 (comment)
PR-URL: nodejs/node#53233
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants