-
Notifications
You must be signed in to change notification settings - Fork 76
Support composing 32 bit builds for arm #88
Conversation
closed/OpenJ9.gmk
Outdated
@@ -28,6 +28,14 @@ ifeq (,$(BUILD_ID)) | |||
BUILD_ID := 000000 | |||
endif | |||
|
|||
# 64 bit compressedrefs builds put some of the libraries in lib/compressedrefs. | |||
# What's the appropriate directory for a 32 bit build? I've opted for 'default'. | |||
ifeq (1,$(OPENJDK_DOCKER_CC_ARM)) # condition should be more specific to 32bit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This limits to arm only, could this not be set at the time platform is determined within the custom-hook-m4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Joe, my objective with this set of changes is to take the shortest path that isn't totally objectionable to getting a working arm build. For sure there will be better solutions to most of the problems, and where that's obvious I'm adding comments to the effect. I'd like to get these changes in so that we can have the platform building and testing (and therefore preventing ever more bit-rot in the arm code base). I would suggest we open issues for future improvements and then people that actually understand how the build system works can implement gold standard solutions.
closed/OpenJ9.gmk
Outdated
$(foreach file,$(OPENJ9_MISC_FILES) $(OPENJ9_PROPERTY_FILES),$(eval $(call openj9_copy_file,$2/lib/$(file),$(OUTPUT_ROOT)/vm/$(file)))) | ||
$(foreach file,$(OPENJ9_NOTICE_FILES),$(eval $(call openj9_copy_file,$2/$(file),$(SRC_ROOT)/$(file)))) | ||
$(foreach file,$(OPENJ9_REDIRECTOR),$(eval $(call openj9_copy_file,$2/$(OPENJ9_LIBS_OUTPUT_DIR)/j9vm/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX),$(OUTPUT_ROOT)/vm/$(file)))) | ||
stage_openj9_shared_libraries_$1 := $(addprefix $2/$(OPENJ9_LIBS_OUTPUT_DIR)/compressedrefs/,$(OPENJ9_SHARED_LIBRARIES)) | ||
ifeq (1,$(OPENJDK_DOCKER_CC_ARM)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could determine if its a cross compile if we compared OPENJDK_TARGET_* and OPENJDK_BUILD_*. Might be better to determine this at configure time. This would keep it more generic.
@@ -210,7 +233,12 @@ define openj9_copy_tree_impl | |||
@$(TOUCH) $1/$(OPENJ9_MARKER_FILE) | |||
endef | |||
|
|||
$(eval $(call generated_target_rules_build,build_jdk,$(BUILD_JDK))) | |||
# Temporary fix until we work out how to handle the build_jdk for cross compiles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does generating the rule cause problems if its not being run via the change to closed/make/Main.gmk?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It certainly did at one point in time. I don't know if any of my more recent changes have made any difference to that. The generated_target_rules* behaviour is remarkably opaque, even after several hours of make --debug hacking.
@@ -30,7 +30,11 @@ j9vm-build : | |||
+($(CD) $(SRC_ROOT)/closed && $(MAKE) -f OpenJ9.gmk SPEC=$(SPEC) VERSION_MAJOR=$(VERSION_MAJOR) build-j9) | |||
|
|||
j9vm-compose-buildjvm : j9vm-build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure this is the correct spot for this, I'm just not sure where is atm. Openjdk should already have a case to handle cross compilation and not be generating a buildjdk in that case. More than likely we have added the 'j9vm-compose-buildjvm' dependency to the wrong target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make/Main.gmk...
java.base-jmod: j9vm-compose-buildjvm
...should likely be about 10-15 lines down in the CREATE_BUILDJDK ifeq.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Openjdk works entirely as expected (I started with an Openjdk/hotspot build before trying to build OpenJ9). It's certainly something we broke. Although to be more specific, it handles the cross compile and builds the appropriate build jdk for the host platform.
5b99b16
to
6fefe60
Compare
First version was naive in my use of ifeq inside the define clause and didn't work for x86. I've updated and tested on both platforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking on it, I don't believe this is the right approach using OPENJDK_DOCKER_CC_ARM set in the host system to indicated its a cross-compile. All variables in use are determined based on configure and stored in either the spec.gmk or custom-spec.gmk.
The variable, OPENJDK_DOCKER_CC_ARM, is very specific for cross compilation and shouldn't be introduced specific to arm or docker. There should be an addition made in the custom-hook.m4 for a 'CROSS_COMPILE' variable (assuming one doesn't already exist, I didn't look extensively) as well as setting LIB_SUBDIR (better OPENJ9_LIB_SUBDIR to be consistent with variable naming) on openj9 platform selection/designation.
Ok, I can circle around and see what I can do. I may need further guidance though, as build scripts are not my thing. |
a51ddb6
to
3dffa4c
Compare
@jdekonin I reworked the changes to get rid of the OPENJ9_DOCKER_CC_ARM flag. |
closed/OpenJ9.gmk
Outdated
$$(stage_openj9_redirector_$1) \ | ||
$$(stage_openj9_property_files_$1) | ||
endef | ||
else # Not an ARM cross compile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above looks very similar to what follows. I'd much prefer to avoid this repetition if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first attempt tried to put the conditional just around the extra libraries, but it didn't work. This version is clearly not very elegant, but it's simple to understand and it works. I'd be happy to change it, but my makefile skills are not sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keithc-ca How strongly do you feel about this? I don't know how to fix it, but I'd be happy to make changes if you show me how.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel strongly enough to request you give it another try.
@@ -152,15 +152,22 @@ AC_DEFUN([OPENJ9_PLATFORM_EXTRACT_VARS_FROM_CPU], | |||
powerpc64) | |||
OPENJ9_CPU=ppc-64 | |||
;; | |||
arm) | |||
OPENJ9_CPU=arm | |||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to autoconf files are expected to be accompanied by regenerated configure scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I wasn't sure if I was allowed to check in the generated scripts. I can add those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scripts regenerated and added to the PR
common/conf/jib-profiles.js
Outdated
@@ -928,6 +928,9 @@ var getJibProfilesDependencies = function (input, common) { | |||
linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0 | |||
? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0" | |||
: "arm-linaro-4.7+1.0") | |||
linux_arm_docker: (input.profile != null && input.profile.indexOf("hflt") >= 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this would be a required to openjdk. The uses of linux_arm_docker above are specific to openj9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent. I wasn't sure what that was for and duplicated the block as part of a "find all the uses of linux_arm" exercise. I've confirmed that the JVM can be configured and built without that change, so I'll take it back out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes removed.
closed/OpenJ9.gmk
Outdated
@@ -28,6 +28,14 @@ ifeq (,$(BUILD_ID)) | |||
BUILD_ID := 000000 | |||
endif | |||
|
|||
# 64 bit compressedrefs builds put some of the libraries in lib/compressedrefs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entire block should be done once at configure time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdekonin , I'm happy to make that change. Where/how should it be done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this couldn't be set at the same time OPENJ9_PLATFORM_CODE or OPENJ9_BUILDSPEC are defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I added a new variable to custom_hook.m4 in the same place as OPENJ9_PLATFORM_CODE is set. It took me a couple of hours to debug why the value wasn't visible from OpenJ9.gmk, but it works now.
closed/OpenJ9.gmk
Outdated
@@ -164,13 +172,43 @@ endef | |||
# ---------------------- | |||
# param 1 = The jdk/jre directory name | |||
# param 2 = The jdk/jre directory to add openj9 content | |||
ifeq (xr32,$(OPENJ9_PLATFORM_CODE)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the files that are missed if the 'buildjvm' target(s) aren't called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly not a complete list, but these are the libraries that for a while I was manually copying in order to compose the build:
libomrsig.so libj9vm29.so libj9thr29.so libj9hookable29.so libj9prt29.so \
libffi29.so libhyprtshim29.so libhythr.so libj9dmp29.so libj9trc29.so \
libj9zlib29.so libj9jit29.so libj9gc29.so libj9vrb29.so libj9jvmti29.so \
libjclse9_29.so libj9shr29.so libjvm.so ../j9vm/libjvm.so
There seemed to be good overlap between this set and the files defined for OPENJ9_JAVA_BASE_LIBRARIES and OPENJ9_SHARED_CLASSES_LIBRARIES.
7bf4e34
to
1a4e450
Compare
@jdekonin @keithc-ca I've squashed the commits, any more changes required? |
1a4e450
to
17056e9
Compare
@jdekonin Any more feedback on this PR? |
The only part I question now is surrounding the openj9.gmk:generated_target_rules macro. I don't see why the targets need be removed if they are not being called. The extra targets specific to cross compile I can understand, but the extra duplicating isn't very 'clean'. I attempted to build last week, but there appeared to be some omr/j9 native compilation issues. I seem to have gotten past that today, but its failing to compose.
All repos current to days content. |
For sure it would be nice to clean the generated rules stuff up. But I sank hours into trying to understand what it was doing and eventually got frustrated with it. Not sure why it didn't build for you, it was working yesterday: https://travis-ci.org/JamesKingdon/openj9-openjdk-jdk9/builds/317768853 Edit2: But of course my build is off a different branch to the one this PR is for, and the branches have diverged over the last few weeks, so it doesn't tell us much any more. Edit3 (&4): Ran another local build with the compose_arm branch and confirmed it's still working. Steps used were:
Edit: the compose buildjvm step is supposed to be skipped, which is based on
|
f40d740
to
6c01b8b
Compare
@jdekonin @keithc-ca I've removed the duplicate copy of generated_target_rules by introducing two new make variables that are conditionally initialized with the libraries needed when cross compiling for arm. This seems like a neater solution.
|
Some of those files have correct copyrights, not sure why they are showing up in the report. Do you need to rebase? Only custom-hook.m4 needs a fix, which I can do. |
I notice there are conflicts that need to be resolved before merging, so a rebase does seem to be required. |
Maybe I have my upstream misconfigured - I'll check and try another rebase. |
Multiple changes were required to enable cross-compilation and composition of the 32bit build into the 'default' lib subdirectory. This subdirectory name is now parameterised throughout the composition steps and can be set from custom-hook.m4 using OPENJ9_LIBS_SUBDIR. The build jdk is not currently supported (if attempted it builds for arm and then fails to run when used), so --with-build-jdk is used to specify a pre-existing build jdk. Because the build jdk isn't being built it was also necessary to prevent it being staged, otherwise the pre-existing build jdk gets overwritten with arm binaries. A new buildspec was added; linux_arm_linaro. Signed-off-by: James Kingdon <jkingdon@ca.ibm.com>
6c01b8b
to
bb8893b
Compare
There's definitely something odd going on with my upstream config, but I think I managed to get a successful rebase this time. |
Looks like I still need to update copyrights though. I guess because the changes are assumed to be made at the time the PR is eventually merged, rather than when I edited the code. |
Instead of duplicating the entire generated_target_rules section, define two new variables that contain the extra libraries needed when cross-compiling. These variables can be used within the generated_target_rules to make sure the jvm/jre is correctly composed. Signed-off-by: James Kingdon <jkingdon@ca.ibm.com>
bb8893b
to
fda2f51
Compare
The copyright check is complaining about the generated-configure.sh files, but they don't look like something I should be editing our copyright into. Is this a bug in the copyright checker? |
@AdamBrousseau ^^^ |
Opened eclipse-openj9/openj9#1043 to address copyright failures |
@jdekonin @keithc-ca Given the copyright failure is a tooling issue, do the changes to OpenJ9.gmk meet your requests? |
The copyright failure is a tooling issues, agreed. I want to discuss further with @keithc-ca before approving/merging. Out of curiosity, why the addition to openj9.gmk for just xr, would these same changes not also apply to other platforms. |
The extra libraries addition is to work around the fact that the cross compile doesn't create a build JVM. Since arm is the only platform currently being cross compiled the extra libraries are only needed for xr. The rest of the changes that allow for parameterizing the target directory name are more generally applicable, and I have another change set that uses that to build x86 non-compressed refs. It should also be useful if we want to build 32 bit versions of the other platforms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a number of open issues that closely touch OpenJ9.gmk and how images are created.
#34, #67, #81, #82, #83 and #100.
The method currently being used (prior to these changes) while functional for a basic build, is not the correct way of hooking into openjdk as you found out when adding a cross compile platform.
I believe most of these changes will become irrelevant once the openj9 native are generated into the correct location(s); into support/module_libs// ??? But that should be performed under a different pull request.
closed/OpenJ9.gmk
Outdated
# These are libraries that would normally be copied as part of the build jdk rules, but that section is currently | ||
# not implemented for arm. Once we have a working build jdk as part of the build it will probably be possible | ||
# to remove these declarations. | ||
ifeq (xr32,$(OPENJ9_PLATFORM_CODE)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make this more generic for cross compilation, much like the change in Main.gmk 'ifeq (
closed/OpenJ9.gmk
Outdated
# to remove these declarations. | ||
ifeq (xr32,$(OPENJ9_PLATFORM_CODE)) | ||
OPENJ9_JAVA_BASE_LIBRARIES_ARM := $(OPENJ9_JAVA_BASE_LIBRARIES) | ||
OPENJ9_SHARED_CLASSES_LIBRARIES_ARM := $(OPENJ9_SHARED_CLASSES_LIBRARIES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please modify naming to not be ARM specific.
closed/OpenJ9.gmk
Outdated
$(eval $(call generated_target_rules_build,build_jdk,$(BUILD_JDK))) | ||
# Temporary fix until we work out how to handle the build_jdk for cross compiles | ||
ifeq (xr32,$(OPENJ9_PLATFORM_CODE)) | ||
$(info Cross compilation detected, skipping generated_target_rules_build) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as the if statement above, please make it about cross compilation and not an ARM specific activity.
Hi Joe, thanks for the comments. Agreed, I think #67 is really the crux of the matter, once we get that worked out we should be able to clean up these changes substantially. I'll take a crack at your revisions. |
Removed the references to ARM as requested in the review. Signed-off-by: James Kingdon <jkingdon@ca.ibm.com>
@jdekonin Changes made |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this now. @keithc-ca ?
@jdekonin I'm fine with the content, but I'd like to see the changes squashed to a single commit, which can be done in the merge action. |
With all the review changes the previous PR became obsolete. This PR now covers all the changes required (in this project) for a working 32 bit cross compile hosted on x86 and targeting armhf.