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

Enabling CMake by default for cross-compiles #422

Open
dnakamura opened this issue Apr 12, 2022 · 14 comments
Open

Enabling CMake by default for cross-compiles #422

dnakamura opened this issue Apr 12, 2022 · 14 comments

Comments

@dnakamura
Copy link
Contributor

The CMake code should now be able to handle cross compile builds. This issue is to track any problems / objections anybody has before making cross-compile builds use cmake by default. CMake builds can currently be tested by passing --with-cmake when calling configure. In addition, where CMake is used by default, uma can still be used by passing --without-cmake.

@pshipton
Copy link
Member

pshipton commented Apr 12, 2022

@janvrany @ChengJin01 fyi, since this primarily affects RISCV builds.

janvrany added a commit to janvrany/openj9-openjdk-jdk11-devscripts that referenced this issue Apr 13, 2022
@janvrany
Copy link

Just FYI:
I just enabled --with-cmake on my RISC-V CI and the cross-compilation job failed:

[  2%] Generating ut_gptest.c, ut_gptest.h, ut_gptest.pdat
gmake[6]: *** [runtime/tests/gp/CMakeFiles/trc_gptest.dir/build.make:81: runtime/tests/gp/ut_gptest.c] Killed
gmake[6]: Leaving directory '/var/lib/jenkins/workspace/eclipse_j9/j9_eclipse_riscv64_linux_cross@2/openj9-openjdk-jdk11/build/linux-riscv64-normal-server-release/vm'
gmake[5]: *** [CMakeFiles/Makefile2:7957: runtime/tests/gp/CMakeFiles/trc_gptest.dir/all] Error 2

The problem was that QEMU exhausted all system memory leading to system slowly swapping itself to death before OOM killer killed the QEMU:

[1313076.582208] qemu-riscv64 invoked oom-killer: gfp_mask=0x100cca(GFP_HIGHUSER_MOVABLE), order=0, oom_score_adj=0

Yesterday's cross-build without --with-cmake succeeded.

Note, that my JIT development cross-builds are using my own quick-and-dirtty hacked CMake but do not suffer from this problem.

I'll have a closer look the week after next as right now I'm away from home with limited access to my systems.

@ChengJin01
Copy link

@janvrany, I suspect the integrated cmake changes might involve more memory than expected in QEMU which is pretty much restricted in terms of system memory. Is that possible to expand your memory on the command line when before launching QEMU? I recall there should be options for the memory setting.

@janvrany
Copy link

This is process-level QEMU so it has all the memory host has. I can try to increase host memory but I'd like to know why my home-baked CMake cross-build does not suffer from this problem.

We had similar problem with OMR tests and in the end we just increased the memory on Eclipse CI. Interestingly, on my system tests run just fine...

@dnakamura
Copy link
Contributor Author

Its odd that it dies during tracegen. Memory requirements there should be fairly minimal. @janvrany Are the sources for your hacked cmake support available ?

@janvrany
Copy link

Sorry, finally back home.
Sure, my changes are here:

Note that these are quick and dirty hacks I did just to allow me to build JIT component for RISC-V JIT development - my hacks may not run tracegen at all...

As for the memory requirements, I think it is QEMU that leaks the memory, not the tracegen itself. I'll investigate.

@janvrany
Copy link

Ah, this is embarrassing! It turned out that CMake picked up an ancient QEMU that was installed on my build node which suffered from some memory leak. With QEMU 6.2 or 7.0 it works just fine.

I'm very sorry about the noise!

@pshipton
Copy link
Member

pshipton commented Jun 7, 2022

#454 enables cmake for cross compiling, for jdk19+.

@pshipton
Copy link
Member

pshipton commented Jun 7, 2022

#454 only modifies the standard list of platforms.
@knn-k I can't recall if you use cross compiling for aarch64.

@knn-k
Copy link
Contributor

knn-k commented Jun 7, 2022

I sometimes use cross compilation in my environment for a specific AArch64 Linux target.
I am OK about making CMake by default. I guess --with-cmake=no still works in case of unexpected failures with cross builds.

@keithc-ca
Copy link
Member

This appears to have been applied to all jdk versions: Should we close this, or is there more to do?

@pshipton
Copy link
Member

pshipton commented Jun 27, 2022

This appears to have been applied to all jdk versions: Should we close this, or is there more to do?

Afaik #454 was applied to head but no other version got this change.

Also I had added a question to that PR after merging. Now that we support cross compilation, should we be compiling every build with cmake (by default) instead of just the hard coded list of platform?

@keithc-ca
Copy link
Member

You're right: Perhaps I didn't look closely enough (or in the wrong places). 8, 11, 17 and 18 all still default to UMA for cross-compiles.

I can't think of a reason why the default behavior should depend upon the platform any more: it can be cmake.

@pshipton
Copy link
Member

@dnakamura Summary of changes to date:
jdk8: ibmruntimes/openj9-openjdk-jdk8#583
jdk11: ibmruntimes/openj9-openjdk-jdk11#545
jdk17: missing
jdk18: ibmruntimes/openj9-openjdk-jdk18#70
jdk19: ibmruntimes/openj9-openjdk-jdk19#17
jdk: #454 - needs to be updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants