RFR: 8264650: Cross-compilation to macos/aarch64

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8264650: Cross-compilation to macos/aarch64

Anton Kozlov-2
Please review adding necessary flags for cross-compilation on macos/x86 targeting macos/aarch64.

All CFLAGS, CXXFLAGS, LDFLAGS need target CPU flag `-arch arm64`.
This patch adds the flag along e.g `-m64`.

Tested:
* cross-compilation on macos/x86 to macos/aarch64: configure --openjdk-target=aarch64-apple-darwin
* native compilation on macos/aarch64
* native compilation on macos/x86

-------------

Commit messages:
 - Append the flag
 - macos/aarch64 flags for cross compilation

Changes: https://git.openjdk.java.net/jdk/pull/3325/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3325&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264650
  Stats: 5 lines in 1 file changed: 5 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3325.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3325/head:pull/3325

PR: https://git.openjdk.java.net/jdk/pull/3325
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264650: Cross-compilation to macos/aarch64

Erik Joelsson-2
On Fri, 2 Apr 2021 13:28:31 GMT, Anton Kozlov <[hidden email]> wrote:

> Please review adding necessary flags for cross-compilation on macos/x86 targeting macos/aarch64.
>
> All CFLAGS, CXXFLAGS, LDFLAGS need target CPU flag `-arch arm64`.
> This patch adds the flag along e.g `-m64`.
>
> Tested:
> * cross-compilation on macos/x86 to macos/aarch64: configure --openjdk-target=aarch64-apple-darwin
> * native compilation on macos/aarch64
> * native compilation on macos/x86

make/autoconf/flags.m4 line 269:

> 267:
> 268:   if test "x$OPENJDK_TARGET_OS" = xmacosx &&
> 269:       test "x$OPENJDK_TARGET_CPU" = xaarch64; then

Thank you for getting on this!
For symmetry, and to enable cross compilation on both directions, can we add the necessary flag for x64 too?

Also, I doubt it matters much, but we could also only set these flags if COMPILE_TYPE=cross.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3325
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264650: Cross-compilation to macos/aarch64

Erik Joelsson-2
On Fri, 2 Apr 2021 16:21:52 GMT, Erik Joelsson <[hidden email]> wrote:

>> Please review adding necessary flags for cross-compilation on macos/x86 targeting macos/aarch64.
>>
>> All CFLAGS, CXXFLAGS, LDFLAGS need target CPU flag `-arch arm64`.
>> This patch adds the flag along e.g `-m64`.
>>
>> Tested:
>> * cross-compilation on macos/x86 to macos/aarch64: configure --openjdk-target=aarch64-apple-darwin
>> * native compilation on macos/aarch64
>> * native compilation on macos/x86
>
> make/autoconf/flags.m4 line 269:
>
>> 267:
>> 268:   if test "x$OPENJDK_TARGET_OS" = xmacosx &&
>> 269:       test "x$OPENJDK_TARGET_CPU" = xaarch64; then
>
> Thank you for getting on this!
> For symmetry, and to enable cross compilation on both directions, can we add the necessary flag for x64 too?
>
> Also, I doubt it matters much, but we could also only set these flags if COMPILE_TYPE=cross.

Thinking again, it doesn't hurt to be explicit about this. Better always set these flags to avoid surprises.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3325
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264650: Cross-compilation to macos/aarch64 [v2]

Anton Kozlov-2
In reply to this post by Anton Kozlov-2
> Please review adding necessary flags for cross-compilation on macos/x86 targeting macos/aarch64.
>
> All CFLAGS, CXXFLAGS, LDFLAGS need target CPU flag `-arch arm64`.
> This patch adds the flag along e.g `-m64`.
>
> Tested:
> * cross-compilation
>   * macos/x86 -> macos/aarch64: configure --openjdk-target=aarch64-apple-darwin
>   * macos/aarch64 -> macos/x86: configure --openjdk-target=x86_64-apple-darwin
> * native compilation:
>   * macos/aarch64
>   * macos/x86

Anton Kozlov has updated the pull request incrementally with one additional commit since the last revision:

  Add both ways cross-compilation

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3325/files
  - new: https://git.openjdk.java.net/jdk/pull/3325/files/3938a473..df62dd07

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3325&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3325&range=00-01

  Stats: 6 lines in 1 file changed: 3 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3325.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3325/head:pull/3325

PR: https://git.openjdk.java.net/jdk/pull/3325
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264650: Cross-compilation to macos/aarch64 [v2]

Anton Kozlov-2
In reply to this post by Erik Joelsson-2
On Fri, 2 Apr 2021 16:23:05 GMT, Erik Joelsson <[hidden email]> wrote:

>> make/autoconf/flags.m4 line 269:
>>
>>> 267:
>>> 268:   if test "x$OPENJDK_TARGET_OS" = xmacosx &&
>>> 269:       test "x$OPENJDK_TARGET_CPU" = xaarch64; then
>>
>> Thank you for getting on this!
>> For symmetry, and to enable cross compilation on both directions, can we add the necessary flag for x64 too?
>>
>> Also, I doubt it matters much, but we could also only set these flags if COMPILE_TYPE=cross.
>
> Thinking again, it doesn't hurt to be explicit about this. Better always set these flags to avoid surprises.

Cool, I haven't thought it is possible, although clearly it should be :) Thanks! Fixed by always setting the flag. I also rely on Github Action to check this with Xcode 11.3.1, it seems to be fine https://github.com/AntonKozlov/jdk/runs/2256008843

-------------

PR: https://git.openjdk.java.net/jdk/pull/3325
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8264650: Cross-compilation to macos/aarch64 [v2]

Erik Joelsson-2
In reply to this post by Anton Kozlov-2
On Fri, 2 Apr 2021 19:18:58 GMT, Anton Kozlov <[hidden email]> wrote:

>> Please review adding necessary flags for cross-compilation on macos/x86 targeting macos/aarch64.
>>
>> All CFLAGS, CXXFLAGS, LDFLAGS need target CPU flag `-arch arm64`.
>> This patch adds the flag along e.g `-m64`.
>>
>> Tested:
>> * cross-compilation
>>   * macos/x86 -> macos/aarch64: configure --openjdk-target=aarch64-apple-darwin
>>   * macos/aarch64 -> macos/x86: configure --openjdk-target=x86_64-apple-darwin
>> * native compilation:
>>   * macos/aarch64
>>   * macos/x86
>
> Anton Kozlov has updated the pull request incrementally with one additional commit since the last revision:
>
>   Add both ways cross-compilation

Marked as reviewed by erikj (Reviewer).

-------------

PR: https://git.openjdk.java.net/jdk/pull/3325
Reply | Threaded
Open this post in threaded view
|

Integrated: 8264650: Cross-compilation to macos/aarch64

Anton Kozlov-2
In reply to this post by Anton Kozlov-2
On Fri, 2 Apr 2021 13:28:31 GMT, Anton Kozlov <[hidden email]> wrote:

> Please review adding necessary flags for cross-compilation on macos/x86 targeting macos/aarch64.
>
> All CFLAGS, CXXFLAGS, LDFLAGS need target CPU flag `-arch arm64`.
> This patch adds the flag along e.g `-m64`.
>
> Tested:
> * cross-compilation
>   * macos/x86 -> macos/aarch64: configure --openjdk-target=aarch64-apple-darwin
>   * macos/aarch64 -> macos/x86: configure --openjdk-target=x86_64-apple-darwin
> * native compilation:
>   * macos/aarch64
>   * macos/x86

This pull request has now been integrated.

Changeset: 7f9ece23
Author:    Anton Kozlov <[hidden email]>
Committer: Vladimir Kempik <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/7f9ece23
Stats:     8 lines in 1 file changed: 8 ins; 0 del; 0 mod

8264650: Cross-compilation to macos/aarch64

Reviewed-by: erikj

-------------

PR: https://git.openjdk.java.net/jdk/pull/3325