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: set DESTCPU correctly for 'make binary' on Apple Silicon #40147

Closed
wants to merge 1 commit into from

Conversation

cheister
Copy link
Contributor

When running make binary -j8 on an Apple Silicon M1 it looks like the DESTCPU is not set correctly in the Makefile so you get the following error when building openssl

> make binary -j8
...
/opt/homebrew/opt/python@3.9/bin/python3.9 ./configure \
		--prefix=/ \
		--dest-cpu=arm \
		--tag= \
		--release-urlbase= \
		 --download=all --with-intl=full-icu

...

  cc -o /Users/cheister/Development/node/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/bn/bn_add.o ../deps/openssl/openssl/crypto/bn/bn_add.c '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DOPENSSL_NO_HW' '-DNDEBUG' '-DOPENSSL_USE_NODELETE' '-DL_ENDIAN' '-DOPENSSL_PIC' '-DOPENSSL_CPUID_OBJ' '-DOPENSSL_IA32_SSE2' '-DOPENSSL_BN_ASM_MONT' '-DOPENSSL_BN_ASM_MONT5' '-DOPENSSL_BN_ASM_GF2m' '-DSHA1_ASM' '-DSHA256_ASM' '-DSHA512_ASM' '-DKECCAK1600_ASM' '-DRC4_ASM' '-DMD5_ASM' '-DAESNI_ASM' '-DVPAES_ASM' '-DGHASH_ASM' '-DECP_NISTZ256_ASM' '-DX25519_ASM' '-DPOLY1305_ASM' '-DOPENSSLDIR="/System/Library/OpenSSL/"' '-DENGINESDIR="/dev/null"' -I../deps/openssl/openssl -I../deps/openssl/openssl/include -I../deps/openssl/openssl/crypto -I../deps/openssl/openssl/crypto/include -I../deps/openssl/openssl/crypto/modes -I../deps/openssl/openssl/crypto/ec/curve448 -I../deps/openssl/openssl/crypto/ec/curve448/arch_32 -I../deps/openssl/config -I../deps/openssl/config/archs/linux-x86_64/asm_avx2 -I../deps/openssl/config/archs/linux-x86_64/asm_avx2/include -I../deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto -I../deps/openssl/config/archs/linux-x86_64/asm_avx2/crypto/include/internal  -O3 -gdwarf-2 -mmacosx-version-min=10.13 -Wall -Wendif-labels -W -Wno-unused-parameter -Wno-missing-field-initializers -fno-strict-aliasing -MMD -MF /Users/cheister/Development/node/out/Release/.deps//Users/cheister/Development/node/out/Release/obj.target/openssl/deps/openssl/openssl/crypto/bn/bn_add.o.d.raw   -c
../deps/openssl/openssl/crypto/bn/asm/x86_64-gcc.c:120:9: error: invalid output constraint '=a' in asm
        mul_add(rp[0], ap[0], w, c1);
        ^
../deps/openssl/openssl/crypto/bn/asm/x86_64-gcc.c:78:19: note: expanded from macro 'mul_add'
                : "=a"(low),"=d"(high)  \
                  ^
../deps/openssl/openssl/crypto/bn/asm/x86_64-gcc.c:120:9: error: invalid output constraint '+d' in asm
../deps/openssl/openssl/crypto/bn/asm/x86_64-gcc.c:82:31: note: expanded from macro 'mul_add'
                : "+r"(carry),"+d"(high)\
                              ^
../deps/openssl/openssl/crypto/bn/asm/x86_64-gcc.c:120:9: error: invalid output constraint '+d' in asm
../deps/openssl/openssl/crypto/bn/asm/x86_64-gcc.c:86:27: note: expanded from macro 'mul_add'
                : "+m"(r),"+d"(high)    \
                          ^
../deps/openssl/openssl/crypto/bn/asm/x86_64-gcc.c:121:9: error: invalid output constraint '=a' in asm
        mul_add(rp[1], ap[1], w, c1);

On the M1 I get arm64 for uname -m . This PR sets the DESTCPU to arm64 and everything builds fine after that.

@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 18, 2021
@cheister cheister changed the title Set DESTCPU correctly on Apple Silicon so 'make binary' builds build: set DESTCPU correctly for 'make binary' on Apple Silicon Sep 18, 2021
Makefile Show resolved Hide resolved
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

@targos targos added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Sep 26, 2021
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Sep 26, 2021
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@richardlau richardlau added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 29, 2021
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 29, 2021
@github-actions
Copy link
Contributor

Landed in 88b497a...5607de8

@github-actions github-actions bot closed this Sep 29, 2021
nodejs-github-bot pushed a commit that referenced this pull request Sep 29, 2021
PR-URL: #40147
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
targos pushed a commit that referenced this pull request Oct 4, 2021
PR-URL: #40147
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
evanlucas pushed a commit to evanlucas/node that referenced this pull request Feb 5, 2022
PR-URL: nodejs#40147
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
evanlucas pushed a commit to evanlucas/node that referenced this pull request Feb 5, 2022
PR-URL: nodejs#40147
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Backport-PR-URL: nodejs#41855
evanlucas pushed a commit to evanlucas/node that referenced this pull request Apr 15, 2022
PR-URL: nodejs#40147
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Backport-PR-URL: nodejs#41855
juanarbol pushed a commit that referenced this pull request May 1, 2022
PR-URL: #40147
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Backport-PR-URL: #41855
@juanarbol juanarbol mentioned this pull request May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. 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.

8 participants