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

Cannot build 4.3.2 on OS X 10.8.5 #5550

Closed
richardlau opened this issue Mar 3, 2016 · 18 comments
Closed

Cannot build 4.3.2 on OS X 10.8.5 #5550

richardlau opened this issue Mar 3, 2016 · 18 comments
Labels
build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX. openssl Issues and PRs related to the OpenSSL dependency.

Comments

@richardlau
Copy link
Member

  • Version: v4.3.2
  • Platform: Darwin fama.ottawa.ibm.com 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
  • Subsystem: deps/openssl

Getting compilation errors on OS X 10.8.5 with v4.3.2 (previous versions, e.g. v4.3.1, built successfully on the same system) that must be related to the OpenSSL update (since that's the only thing that changed):

  gcc '-DPURIFY' '-D_REENTRANT' '-DOPENSSL_NO_SSL2' '-DOPENSSL_NO_SSL3' '-DOPENSSL_NO_HEARTBEATS' '-DENGINESDIR="/dev/null"' '-DTERMIOS' '-DOPENSSLDIR="/System/Library/OpenSSL/"' '-D_DARWIN_USE_64_BIT_INODE=1' '-DL_ENDIAN' '-DAES_ASM' '-DCPUID_ASM' '-DOPENSSL_BN_ASM_MONT' '-DOPENSSL_CPUID_OBJ' '-DSHA1_ASM' '-DSHA256_ASM' '-DSHA512_ASM' '-DGHASH_ASM' '-DVPAES_ASM' '-DBN_ASM' '-DBF_ASM' '-DBNCO_ASM' '-DDES_ASM' '-DLIB_BN_ASM' '-DMD5_ASM' '-DOPENSSL_BN_ASM' '-DRIP_ASM' '-DRMD160_ASM' '-DWHIRLPOOL_ASM' '-DWP_ASM' '-DOPENSSL_BN_ASM_MONT5' '-DOPENSSL_BN_ASM_GF2m' '-DOPENSSL_IA32_SSE2' '-DBSAES_ASM' '-DDSO_DLFCN' '-DHAVE_DLFCN_H' -I../deps/openssl -I../deps/openssl/openssl -I../deps/openssl/openssl/crypto -I../deps/openssl/openssl/crypto/asn1 -I../deps/openssl/openssl/crypto/evp -I../deps/openssl/openssl/crypto/md2 -I../deps/openssl/openssl/crypto/modes -I../deps/openssl/openssl/crypto/store -I../deps/openssl/openssl/include  -Os -gdwarf-2 -mmacosx-version-min=10.5 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -fno-strict-aliasing -MMD -MF /home/users/riclau/sandbox/github/node/out/Release/.deps//home/users/riclau/sandbox/github/node/out/Release/obj.target/openssl/deps/openssl/asm_obsolete/x64-macosx-gas/aes/vpaes-x86_64.o.d.raw  -c -o /home/users/riclau/sandbox/github/node/out/Release/obj.target/openssl/deps/openssl/asm_obsolete/x64-macosx-gas/aes/vpaes-x86_64.o ../deps/openssl/asm_obsolete/x64-macosx-gas/aes/vpaes-x86_64.s
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3465:missing or invalid immediate expression `0b00010000' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3465:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3467:missing or invalid immediate expression `0b10001100' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3467:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3469:missing or invalid immediate expression `0b11111111' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3469:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3480:missing or invalid immediate expression `0b00010000' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3480:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3483:missing or invalid immediate expression `0b10001100' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3483:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3486:missing or invalid immediate expression `0b01010101' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3486:suffix or operands invalid for `pshufd'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3489:missing or invalid immediate expression `0b11111111' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3489:suffix or operands invalid for `pshufd'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3496:missing or invalid immediate expression `0b01000100' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3496:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3498:missing or invalid immediate expression `0b01001110' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3498:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3508:missing or invalid immediate expression `0b00010000' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3508:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3510:missing or invalid immediate expression `0b10001100' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3510:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3512:missing or invalid immediate expression `0b11111111' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3512:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3521:missing or invalid immediate expression `0b00010000' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3521:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3523:missing or invalid immediate expression `0b10001100' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3523:suffix or operands invalid for `shufps'
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3525:missing or invalid immediate expression `0b10101010' taken as 0
../deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.s:3525:suffix or operands invalid for `shufps'
make[2]: *** [/home/users/riclau/sandbox/github/node/out/Release/obj.target/openssl/deps/openssl/asm_obsolete/x64-macosx-gas/aes/aesni-x86_64.o] Error 1

gist of complete build log

@richardlau
Copy link
Member Author

Not seeing the errors on a second system running OS X 10.10.1.

@mscdex mscdex added build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX. openssl Issues and PRs related to the OpenSSL dependency. labels Mar 3, 2016
@mscdex
Copy link
Contributor

mscdex commented Mar 3, 2016

Out of curiosity, what does gcc -v show?

@richardlau
Copy link
Member Author

On our 10.8.5 system (fails):

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
$

on 10.10.1 (passes):

$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
$

@stefanmb
Copy link
Contributor

stefanmb commented Mar 3, 2016

@richardlau Also pointed out this may be an upstream issue, see https://www.mail-archive.com/openssl-dev%40openssl.org/msg43040.html

@mscdex
Copy link
Contributor

mscdex commented Mar 3, 2016

If that's real gcc, I believe you need to use gcc 4.8.x or newer (in general).

@bnoordhuis
Copy link
Member

Works for me on 10.8.5 with this:

$ c++ -v
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.6.0
Thread model: posix

@richardlau
Copy link
Member Author

For comparison (our 10.8.5):

$ c++ -v
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

@MylesBorins
Copy link
Contributor

@bnoordhuis what is gcc -v outputting out your system?

From the openssl thread it looks like there is an alternative patch that someone tested that is building, so we at least have confirmation that this is happening in the wild

@bnoordhuis
Copy link
Member

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~148/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~148/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

@stefanmb
Copy link
Contributor

stefanmb commented Mar 3, 2016

Applying the patch suggested on the OpenSSL mailing list appears to resolve the issue https://github.com/openssl/openssl/pull/597/files.

Here are some examples of assembler (asm_obsolete) generated before and after the patch.

Before:

.p2align    4
L$key_expansion_128:
    movups  %xmm0,(%rax)
    leaq    16(%rax),%rax
L$key_expansion_128_cold:
    shufps  $0b00010000,%xmm0,%xmm4
    xorps   %xmm4,%xmm0
    shufps  $0b10001100,%xmm0,%xmm4
    xorps   %xmm4,%xmm0
    shufps  $0b11111111,%xmm1,%xmm1
    xorps   %xmm1,%xmm0
    .byte   0xf3,0xc3

After:

.p2align    4
L$key_expansion_128:
    movups  %xmm0,(%rax)
    leaq    16(%rax),%rax
L$key_expansion_128_cold:
    shufps  $16,%xmm0,%xmm4
    xorps   %xmm4,%xmm0
    shufps  $140,%xmm0,%xmm4
    xorps   %xmm4,%xmm0
    shufps  $255,%xmm1,%xmm1
    xorps   %xmm1,%xmm0
    .byte   0xf3,0xc3

Regenerating the asm folder shows similar issues but in fewer places, but I really don't understand why @bnoordhuis is not seeing this issue, the build system decides to use asm or asm_obsolete based on: https://github.com/nodejs/node/blob/master/deps/openssl/openssl.gypi#L1043 so he should also be falling back to asm_obsolete folder. @bnoordhuis does your machine compile the assembler from the asm or asm_obsolete folders?

In fact, the checks done in https://github.com/nodejs/node/blob/master/configure#L442:L463 appear to fail completely on the latest OS X because the banner of clang has changed:

Stefan@Stefans-MacBook-Pro:~$ sw_vers -productVersion
10.11.3
Stefan@Stefans-MacBook-Pro:~$ cc -v
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix

Therefore my machine fails to use the higher performance code path despite having support for AVX2.

@MylesBorins
Copy link
Contributor

@stefanmb would you be willing to send a PR to fix the ./configure to work on the latest OSX?

@stefanmb
Copy link
Contributor

stefanmb commented Mar 3, 2016

@thealphanerd Sure, as soon as I figure out how to interpret the newer version numbers. :)

Based on https://en.wikipedia.org/wiki/Xcode#Version_comparison_table everything after clang-500.2.75 should be okay.

@bnoordhuis
Copy link
Member

does your machine compile the assembler from the asm or asm_obsolete folders?

asm_obsolete. I noticed it uses cc and not gcc like it seems to do on @richardlau's machine. For me, cc -v prints:

$ cc -v
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.6.0
Thread model: posix

@stefanmb
Copy link
Contributor

stefanmb commented Mar 3, 2016

@bnoordhuis I have access to @richardlau's machine and that's what I used to test the fix. Now, looking at that assembler, it's obvious those immediates have the same values but in different bases, I wonder if certain versions of the toolchain can understand binary as well as base10.

@stefanmb
Copy link
Contributor

stefanmb commented Mar 3, 2016

@thealphanerd As requested, I've fixed the clang detection for OS X: #5553

@stefanmb
Copy link
Contributor

stefanmb commented Mar 3, 2016

@bnoordhuis Running the offending line with cc (or c++) works, gcc does not!

@stefanmb
Copy link
Contributor

stefanmb commented Mar 3, 2016

@richardlau @bnoordhuis So I can confirm by removing "export CC=gcc" from the build scripts (ours, not Node's) everything is resolved. This problem may break others, but I'm not sure if there is anything else to do at this point other than keep a record of the problem. Thanks for the help!

@richardlau
Copy link
Member Author

Thanks @stefanmb

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. macos Issues and PRs related to the macOS platform / OSX. openssl Issues and PRs related to the OpenSSL dependency.
Projects
None yet
Development

No branches or pull requests

5 participants