Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Jul 5, 2021

On master (c609e10) make -C depends qt on Apple Silicon based macOS 11.4 ends with an error:

/bin/sh: /Users/hebasto/bitcoin/depends/work/build/aarch64-apple-darwin20.5.0/qt/5.12.11-6c4d47a8f8f/qtbase/bin/moc: Bad CPU type in executable

Installing Rosetta 2 fixes it.

Explanation. On Apple Silicon macOS the qt package in depends actually is cross compiled. All native tools (including moc) are x86_64 binaries, that require Rosetta 2 to run.

@hebasto
Copy link
Member Author

hebasto commented Jul 5, 2021

cc @promag @fanquake @jarolrod

@fanquake fanquake added the Docs label Jul 5, 2021
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

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

ACK cdb41d5.

@sipa sipa closed this Jul 6, 2021
@sipa sipa deleted the 210705-rosetta branch July 6, 2021 05:28
@maflcko maflcko restored the 210705-rosetta branch July 6, 2021 05:59
@maflcko maflcko reopened this Jul 6, 2021
@maflcko
Copy link
Member

maflcko commented Jul 6, 2021

branch can be deleted after close or merge

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK cdb41d5 - I have not tested after installing Rosetta 2, but I saw the same issue during my first cross-compile on an M1 box.

Copy link
Contributor

@Zero-1729 Zero-1729 left a comment

Choose a reason for hiding this comment

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

ACK cdb41d5

I had the same issue on an initial compile on the M1, glad to see this make it to the docs.

@fanquake fanquake merged commit 4129134 into master Jul 7, 2021
@maflcko
Copy link
Member

maflcko commented Jul 7, 2021

The branch https://github.com/bitcoin/bitcoin/tree/210705-rosetta can now be deleted

@laanwj laanwj deleted the 210705-rosetta branch July 7, 2021 13:53
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 10, 2021
cdb41d5 doc: Install Rosetta on M1-macOS for qt in depends (Hennadii Stepanov)

Pull request description:

  On master (c609e10) `make -C depends qt` on Apple Silicon based macOS 11.4 ends with an error:
  ```
  /bin/sh: /Users/hebasto/bitcoin/depends/work/build/aarch64-apple-darwin20.5.0/qt/5.12.11-6c4d47a8f8f/qtbase/bin/moc: Bad CPU type in executable
  ```

  Installing Rosetta 2 fixes it.

  Explanation. On Apple Silicon macOS the `qt` package in depends actually is cross compiled. All native tools (including `moc`) are x86_64 binaries, that require Rosetta 2 to run.

ACKs for top commit:
  promag:
    ACK cdb41d5.
  fanquake:
    ACK cdb41d5 - I have not tested after installing Rosetta 2, but I saw the same issue during my first cross-compile on an M1 box.
  Zero-1729:
    ACK cdb41d5

Tree-SHA512: fb06a32d6fb40f405ce856b44f5d3af0c51089886f3be79e509e5c325614d7af58ce4480c064c17e0efb695a1f69f68d533c417f9631d46d8a630aba60ce4433
fanquake added a commit that referenced this pull request Nov 25, 2021
…en using qmake

d020419 Revert "doc: Install Rosetta on M1-macOS for qt in depends" (Hennadii Stepanov)
f6e2781 build, qt, macOS: Don't pass -device-option when building natively (Hennadii Stepanov)
667f068 build, qt, macOS: Don't hard-code x86_64 as the arch when using qmake (Hennadii Stepanov)

Pull request description:

  On master (4018e23) the Qt build system hard-coded the x86_64 as the architecture when using qmake.

  This means that compiling the `qt` package on M1 Apple Silicon for the same system, i.e., without providing the `HOST` variable,—that is supposed to be compiled natively—is a cross-compiling actually:
  ```
  % make -C depends qt_configured
  ...
  Configure summary:

  Building on: macx-clang (x86_64, CPU features: cx16 mmx sse sse2 sse3 ssse3 sse4.1)
  Building for: macx-clang (arm64, CPU features: neon crc32)
  Target compiler: clang (Apple) 13.0.0
  Configuration: cross_compile largefile neon precompile_header silent release c++11 c++14 c++1z reduce_exports static stl
  ...
  ```

  Also this bug caused another [issue](#22402) which currently is worked around by installing Rosetta.

  With this PR it is no longer needed to have Rosetta installed on M1-based macOS, and:
  ```
  % make -C depends qt_configured
  ...
  Configure summary:

  Build type: macx-clang (arm64, CPU features: neon crc32)
  Compiler: clang (Apple) 13.0.0
  Configuration: largefile neon precompile_header silent release c++11 c++14 c++1z reduce_exports static stl
  ...
  ```

ACKs for top commit:
  promag:
    Tested ACK d020419
  fanquake:
    ACK d020419

Tree-SHA512: 2fcd88d172286b7d22ec7ea7ce0939b012211c0160df56de2f4cb69e99743c71df6b6ff4777c1722ec22b974f48a77cc22e7c14d7d64d02c4f82ac22bafe4087
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Nov 25, 2021
…arch when using qmake

d020419 Revert "doc: Install Rosetta on M1-macOS for qt in depends" (Hennadii Stepanov)
f6e2781 build, qt, macOS: Don't pass -device-option when building natively (Hennadii Stepanov)
667f068 build, qt, macOS: Don't hard-code x86_64 as the arch when using qmake (Hennadii Stepanov)

Pull request description:

  On master (4018e23) the Qt build system hard-coded the x86_64 as the architecture when using qmake.

  This means that compiling the `qt` package on M1 Apple Silicon for the same system, i.e., without providing the `HOST` variable,—that is supposed to be compiled natively—is a cross-compiling actually:
  ```
  % make -C depends qt_configured
  ...
  Configure summary:

  Building on: macx-clang (x86_64, CPU features: cx16 mmx sse sse2 sse3 ssse3 sse4.1)
  Building for: macx-clang (arm64, CPU features: neon crc32)
  Target compiler: clang (Apple) 13.0.0
  Configuration: cross_compile largefile neon precompile_header silent release c++11 c++14 c++1z reduce_exports static stl
  ...
  ```

  Also this bug caused another [issue](bitcoin#22402) which currently is worked around by installing Rosetta.

  With this PR it is no longer needed to have Rosetta installed on M1-based macOS, and:
  ```
  % make -C depends qt_configured
  ...
  Configure summary:

  Build type: macx-clang (arm64, CPU features: neon crc32)
  Compiler: clang (Apple) 13.0.0
  Configuration: largefile neon precompile_header silent release c++11 c++14 c++1z reduce_exports static stl
  ...
  ```

ACKs for top commit:
  promag:
    Tested ACK d020419
  fanquake:
    ACK d020419

Tree-SHA512: 2fcd88d172286b7d22ec7ea7ce0939b012211c0160df56de2f4cb69e99743c71df6b6ff4777c1722ec22b974f48a77cc22e7c14d7d64d02c4f82ac22bafe4087
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants