Re: RFR: 8250876: Build system preparation to macos on aarch64
> On Aug 13, 2020, at 6:54 AM, Magnus Ihse Bursie > wrote: > > On 2020-08-13 09:15, Kim Barrett wrote: >> I'm similarly surprised by this pre-existing bit in CoreLibraries.gmk: >> >> $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ >> ... >> LIBS_unix := -ljvm -ldl $(LIBCXX), \ >> LIBS_macosx := -lc++, \ >> >> And that suggests a better place for all this (assuming its needed at >> all) is in lib-std.m4, setting LIBCXX for macosx and using it where >> needed. > Yes, that looks weird. Probably some left-over from the initial integration > of libjimage. I can build fine locally without it; I'm just verifying that it > also works in the CI. Thank you for noticing this! I just filed https://bugs.openjdk.java.net/browse/JDK-8251533 for that.
Re: RFR: 8250876: Build system preparation to macos on aarch64
On 2020-08-13 09:15, Kim Barrett wrote: On Aug 1, 2020, at 3:24 AM, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch arm64’ JNF.framework is missing arm64 part as of next macos release, but Apple has opensourced it. Fix to adlc were needed due to it using symbols from stdc++ and not linking to it, so it fails when doing make images. The webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.00/ The bug: https://bugs.openjdk.java.net/browse/JDK-8250876 Testing: jdk/submit. Thanks, Vladimir. Coming late to the party, as I see this has already been pushed. But one thing caught my eye. -- 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ I'm surprised this is needed. I expected the C++ toolchain to implicitly include that, the way g++ does. If something like this really is needed, then it seems like it should be ADLC_LIBS that should be modified, rather than ADLC_LDFLAGS. Though I noticed there are currently no assignments to ADLC_LIBS. I'm similarly surprised by this pre-existing bit in CoreLibraries.gmk: $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ ... LIBS_unix := -ljvm -ldl $(LIBCXX), \ LIBS_macosx := -lc++, \ And that suggests a better place for all this (assuming its needed at all) is in lib-std.m4, setting LIBCXX for macosx and using it where needed. Yes, that looks weird. Probably some left-over from the initial integration of libjimage. I can build fine locally without it; I'm just verifying that it also works in the CI. Thank you for noticing this! /Magnus --
Re: RFR: 8250876: Build system preparation to macos on aarch64
> On Aug 13, 2020, at 3:15 AM, Kim Barrett wrote: > >> On Aug 1, 2020, at 3:24 AM, Vladimir Kempik wrote: >> >> Hello >> >> Please review this change for JDK-8250876 >> >> This changeset adds support for macos/aarch64 into build system. >> It will allow to crosscompile for macos/aarch64 using intel mac as well. >> >> This changeset does NOT address some arm specific issues in the macos >> related code, we plan to do that in s separate commit. >> >> An example of configure to cross-compile for macos/arm64: >> >> --with-boot-jdk=/path/to/java/ >> --with-build-jdk=/path/to/same/java/as/compiled >> --disable-warnings-as-errors --with-jvm-variants=zero >> --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' >> --with-extra-ldflags='-arch arm64 >> -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch >> arm64’ >> >> JNF.framework is missing arm64 part as of next macos release, but Apple has >> opensourced it. >> >> Fix to adlc were needed due to it using symbols from stdc++ and not linking >> to it, so it fails when doing make images. >> >> The webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.00/ >> The bug: https://bugs.openjdk.java.net/browse/JDK-8250876 >> >> Testing: jdk/submit. >> >> Thanks, Vladimir. > > Coming late to the party, as I see this has already been pushed. But > one thing caught my eye. I should have read further ahead in the thread. Looks like this got dealt with in a different way that seems much better. > > -- > 42 else ifeq ($(call isBuildOs, macosx), true) > 43 ADLC_LDFLAGS := -lc++ > > I'm surprised this is needed. I expected the C++ toolchain to > implicitly include that, the way g++ does. > > If something like this really is needed, then it seems like it should > be ADLC_LIBS that should be modified, rather than ADLC_LDFLAGS. > Though I noticed there are currently no assignments to ADLC_LIBS. > > I'm similarly surprised by this pre-existing bit in CoreLibraries.gmk: > > $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ > ... >LIBS_unix := -ljvm -ldl $(LIBCXX), \ >LIBS_macosx := -lc++, \ > > And that suggests a better place for all this (assuming its needed at > all) is in lib-std.m4, setting LIBCXX for macosx and using it where > needed. > > --
Re: RFR: 8250876: Build system preparation to macos on aarch64
> On Aug 1, 2020, at 3:24 AM, Vladimir Kempik wrote: > > Hello > > Please review this change for JDK-8250876 > > This changeset adds support for macos/aarch64 into build system. > It will allow to crosscompile for macos/aarch64 using intel mac as well. > > This changeset does NOT address some arm specific issues in the macos related > code, we plan to do that in s separate commit. > > An example of configure to cross-compile for macos/arm64: > > --with-boot-jdk=/path/to/java/ > --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors > --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin > --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 > -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch > arm64’ > > JNF.framework is missing arm64 part as of next macos release, but Apple has > opensourced it. > > Fix to adlc were needed due to it using symbols from stdc++ and not linking > to it, so it fails when doing make images. > > The webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.00/ > The bug: https://bugs.openjdk.java.net/browse/JDK-8250876 > > Testing: jdk/submit. > > Thanks, Vladimir. Coming late to the party, as I see this has already been pushed. But one thing caught my eye. -- 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ I'm surprised this is needed. I expected the C++ toolchain to implicitly include that, the way g++ does. If something like this really is needed, then it seems like it should be ADLC_LIBS that should be modified, rather than ADLC_LDFLAGS. Though I noticed there are currently no assignments to ADLC_LIBS. I'm similarly surprised by this pre-existing bit in CoreLibraries.gmk: $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \ ... LIBS_unix := -ljvm -ldl $(LIBCXX), \ LIBS_macosx := -lc++, \ And that suggests a better place for all this (assuming its needed at all) is in lib-std.m4, setting LIBCXX for macosx and using it where needed. --
Re: RFR: 8250876: Build system preparation to macos on aarch64
Looks good. /Erik On 2020-08-10 07:14, Vladimir Kempik wrote: Hello Please check the updated webrev - http://cr.openjdk.java.net/~vkempik/8250876/webrev.02/ Thanks, Vladimir 10 авг. 2020 г., в 16:11, Erik Joelsson написал(а): On 2020-08-10 03:47, Vladimir Kempik wrote: Hello Renamed the bug to "Fix issues with cross-compile on macos" Please check updated webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/ Adlc is fine with cross-compiling now. While not strictly needed for ADLC, I would like to see BUILD_CC getting the same treatment here for consistency. /Erik Regards, Vladimir 10 авг. 2020 г., в 12:52, Magnus Ihse Bursie написал(а): So, basically, what this patch is about is not so much "preparation for aarch64" as "allow cross-compile on macos"? If I understand you correctly, maybe you should rename the bug? /Magnus On 2020-08-04 16:09, Erik Joelsson wrote: That's a good find! You are correct in that we haven't cross compiled in any direction involving Macosx before. The preferred patch would be a bit more elaborate than that. Ideally we need better control over the toolchain type of the BUILD_* compiler settings. For now, I think just forcing clang/clang++ if BUILD_OS is macosx is good enough. /Erik On 2020-08-04 07:02, Bernhard Urban-Forster wrote: Good observation David, the change in adlc is just fixing a symptom. The difference to a regular macOS build is that technically, despite running on the same machine, it's actually cross compiling due to Rosetta being the --build=x86_64 system. Being a cross-compile, we therefore hit this case: https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 And thus infers `/usr/bin/CC` for CXX. I guess cross compiling hasn't been a thing on macOS yet. I tried the following and it passes the adlc build: --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], # find the build compilers in the tools dir, if needed. UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) UTIL_FIXUP_EXECUTABLE(BUILD_CC) -UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) +UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) UTIL_FIXUP_EXECUTABLE(BUILD_CXX) UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) UTIL_FIXUP_EXECUTABLE(BUILD_NM) Although I'm not sure about its cleanliness :-) -Bernhard From: build-dev on behalf of David Holmes Sent: Tuesday, August 4, 2020 00:46 To: Erik Joelsson; Vladimir Kempik; build-dev Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 On 3/08/2020 10:57 pm, Erik Joelsson wrote: Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with
Re: RFR: 8250876: Build system preparation to macos on aarch64
Hello Please check the updated webrev - http://cr.openjdk.java.net/~vkempik/8250876/webrev.02/ Thanks, Vladimir > 10 авг. 2020 г., в 16:11, Erik Joelsson написал(а): > > On 2020-08-10 03:47, Vladimir Kempik wrote: >> Hello >> >> Renamed the bug to "Fix issues with cross-compile on macos" >> >> Please check updated webrev: >> http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/ >> >> Adlc is fine with cross-compiling now. >> > While not strictly needed for ADLC, I would like to see BUILD_CC getting the > same treatment here for consistency. > > /Erik > >> Regards, Vladimir >>> 10 авг. 2020 г., в 12:52, Magnus Ihse Bursie >>> написал(а): >>> >>> So, basically, what this patch is about is not so much "preparation for >>> aarch64" as "allow cross-compile on macos"? If I understand you correctly, >>> maybe you should rename the bug? >>> >>> /Magnus >>> >>> On 2020-08-04 16:09, Erik Joelsson wrote: >>>> That's a good find! You are correct in that we haven't cross compiled in >>>> any direction involving Macosx before. >>>> >>>> The preferred patch would be a bit more elaborate than that. Ideally we >>>> need better control over the toolchain type of the BUILD_* compiler >>>> settings. For now, I think just forcing clang/clang++ if BUILD_OS is >>>> macosx is good enough. >>>> >>>> /Erik >>>> >>>> On 2020-08-04 07:02, Bernhard Urban-Forster wrote: >>>>> Good observation David, the change in adlc is just fixing a symptom. The >>>>> difference to a regular macOS build is that technically, despite running >>>>> on the same machine, it's actually cross compiling due to Rosetta being >>>>> the --build=x86_64 system. >>>>> >>>>> Being a cross-compile, we therefore hit this case: >>>>> https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 >>>>> >>>>> And thus infers `/usr/bin/CC` for CXX. >>>>> >>>>> I guess cross compiling hasn't been a thing on macOS yet. I tried the >>>>> following and it passes the adlc build: >>>>> >>>>> --- a/make/autoconf/toolchain.m4 >>>>> +++ b/make/autoconf/toolchain.m4 >>>>> @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], >>>>> # find the build compilers in the tools dir, if needed. >>>>> UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) >>>>> UTIL_FIXUP_EXECUTABLE(BUILD_CC) >>>>> -UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) >>>>> +UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) >>>>> UTIL_FIXUP_EXECUTABLE(BUILD_CXX) >>>>> UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) >>>>> UTIL_FIXUP_EXECUTABLE(BUILD_NM) >>>>> >>>>> Although I'm not sure about its cleanliness :-) >>>>> >>>>> -Bernhard >>>>> >>>>> >>>>> From: build-dev on behalf of David >>>>> Holmes >>>>> Sent: Tuesday, August 4, 2020 00:46 >>>>> To: Erik Joelsson; Vladimir Kempik; build-dev >>>>> Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov >>>>> Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 >>>>> >>>>> On 3/08/2020 10:57 pm, Erik Joelsson wrote: >>>>>> Hello Vladimir, >>>>>> >>>>>> These changes look innocent enough to me. They aren't actually adding >>>>>> macosx-aarch64 support, they are just removing two minor (and more >>>>>> likely OS version related) hurdles from the build. You still have to >>>>>> provide the actual configuration on the configure command line as is >>>>>> shown in your example. Before we can call build system support, we would >>>>>> need configure to automatically setup those flags and add a separate >>>>>> parameter for the JNF framework. So, given that, I don't think this >>>>>> change warrants a JEP in itself. >>>>> Of course this change doesn't warrant a JEP in itself :) My point is >>>>> that until we have a JEP for the
Re: RFR: 8250876: Build system preparation to macos on aarch64
Yes, exactly. /Erik On 2020-08-10 06:16, Vladimir Kempik wrote: Hello Erik It’s not clear to me, what exactly you want to change in BUILD_CC, add clang to list for macos ? Thanks, Vladimir 10 авг. 2020 г., в 16:11, Erik Joelsson <mailto:erik.joels...@oracle.com>> написал(а): On 2020-08-10 03:47, Vladimir Kempik wrote: Hello Renamed the bug to "Fix issues with cross-compile on macos" Please check updated webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/ Adlc is fine with cross-compiling now. While not strictly needed for ADLC, I would like to see BUILD_CC getting the same treatment here for consistency. /Erik Regards, Vladimir 10 авг. 2020 г., в 12:52, Magnus Ihse Bursie <mailto:magnus.ihse.bur...@oracle.com>> написал(а): So, basically, what this patch is about is not so much "preparation for aarch64" as "allow cross-compile on macos"? If I understand you correctly, maybe you should rename the bug? /Magnus On 2020-08-04 16:09, Erik Joelsson wrote: That's a good find! You are correct in that we haven't cross compiled in any direction involving Macosx before. The preferred patch would be a bit more elaborate than that. Ideally we need better control over the toolchain type of the BUILD_* compiler settings. For now, I think just forcing clang/clang++ if BUILD_OS is macosx is good enough. /Erik On 2020-08-04 07:02, Bernhard Urban-Forster wrote: Good observation David, the change in adlc is just fixing a symptom. The difference to a regular macOS build is that technically, despite running on the same machine, it's actually cross compiling due to Rosetta being the --build=x86_64 system. Being a cross-compile, we therefore hit this case: https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 And thus infers `/usr/bin/CC` for CXX. I guess cross compiling hasn't been a thing on macOS yet. I tried the following and it passes the adlc build: --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], # find the build compilers in the tools dir, if needed. UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) UTIL_FIXUP_EXECUTABLE(BUILD_CC) - UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) + UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) UTIL_FIXUP_EXECUTABLE(BUILD_CXX) UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) UTIL_FIXUP_EXECUTABLE(BUILD_NM) Although I'm not sure about its cleanliness :-) -Bernhard From: build-dev <mailto:build-dev-r...@openjdk.java.net>> on behalf of David Holmes mailto:david.hol...@oracle.com>> Sent: Tuesday, August 4, 2020 00:46 To: Erik Joelsson; Vladimir Kempik; build-dev Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 On 3/08/2020 10:57 pm, Erik Joelsson wrote: Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile fo
Re: RFR: 8250876: Build system preparation to macos on aarch64
Hello Erik It’s not clear to me, what exactly you want to change in BUILD_CC, add clang to list for macos ? Thanks, Vladimir > 10 авг. 2020 г., в 16:11, Erik Joelsson написал(а): > > On 2020-08-10 03:47, Vladimir Kempik wrote: >> Hello >> >> Renamed the bug to "Fix issues with cross-compile on macos" >> >> Please check updated webrev: >> http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/ >> <http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/> >> >> Adlc is fine with cross-compiling now. >> > While not strictly needed for ADLC, I would like to see BUILD_CC getting the > same treatment here for consistency. > > /Erik > >> Regards, Vladimir >>> 10 авг. 2020 г., в 12:52, Magnus Ihse Bursie >> <mailto:magnus.ihse.bur...@oracle.com>> написал(а): >>> >>> So, basically, what this patch is about is not so much "preparation for >>> aarch64" as "allow cross-compile on macos"? If I understand you correctly, >>> maybe you should rename the bug? >>> >>> /Magnus >>> >>> On 2020-08-04 16:09, Erik Joelsson wrote: >>>> That's a good find! You are correct in that we haven't cross compiled in >>>> any direction involving Macosx before. >>>> >>>> The preferred patch would be a bit more elaborate than that. Ideally we >>>> need better control over the toolchain type of the BUILD_* compiler >>>> settings. For now, I think just forcing clang/clang++ if BUILD_OS is >>>> macosx is good enough. >>>> >>>> /Erik >>>> >>>> On 2020-08-04 07:02, Bernhard Urban-Forster wrote: >>>>> Good observation David, the change in adlc is just fixing a symptom. The >>>>> difference to a regular macOS build is that technically, despite running >>>>> on the same machine, it's actually cross compiling due to Rosetta being >>>>> the --build=x86_64 system. >>>>> >>>>> Being a cross-compile, we therefore hit this case: >>>>> https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 >>>>> >>>>> <https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921> >>>>> >>>>> And thus infers `/usr/bin/CC` for CXX. >>>>> >>>>> I guess cross compiling hasn't been a thing on macOS yet. I tried the >>>>> following and it passes the adlc build: >>>>> >>>>> --- a/make/autoconf/toolchain.m4 >>>>> +++ b/make/autoconf/toolchain.m4 >>>>> @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], >>>>> # find the build compilers in the tools dir, if needed. >>>>> UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) >>>>> UTIL_FIXUP_EXECUTABLE(BUILD_CC) >>>>> - UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) >>>>> +UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) >>>>> UTIL_FIXUP_EXECUTABLE(BUILD_CXX) >>>>> UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) >>>>> UTIL_FIXUP_EXECUTABLE(BUILD_NM) >>>>> >>>>> Although I'm not sure about its cleanliness :-) >>>>> >>>>> -Bernhard >>>>> >>>>> >>>>> From: build-dev >>>> <mailto:build-dev-r...@openjdk.java.net>> on behalf of David Holmes >>>>> mailto:david.hol...@oracle.com>> >>>>> Sent: Tuesday, August 4, 2020 00:46 >>>>> To: Erik Joelsson; Vladimir Kempik; build-dev >>>>> Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov >>>>> Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 >>>>> >>>>> On 3/08/2020 10:57 pm, Erik Joelsson wrote: >>>>>> Hello Vladimir, >>>>>> >>>>>> These changes look innocent enough to me. They aren't actually adding >>>>>> macosx-aarch64 support, they are just removing two minor (and more >>>>>> likely OS version related) hurdles from the build. You still have to >>>>>> provide the actual configuration on the configure command line as is >>>>>> shown in your example. Before we can call build system support, we would >>>>
Re: RFR: 8250876: Build system preparation to macos on aarch64
On 2020-08-10 03:47, Vladimir Kempik wrote: Hello Renamed the bug to "Fix issues with cross-compile on macos" Please check updated webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/ Adlc is fine with cross-compiling now. While not strictly needed for ADLC, I would like to see BUILD_CC getting the same treatment here for consistency. /Erik Regards, Vladimir 10 авг. 2020 г., в 12:52, Magnus Ihse Bursie <mailto:magnus.ihse.bur...@oracle.com>> написал(а): So, basically, what this patch is about is not so much "preparation for aarch64" as "allow cross-compile on macos"? If I understand you correctly, maybe you should rename the bug? /Magnus On 2020-08-04 16:09, Erik Joelsson wrote: That's a good find! You are correct in that we haven't cross compiled in any direction involving Macosx before. The preferred patch would be a bit more elaborate than that. Ideally we need better control over the toolchain type of the BUILD_* compiler settings. For now, I think just forcing clang/clang++ if BUILD_OS is macosx is good enough. /Erik On 2020-08-04 07:02, Bernhard Urban-Forster wrote: Good observation David, the change in adlc is just fixing a symptom. The difference to a regular macOS build is that technically, despite running on the same machine, it's actually cross compiling due to Rosetta being the --build=x86_64 system. Being a cross-compile, we therefore hit this case: https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 And thus infers `/usr/bin/CC` for CXX. I guess cross compiling hasn't been a thing on macOS yet. I tried the following and it passes the adlc build: --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], # find the build compilers in the tools dir, if needed. UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) UTIL_FIXUP_EXECUTABLE(BUILD_CC) - UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) + UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) UTIL_FIXUP_EXECUTABLE(BUILD_CXX) UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) UTIL_FIXUP_EXECUTABLE(BUILD_NM) Although I'm not sure about its cleanliness :-) -Bernhard From: build-dev <mailto:build-dev-r...@openjdk.java.net>> on behalf of David Holmes mailto:david.hol...@oracle.com>> Sent: Tuesday, August 4, 2020 00:46 To: Erik Joelsson; Vladimir Kempik; build-dev Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 On 3/08/2020 10:57 pm, Erik Joelsson wrote: Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder
Re: RFR: 8250876: Build system preparation to macos on aarch64
Hello Renamed the bug to "Fix issues with cross-compile on macos" Please check updated webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/ <http://cr.openjdk.java.net/~vkempik/8250876/webrev.01/> Adlc is fine with cross-compiling now. Regards, Vladimir > 10 авг. 2020 г., в 12:52, Magnus Ihse Bursie > написал(а): > > So, basically, what this patch is about is not so much "preparation for > aarch64" as "allow cross-compile on macos"? If I understand you correctly, > maybe you should rename the bug? > > /Magnus > > On 2020-08-04 16:09, Erik Joelsson wrote: >> That's a good find! You are correct in that we haven't cross compiled in any >> direction involving Macosx before. >> >> The preferred patch would be a bit more elaborate than that. Ideally we need >> better control over the toolchain type of the BUILD_* compiler settings. For >> now, I think just forcing clang/clang++ if BUILD_OS is macosx is good enough. >> >> /Erik >> >> On 2020-08-04 07:02, Bernhard Urban-Forster wrote: >>> Good observation David, the change in adlc is just fixing a symptom. The >>> difference to a regular macOS build is that technically, despite running on >>> the same machine, it's actually cross compiling due to Rosetta being the >>> --build=x86_64 system. >>> >>> Being a cross-compile, we therefore hit this case: >>> https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 >>> >>> And thus infers `/usr/bin/CC` for CXX. >>> >>> I guess cross compiling hasn't been a thing on macOS yet. I tried the >>> following and it passes the adlc build: >>> >>> --- a/make/autoconf/toolchain.m4 >>> +++ b/make/autoconf/toolchain.m4 >>> @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], >>> # find the build compilers in the tools dir, if needed. >>> UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) >>> UTIL_FIXUP_EXECUTABLE(BUILD_CC) >>> -UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) >>> +UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) >>> UTIL_FIXUP_EXECUTABLE(BUILD_CXX) >>> UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) >>> UTIL_FIXUP_EXECUTABLE(BUILD_NM) >>> >>> Although I'm not sure about its cleanliness :-) >>> >>> -Bernhard >>> >>> >>> From: build-dev on behalf of David Holmes >>> >>> Sent: Tuesday, August 4, 2020 00:46 >>> To: Erik Joelsson; Vladimir Kempik; build-dev >>> Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov >>> Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 >>> >>> On 3/08/2020 10:57 pm, Erik Joelsson wrote: >>>> Hello Vladimir, >>>> >>>> These changes look innocent enough to me. They aren't actually adding >>>> macosx-aarch64 support, they are just removing two minor (and more >>>> likely OS version related) hurdles from the build. You still have to >>>> provide the actual configuration on the configure command line as is >>>> shown in your example. Before we can call build system support, we would >>>> need configure to automatically setup those flags and add a separate >>>> parameter for the JNF framework. So, given that, I don't think this >>>> change warrants a JEP in itself. >>> Of course this change doesn't warrant a JEP in itself :) My point is >>> that until we have a JEP for the platform that is being targeted then we >>> shouldn't be making changes to provide support for that platform. >>> >>> That said I didn't actually look at the changes but focused on the >>> larger stated aim, so apologies for that. >>> >>> The actual changes here are small and not obviously related to >>> supporting macOS-Aarch64. But I'm unclear on this change as it affects >>> all macOS builds: >>> >>> 42 else ifeq ($(call isBuildOs, macosx), true) >>> 43 ADLC_LDFLAGS := -lc++ >>> >>> if this was fixing a bug as indicated, why do we not see this bug in >>> regular builds? >>> >>> Thanks, >>> David >>> - >>> >>> >>>> My only complaint is that you revert jib-profiles.js. That file is only >>>> used internally at Oracle. If/when we need i
Re: RFR: 8250876: Build system preparation to macos on aarch64
So, basically, what this patch is about is not so much "preparation for aarch64" as "allow cross-compile on macos"? If I understand you correctly, maybe you should rename the bug? /Magnus On 2020-08-04 16:09, Erik Joelsson wrote: That's a good find! You are correct in that we haven't cross compiled in any direction involving Macosx before. The preferred patch would be a bit more elaborate than that. Ideally we need better control over the toolchain type of the BUILD_* compiler settings. For now, I think just forcing clang/clang++ if BUILD_OS is macosx is good enough. /Erik On 2020-08-04 07:02, Bernhard Urban-Forster wrote: Good observation David, the change in adlc is just fixing a symptom. The difference to a regular macOS build is that technically, despite running on the same machine, it's actually cross compiling due to Rosetta being the --build=x86_64 system. Being a cross-compile, we therefore hit this case: https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 And thus infers `/usr/bin/CC` for CXX. I guess cross compiling hasn't been a thing on macOS yet. I tried the following and it passes the adlc build: --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], # find the build compilers in the tools dir, if needed. UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) UTIL_FIXUP_EXECUTABLE(BUILD_CC) - UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) + UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) UTIL_FIXUP_EXECUTABLE(BUILD_CXX) UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) UTIL_FIXUP_EXECUTABLE(BUILD_NM) Although I'm not sure about its cleanliness :-) -Bernhard From: build-dev on behalf of David Holmes Sent: Tuesday, August 4, 2020 00:46 To: Erik Joelsson; Vladimir Kempik; build-dev Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 On 3/08/2020 10:57 pm, Erik Joelsson wrote: Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch arm64’ JNF.framework is missing arm64 part as of next macos release, but Apple has opensourced it. Fix to adlc were needed due to it using symbols from stdc++ and not linking to it, so it fails when doing make images. The webrev: https://nam06.safelinks.protection.outlook.com/?url=http:%2F%2Fcr.openjdk.java.net%2F~vkempik%2F8250876%2Fwebrev.00%2F&data=02%7C01%7Cbeurba%40microsoft.com%7C0c8d58d5eb9144e8717f08d837ff3736%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637320916565796801&sdata=HpXJmHXbuawTdExWES
Re: RFR: 8250876: Build system preparation to macos on aarch64
Thanks Bernhard. General cross-compilation improvement are a good thing. Cheers, David - On 5/08/2020 12:02 am, Bernhard Urban-Forster wrote: Good observation David, the change in adlc is just fixing a symptom. The difference to a regular macOS build is that technically, despite running on the same machine, it's actually cross compiling due to Rosetta being the --build=x86_64 system. Being a cross-compile, we therefore hit this case: https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 And thus infers `/usr/bin/CC` for CXX. I guess cross compiling hasn't been a thing on macOS yet. I tried the following and it passes the adlc build: --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], # find the build compilers in the tools dir, if needed. UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) UTIL_FIXUP_EXECUTABLE(BUILD_CC) -UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) +UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) UTIL_FIXUP_EXECUTABLE(BUILD_CXX) UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) UTIL_FIXUP_EXECUTABLE(BUILD_NM) Although I'm not sure about its cleanliness :-) -Bernhard From: build-dev on behalf of David Holmes Sent: Tuesday, August 4, 2020 00:46 To: Erik Joelsson; Vladimir Kempik; build-dev Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 On 3/08/2020 10:57 pm, Erik Joelsson wrote: Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch arm64’ JNF.framework is missing arm64 part as of next macos release, but Apple has opensourced it. Fix to adlc were needed due to it using symbols from stdc++ and not linking to it, so it fails when doing make images. The webrev: https://nam06.safelinks.protection.outlook.com/?url=http:%2F%2Fcr.openjdk.java.net%2F~vkempik%2F8250876%2Fwebrev.00%2F&data=02%7C01%7Cbeurba%40microsoft.com%7C0c8d58d5eb9144e8717f08d837ff3736%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637320916565796801&sdata=HpXJmHXbuawTdExWESK9ssesYTuPTj7N6inXjaHfVaM%3D&reserved=0 The bug: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.openjdk.java.net%2Fbrowse%2FJDK-8250876&data=02%7C01%7Cbeurba%40microsoft.com%7C0c8d58d5eb9144e8717f08d837ff3736%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637320916565796801&sdata=9z2Nw8d0pa5huxUKOYorMOVy6SBo7o%2FhDT1EmgOhxQ8%3D&reserved=0 Testing: jdk/submit. Thanks, Vladimir.
Re: RFR: 8250876: Build system preparation to macos on aarch64
That's a good find! You are correct in that we haven't cross compiled in any direction involving Macosx before. The preferred patch would be a bit more elaborate than that. Ideally we need better control over the toolchain type of the BUILD_* compiler settings. For now, I think just forcing clang/clang++ if BUILD_OS is macosx is good enough. /Erik On 2020-08-04 07:02, Bernhard Urban-Forster wrote: Good observation David, the change in adlc is just fixing a symptom. The difference to a regular macOS build is that technically, despite running on the same machine, it's actually cross compiling due to Rosetta being the --build=x86_64 system. Being a cross-compile, we therefore hit this case: https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 And thus infers `/usr/bin/CC` for CXX. I guess cross compiling hasn't been a thing on macOS yet. I tried the following and it passes the adlc build: --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], # find the build compilers in the tools dir, if needed. UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) UTIL_FIXUP_EXECUTABLE(BUILD_CC) -UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) +UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) UTIL_FIXUP_EXECUTABLE(BUILD_CXX) UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) UTIL_FIXUP_EXECUTABLE(BUILD_NM) Although I'm not sure about its cleanliness :-) -Bernhard From: build-dev on behalf of David Holmes Sent: Tuesday, August 4, 2020 00:46 To: Erik Joelsson; Vladimir Kempik; build-dev Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 On 3/08/2020 10:57 pm, Erik Joelsson wrote: Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch arm64’ JNF.framework is missing arm64 part as of next macos release, but Apple has opensourced it. Fix to adlc were needed due to it using symbols from stdc++ and not linking to it, so it fails when doing make images. The webrev: https://nam06.safelinks.protection.outlook.com/?url=http:%2F%2Fcr.openjdk.java.net%2F~vkempik%2F8250876%2Fwebrev.00%2F&data=02%7C01%7Cbeurba%40microsoft.com%7C0c8d58d5eb9144e8717f08d837ff3736%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637320916565796801&sdata=HpXJmHXbuawTdExWESK9ssesYTuPTj7N6inXjaHfVaM%3D&reserved=0 The bug: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.openjdk.java.net%2Fbrowse%2FJDK-8250876&data=02%7C01%7Cbeurba%40microsoft.com%7C0c8d58d5eb9144e8717f08d837ff3736%7C72f988bf86f141af91ab2d7cd0
Re: RFR: 8250876: Build system preparation to macos on aarch64
Good observation David, the change in adlc is just fixing a symptom. The difference to a regular macOS build is that technically, despite running on the same machine, it's actually cross compiling due to Rosetta being the --build=x86_64 system. Being a cross-compile, we therefore hit this case: https://github.com/openjdk/jdk/blob/b0ceab23dd4176329cbf3a95f21e8e9ac2d8723f/make/autoconf/toolchain.m4#L905-L921 And thus infers `/usr/bin/CC` for CXX. I guess cross compiling hasn't been a thing on macOS yet. I tried the following and it passes the adlc build: --- a/make/autoconf/toolchain.m4 +++ b/make/autoconf/toolchain.m4 @@ -917,7 +917,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS], # find the build compilers in the tools dir, if needed. UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc]) UTIL_FIXUP_EXECUTABLE(BUILD_CC) -UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++]) +UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++]) UTIL_FIXUP_EXECUTABLE(BUILD_CXX) UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm) UTIL_FIXUP_EXECUTABLE(BUILD_NM) Although I'm not sure about its cleanliness :-) -Bernhard From: build-dev on behalf of David Holmes Sent: Tuesday, August 4, 2020 00:46 To: Erik Joelsson; Vladimir Kempik; build-dev Cc: Anton Kozlov; Alexander Ioffe; Andrew Brygin; Andrey Petushkov Subject: Re: RFR: 8250876: Build system preparation to macos on aarch64 On 3/08/2020 10:57 pm, Erik Joelsson wrote: > Hello Vladimir, > > These changes look innocent enough to me. They aren't actually adding > macosx-aarch64 support, they are just removing two minor (and more > likely OS version related) hurdles from the build. You still have to > provide the actual configuration on the configure command line as is > shown in your example. Before we can call build system support, we would > need configure to automatically setup those flags and add a separate > parameter for the JNF framework. So, given that, I don't think this > change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - > My only complaint is that you revert jib-profiles.js. That file is only > used internally at Oracle. If/when we need it to support macosx-aarch64, > we will provide those changes. > > I must say I'm happy to see you managed to get a working build > configuration with just this though! > > /Erik > > On 2020-08-01 00:24, Vladimir Kempik wrote: >> Hello >> >> Please review this change for JDK-8250876 >> >> This changeset adds support for macos/aarch64 into build system. >> It will allow to crosscompile for macos/aarch64 using intel mac as well. >> >> This changeset does NOT address some arm specific issues in the macos >> related code, we plan to do that in s separate commit. >> >> An example of configure to cross-compile for macos/arm64: >> >> --with-boot-jdk=/path/to/java/ >> --with-build-jdk=/path/to/same/java/as/compiled >> --disable-warnings-as-errors --with-jvm-variants=zero >> --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch >> arm64' --with-extra-ldflags='-arch arm64 >> -F/Path/To/Folder/Containing/JNF_framework/' >> —with-extra-cxxflags='-arch arm64’ >> >> JNF.framework is missing arm64 part as of next macos release, but >> Apple has opensourced it. >> >> Fix to adlc were needed due to it using symbols from stdc++ and not >> linking to it, so it fails when doing make images. >> >> The webrev: >> https://nam06.safelinks.protection.outlook.com/?url=http:%2F%2Fcr.openjdk.java.net%2F~vkempik%2F8250876%2Fwebrev.00%2F&data=02%7C01%7Cbeurba%40microsoft.com%7C0c8d58d5eb9144e8717f08d837ff3736%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637320916565796801&sdata=HpXJmHXbuawTdExWESK9ssesYTuPTj7N6inXjaHfVaM%3D&reserved=0 >> The bug: >> https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugs.openjdk.java.net%2Fbrowse%2FJDK-8250876&data=02%7C01%7Cbeurba%40microsoft.com%7C0c8d58d5eb9144e8717f08d837ff3736%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637320916565796801&sdata=9z2Nw8d0pa5huxUKOYorMOVy6SBo7o%2FhDT1EmgOhxQ8%3D&reserved=0 >> >> Testing: jdk/submit. >> >> Thanks, Vladimir.
Re: RFR: 8250876: Build system preparation to macos on aarch64
On 3/08/2020 10:57 pm, Erik Joelsson wrote: Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. Of course this change doesn't warrant a JEP in itself :) My point is that until we have a JEP for the platform that is being targeted then we shouldn't be making changes to provide support for that platform. That said I didn't actually look at the changes but focused on the larger stated aim, so apologies for that. The actual changes here are small and not obviously related to supporting macOS-Aarch64. But I'm unclear on this change as it affects all macOS builds: 42 else ifeq ($(call isBuildOs, macosx), true) 43 ADLC_LDFLAGS := -lc++ if this was fixing a bug as indicated, why do we not see this bug in regular builds? Thanks, David - My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch arm64’ JNF.framework is missing arm64 part as of next macos release, but Apple has opensourced it. Fix to adlc were needed due to it using symbols from stdc++ and not linking to it, so it fails when doing make images. The webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.00/ The bug: https://bugs.openjdk.java.net/browse/JDK-8250876 Testing: jdk/submit. Thanks, Vladimir.
Re: RFR: 8250876: Build system preparation to macos on aarch64
Hello Vladimir, These changes look innocent enough to me. They aren't actually adding macosx-aarch64 support, they are just removing two minor (and more likely OS version related) hurdles from the build. You still have to provide the actual configuration on the configure command line as is shown in your example. Before we can call build system support, we would need configure to automatically setup those flags and add a separate parameter for the JNF framework. So, given that, I don't think this change warrants a JEP in itself. My only complaint is that you revert jib-profiles.js. That file is only used internally at Oracle. If/when we need it to support macosx-aarch64, we will provide those changes. I must say I'm happy to see you managed to get a working build configuration with just this though! /Erik On 2020-08-01 00:24, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch arm64’ JNF.framework is missing arm64 part as of next macos release, but Apple has opensourced it. Fix to adlc were needed due to it using symbols from stdc++ and not linking to it, so it fails when doing make images. The webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.00/ The bug: https://bugs.openjdk.java.net/browse/JDK-8250876 Testing: jdk/submit. Thanks, Vladimir.
Re: RFR: 8250876: Build system preparation to macos on aarch64
Hi Vladimir, On 1/08/2020 5:24 pm, Vladimir Kempik wrote: Hello Please review this change for JDK-8250876 This changeset adds support for macos/aarch64 into build system. macOS/Aarch64 is not yet an accepted platform for the OpenJDK. Adding such a platform requires a JEP as is being done for the Windows/Aarch64 port. Thanks, David - It will allow to crosscompile for macos/aarch64 using intel mac as well. This changeset does NOT address some arm specific issues in the macos related code, we plan to do that in s separate commit. An example of configure to cross-compile for macos/arm64: --with-boot-jdk=/path/to/java/ --with-build-jdk=/path/to/same/java/as/compiled --disable-warnings-as-errors --with-jvm-variants=zero --openjdk-target=aarch64-apple-darwin --with-extra-cflags='-arch arm64' --with-extra-ldflags='-arch arm64 -F/Path/To/Folder/Containing/JNF_framework/' —with-extra-cxxflags='-arch arm64’ JNF.framework is missing arm64 part as of next macos release, but Apple has opensourced it. Fix to adlc were needed due to it using symbols from stdc++ and not linking to it, so it fails when doing make images. The webrev: http://cr.openjdk.java.net/~vkempik/8250876/webrev.00/ The bug: https://bugs.openjdk.java.net/browse/JDK-8250876 Testing: jdk/submit. Thanks, Vladimir.