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

build: remove unused libatomic and librt on ppc64, s390x #29727

Closed
wants to merge 2 commits into from

Conversation

sam-github
Copy link
Contributor

@sam-github sam-github commented Sep 26, 2019

The libraries are not necessary for ppc64 or s390x. It does no harm with
some linkers, but devtoolset-6 creates runtime dependencies on all link
libraries, even unused ones.

Fixes: #27377
Fixes: #29718

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the tools Issues and PRs related to the tools directory. label Sep 26, 2019
@nodejs-github-bot
Copy link
Collaborator

@sam-github
Copy link
Contributor Author

I'll look at removing -lrt as well, it seems to just define the mq_, aio_, timer_, etc. real-time APIs, and I don't think node uses those, and librt.so.2 was one of the new runtime deps in #29718

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as long as CI is good across platforms

@richardlau
Copy link
Member

richardlau commented Sep 26, 2019

Re. -lrt, there's also

'libraries': [ '-ldl', '-lrt' ],
in libuv.

Subsystem would more accurately be build instead of tools.

@sam-github
Copy link
Contributor Author

@joransiu @miladfarca -- you should look at this, too.

@BridgeAR
Copy link
Member

Please +1 to fast-track this. I would like to prepare a patch for this soon.

@BridgeAR BridgeAR added the fast-track PRs that do not need to wait for 48 hours to land. label Sep 26, 2019
@sam-github
Copy link
Contributor Author

@bnoordhuis thoughts on the uv use of -lrt? Did you need it? I hacked in a change on this branch for testing, but I assume we'd want to upstream it to uv.

@nodejs-github-bot
Copy link
Collaborator

@sam-github
Copy link
Contributor Author

I'd like to give to tomorrow for people to comment on it, is that fast enough? But if you all think this is fine (even the uv change?), then I've no objection to fast-tracking. We can always fast-track another change, I gues, if it causes other problems. We could also switch back to ubuntu-1404 for the release machine until the issue is resolved.

@joransiu
Copy link
Contributor

LGTM

@nodejs-github-bot
Copy link
Collaborator

@sam-github sam-github changed the title tools: remove unused libatomic on ppc64, s390x tools: remove unused libatomic and librt on ppc64, s390x Sep 27, 2019
@sam-github sam-github force-pushed the unecessary-atomics branch 2 times, most recently from ab7fbf8 to 6e3b475 Compare September 27, 2019 15:52
@sam-github
Copy link
Contributor Author

sam-github commented Sep 27, 2019

I'm not sure if I'm ready to fast-track ab7fbf85d280b5beca67fcc0783f318453f3506a without comment from @nodejs/libuv, because its patching deps/uv/uv.gyp -- I opened libuv/libuv#2493 so the patch wouldn't just be floating here forever.

EDIT: after rebase, uv patch is in 6e3b475

@sam-github sam-github changed the title tools: remove unused libatomic and librt on ppc64, s390x build: remove unused libatomic and librt on ppc64, s390x Sep 27, 2019
@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member

Trott commented Sep 28, 2019

Based on @sam-github comments, removing fast-track label.

@Trott Trott removed the fast-track PRs that do not need to wait for 48 hours to land. label Sep 28, 2019
@bnoordhuis
Copy link
Member

I commented on libuv/libuv#2493 but for libuv, dropping the librt dependency isn't on the table while we still support glibc < 2.17.

Some kind of build flag to make it conditional is acceptable though.

@sam-github
Copy link
Contributor Author

Node.js doesn't support glibc < 2.17, @cjihrig @bnoordhuis any objection to just floating a patch on deps/uv?

@sam-github
Copy link
Contributor Author

Alternatively, does anyone know how to remove the refs to unused link libs? I'm poring through gcc docs, but haven't seen anything yet.

@bnoordhuis
Copy link
Member

Alternatively, does anyone know how to remove the refs to unused link libs?

Will this do?

diff --git a/common.gypi b/common.gypi
index 10b4ecfc52..b1b7d1abe6 100644
--- a/common.gypi
+++ b/common.gypi
@@ -349,6 +349,11 @@
           'BUILDING_UV_SHARED=1',
         ],
       }],
+      [ 'OS=="linux"', {
+        'link_settings': {
+          'libraries!': [ '-lrt' ],
+        },
+      }],
       [ 'OS in "linux freebsd openbsd solaris aix"', {
         'cflags': [ '-pthread' ],
         'ldflags': [ '-pthread' ],

@richardlau
Copy link
Member

Alternatively, does anyone know how to remove the refs to unused link libs?

Will this do?

diff --git a/common.gypi b/common.gypi
index 10b4ecfc52..b1b7d1abe6 100644
--- a/common.gypi
+++ b/common.gypi
@@ -349,6 +349,11 @@
           'BUILDING_UV_SHARED=1',
         ],
       }],
+      [ 'OS=="linux"', {
+        'link_settings': {
+          'libraries!': [ '-lrt' ],
+        },
+      }],
       [ 'OS in "linux freebsd openbsd solaris aix"', {
         'cflags': [ '-pthread' ],
         'ldflags': [ '-pthread' ],

Maybe avoid putting this in common.gypi as that is still used by node-gyp and thus inherited by addons?

@sam-github
Copy link
Contributor Author

wrt. #29727 (comment) @bnoordhuis no, it doesn't help, because it adds -lrt, instead of taking it away.... also, that code already exists, its down in deps/uv/uv.gyp, and its the code I'd like to get rid of.

The options I can think of are:

  1. Add a new runtime dep during a release line: this is a negative, but it comes with some positives, such as not building on an EOL ubuntu-14.04 and of broadening compatibility with older glibc (because devtools is statically linking in some of the new glibc symbols).
  2. Float a patch on deps/uv/uv.gyp: 6e3b475e1a2bc43957
  3. Find some way to convince devtools to ignore link libs if they aren't required. I'm in process of investigating this.

@danbev you don't have any insider information, do you, as to why RH's devtools-6 is behaving differently from upstream with respect to

The libraries are not necessary for ppc64 or s390x. It does no harm with some linkers, but devtoolset-6 creates runtime dependencies on all link libraries, even unused ones.

@bnoordhuis
Copy link
Member

no, it doesn't help, because it adds -lrt

@sam-github Read carefully, that exclamation mark has significance. :-)

@sam-github
Copy link
Contributor Author

sam-github commented Sep 30, 2019

@bnoordhuis Ah, subtle! OK, I'll rework the last commit on this branch and test it.

@richardlau Which .gyp file would you suggest?

@sam-github
Copy link
Contributor Author

@richardlau pending comment, I modified tools/v8_gypfiles/v8.gyp, PTAL

@nodejs-github-bot
Copy link
Collaborator

@richardlau
Copy link
Member

@bnoordhuis Ah, subtle! OK, I'll rework the last commit on this branch and test it.

@richardlau Which .gyp file would you suggest?

https://github.com/nodejs/node/blob/master/node.gypi.

@nodejs-github-bot
Copy link
Collaborator

The library is not necessary for ppc64 or s390x. It does no harm with
some linkers, but devtoolset-6 creates runtime dependencies on all link
libraries, even unused ones.

Fixes: nodejs#27377
Fixes: nodejs#29718
@nodejs-github-bot
Copy link
Collaborator

@sam-github
Copy link
Contributor Author

I did as @richardlau suggested. If this passes CI, I'm ready to land it.

@nodejs-github-bot
Copy link
Collaborator

@sam-github
Copy link
Contributor Author

sam-github commented Oct 1, 2019

Landed in f3ae3c9 and 7ec558c

@sam-github sam-github closed this Oct 1, 2019
sam-github added a commit that referenced this pull request Oct 1, 2019
The library is not necessary for ppc64 or s390x. It does no harm with
some linkers, but devtoolset-6 creates runtime dependencies on all link
libraries, even unused ones.

Fixes: #27377
Fixes: #29718

PR-URL: #29727
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
sam-github added a commit that referenced this pull request Oct 1, 2019
PR-URL: #29727
Fixes: #27377
Fixes: #29718
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@sam-github sam-github deleted the unecessary-atomics branch October 1, 2019 21:28
BridgeAR pushed a commit that referenced this pull request Oct 9, 2019
The library is not necessary for ppc64 or s390x. It does no harm with
some linkers, but devtoolset-6 creates runtime dependencies on all link
libraries, even unused ones.

Fixes: #27377
Fixes: #29718

PR-URL: #29727
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
BridgeAR pushed a commit that referenced this pull request Oct 9, 2019
PR-URL: #29727
Fixes: #27377
Fixes: #29718
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@BridgeAR BridgeAR mentioned this pull request Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

12.11.0 on PPCLE requires libatomic.so.1 libatomic for s390x