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

Building Node.js broken when using ccache #40542

Closed
GeoffreyBooth opened this issue Oct 21, 2021 · 9 comments · Fixed by #40550
Closed

Building Node.js broken when using ccache #40542

GeoffreyBooth opened this issue Oct 21, 2021 · 9 comments · Fixed by #40550
Labels
build Issues and PRs related to build files or the CI.

Comments

@GeoffreyBooth
Copy link
Member

GeoffreyBooth commented Oct 21, 2021

Version

master @ f233cb2

Platform

Darwin Geoffreys-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64

What steps will reproduce the bug?

  1. Follow the instructions in https://github.com/nodejs/node/blob/master/BUILDING.md#speeding-up-frequent-rebuilds-when-developing to install and configure ccache. (I’m on a Mac, so I did brew install ccache). In particular, don’t skip the steps to export CC and export CXX.

  2. Run ./configure. I see this error:

    Node.js configure: Found Python 3.9.7...
    ERROR: Did not find a new enough assembler, install one or build with
           –openssl-no-asm.
           Please refer to BUILDING.md
    
  3. Run unset CC GCC. Then when I run ./configure the command completes successfully.

How often does it reproduce? Is there a required condition?

Every time.

Additional information

cc @nodejs/build-files

@GeoffreyBooth GeoffreyBooth added the build Issues and PRs related to build files or the CI. label Oct 21, 2021
@Trott
Copy link
Member

Trott commented Oct 21, 2021

I'm running ccache on a Mac and have no problems, but I don't have the environment variables set. Instead, /usr/local/opt/ccache/libexec is in my PATH. I guess the docs need to be updated but otherwise everything is fine.

@Trott
Copy link
Member

Trott commented Oct 21, 2021

I'm also using an older version of ccache (3.4.2, whereas current is 4.4.2).

@Trott
Copy link
Member

Trott commented Oct 21, 2021

Looking at https://github.com/ccache/ccache/blob/5243c21f4c7a8e048ac214bb5a1d78ddd769fbd1/doc/INSTALL.md, it appears that I've done the "use ccache for everything" method whereas our docs use the "try it out" method. That's probably what we want to suggest to users so that we don't affect compilation of other things.

@richardlau
Copy link
Member

On the Jenkins CI we set CC and CXX with ccache and aren't seeing this.

e.g. https://ci.nodejs.org/job/node-test-commit-osx/42467/nodes=osx11-x64/consoleFull

08:00:31 + export 'CC=/usr/local/bin/ccache cc'
08:00:31 + CC='/usr/local/bin/ccache cc'
08:00:31 + export 'CXX=/usr/local/bin/ccache c++'
08:00:31 + CXX='/usr/local/bin/ccache c++'
08:00:31 ++ getconf _NPROCESSORS_ONLN
08:00:31 + export JOBS=4
08:00:31 + JOBS=4
08:00:31 + NODE_TEST_DIR=/Users/iojs/node-tmp
08:00:31 + FLAKY_TESTS=dontcare
08:00:31 + make run-ci -j 4
08:00:32 python3 ./configure --verbose 
08:00:39 Node.js configure: Found Python 3.9.7...
08:00:39 Detected clang C++ compiler (CXX=/usr/local/bin/ccache c++) version: 13.0.0
08:00:39 Detected clang C compiler (CC=/usr/local/bin/ccache cc) version: 13.0.0
08:00:39 creating icu_config.gypi
...

@GeoffreyBooth

This comment has been minimized.

@Trott
Copy link
Member

Trott commented Oct 21, 2021

Here's the relevant code in configure.py:

node/configure.py

Lines 1444 to 1455 in f233cb2

# supported asm compiler for AVX2. See https://github.com/openssl/openssl/
# blob/OpenSSL_1_1_0-stable/crypto/modes/asm/aesni-gcm-x86_64.pl#L52-L69
openssl110_asm_supported = \
('gas_version' in variables and StrictVersion(variables['gas_version']) >= StrictVersion('2.23')) or \
('xcode_version' in variables and StrictVersion(variables['xcode_version']) >= StrictVersion('5.0')) or \
('llvm_version' in variables and StrictVersion(variables['llvm_version']) >= StrictVersion('3.3')) or \
('nasm_version' in variables and StrictVersion(variables['nasm_version']) >= StrictVersion('2.10'))
if is_x86 and not openssl110_asm_supported:
error('''Did not find a new enough assembler, install one or build with
--openssl-no-asm.
Please refer to BUILDING.md''')

What's the output when you run egrep 'gas_version|xcode_version|llvm_version|nasm_version' config.gypi?

(EDIT: I get llvm_version 12.0 and xcode_version 12.0.)

(EDIT 2: I guess you could just run grep _version config.gypi There aren't that many resulting lines.)

@Trott
Copy link
Member

Trott commented Oct 21, 2021

I've replicated this issue. 👀

@Trott
Copy link
Member

Trott commented Oct 21, 2021

Using export CXX="ccache c++" and export CC="ccache cc" fixes it.

@Trott
Copy link
Member

Trott commented Oct 21, 2021

Using export CXX="ccache c++" and export CC="ccache cc" fixes it.

Line 32 of configure.py indicates that MacOS should use cc and everywhere else should use gcc.

Trott added a commit to Trott/io.js that referenced this issue Oct 21, 2021
macOS requires `cc` and `c++` rather than `gcc` and `g++`.

Closes: nodejs#40542
Trott added a commit to Trott/io.js that referenced this issue Oct 21, 2021
macOS requires `cc` and `c++` rather than `gcc` and `g++`.

Closes: nodejs#40542
Trott added a commit to Trott/io.js that referenced this issue Oct 21, 2021
macOS requires `cc` and `c++` rather than `gcc` and `g++`.

Closes: nodejs#40542
Trott added a commit to Trott/io.js that referenced this issue Oct 24, 2021
macOS requires `cc` and `c++` rather than `gcc` and `g++`.

Closes: nodejs#40542
Trott added a commit to Trott/io.js that referenced this issue Oct 24, 2021
`ccache` has reasonable defaults for `max_size` and `cache_dir` so
remove instructions to set those things explicitly.

Change fenced code from `console` to `bash` for easier copy/paste.

PR-URL: nodejs#40550
Fixes: nodejs#40542
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@Trott Trott closed this as completed in edd716b Oct 24, 2021
targos pushed a commit that referenced this issue Nov 6, 2021
macOS requires `cc` and `c++` rather than `gcc` and `g++`.

Closes: #40542

PR-URL: #40550
Fixes: #40542
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this issue Nov 6, 2021
`ccache` has reasonable defaults for `max_size` and `cache_dir` so
remove instructions to set those things explicitly.

Change fenced code from `console` to `bash` for easier copy/paste.

PR-URL: #40550
Fixes: #40542
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
BethGriggs pushed a commit that referenced this issue Nov 25, 2021
macOS requires `cc` and `c++` rather than `gcc` and `g++`.

Closes: #40542

PR-URL: #40550
Fixes: #40542
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
BethGriggs pushed a commit that referenced this issue Nov 25, 2021
`ccache` has reasonable defaults for `max_size` and `cache_dir` so
remove instructions to set those things explicitly.

Change fenced code from `console` to `bash` for easier copy/paste.

PR-URL: #40550
Fixes: #40542
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants