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

Add simple cross compile mechanism for flisp/libsupport (+ dependencies) #30526

Merged
merged 5 commits into from
Jul 2, 2019

Conversation

Keno
Copy link
Member

@Keno Keno commented Dec 28, 2018

This makes some incremental progress towards #30338 in the build system.
In particular, it allows compiling a separate boostrap version of flisp
and its dependencies for an architecture different from the target.
The immediate use case here is to build libjulia for wasm. Of course,
there's still the enormous problem of building the system image itself,
but luckily wasm is largely memory-layout-identical to linux32, so doing
that limited bootstrap is fairly easy after this change (though the subject
of a different PR).

The mechanism here is to use the out-of-tree build support to create
separate host/ subdirectories for the build directories of interest.
These have a special make variable set that tell it to include a
different Make.user (or in the absence thereof use the host defaults).

cc @SimonDanisch

Needs a bit more testing, but seems to do what I need it to in preliminary evaluation.

@Keno Keno force-pushed the kf/flispcross branch 2 times, most recently from 5a0bbad to 44d3854 Compare December 28, 2018 19:22
@ararslan ararslan added the building Build system, or building Julia or its dependencies label Dec 28, 2018
Make.inc Show resolved Hide resolved
deps/tools/common.mk Outdated Show resolved Hide resolved
@Keno
Copy link
Member Author

Keno commented Dec 30, 2018

Is there a way we could run the full barrage of buildbots on this branch? There's a good number of mechanism changes here and I'd like to make sure I don't break anything.

@staticfloat
Copy link
Sponsor Member

staticfloat commented Dec 30, 2018

Yes. Go to this page, login by authentication through github in the top right, then cmd-click on each builder name starting with package_ to open a tab into each of our builders. Finally, click the blue "package" button in the top right, and paste in the gitsha (or branch name) that you're interested in building.

I've gone ahead and done this for you; here are the in-progress builds.

This makes me miss @jlbuild. :'(

@vtjnash
Copy link
Sponsor Member

vtjnash commented Dec 30, 2018

The mechanism here is to use the out-of-tree build support to create

That was secretly one of the goals of that work—I'm glad to see it's finally getting put to its intended use :) I've only reviewed fairly briefly, but the general direction of all of the changes looked good to me.

Could we avoid most of the MAYBE_HOST changes to deps by just altering the BUILDDIR and build_staging variables, instead of modifying all uses of them?

@Keno
Copy link
Member Author

Keno commented Dec 30, 2018

Could we avoid most of the MAYBE_HOST changes to deps by just altering the BUILDDIR and build_staging variables, instead of modifying all uses of them?

Ok, done.

$$(build_prefix)/manifest/$(strip $1): $$(build_staging)/$2.tgz | $(build_prefix)/manifest
mkdir -p $$(build_prefix)
$$(build_prefix)/manifest/$(strip $1): $$(build_staging)/$2.tgz
mkdir -p $$(build_prefix)/manifest
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Seems unnecessary? We usually use the gmake extention to do mkdir, instead of each separate recipe being involved

Copy link
Member Author

Choose a reason for hiding this comment

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

Didn't work for me for some reason. Is there something special I need to do?

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

It appears to have been working for everyone else

$(BUILDDIR)/flisp.boot: flisp.boot | $(BUILDDIR)
$(BUILDDIR)/host/Makefile:
mkdir -p $(BUILDDIR)/host
@# add Makefiles to the build directories for convenience (pointing back to the source location of each)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Not the right file source in the comment. Is it worth trying to use the existing code to do this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing the comment. I don't think it's worth trying to deduplicate, esp since this adds a couple extra lines.

$(LLT_release): $(LLTSRCDIR)/*.h $(LLTSRCDIR)/*.c
$(MAKE) -C $(NATIVE_BUILDDIR)/$(LLTDIR) $(subst $(abspath $(NATIVE_BUILDDIR)/$(LLTDIR))/,,$(abspath $(LLT_release)))
$(LLT_debug): $(LLTSRCDIR)/*.h $(LLTSRCDIR)/*.c
$(MAKE) -C $(NATIVE_BUILDDIR)/$(LLTDIR) $(subst $(abspath $(NATIVE_BUILDDIR)/$(LLTDIR))/,,$(abspath $(LLT_debug)))
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Isn’t this slightly conflicted? The directory seems to be for native, but the subst looks for a slightly different prefix? Maybe we should add the abspath rule to the LLT Makefile, so we can remove the subst from here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there's much to be gained. Keeping the targets appropriately relative seems simplest to me. This just turns the absolute path back into a relative path.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

sure, just seemed like it wasn't relative to anything obviously meaningful

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, it's just "relative" to the LLT build dir, which seems reasonably meaningful.

$(MAKE) -C $(BUILDDIR)/host libsupport.a

$(BUILDDIR)/host/libsupport-debug.a: $(BUILDDIR)/host/Makefile
$(MAKE) -C $(BUILDDIR)/host libsupport.a
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

-debug

Keno added 5 commits July 1, 2019 15:54
This makes some incremental progress towards #30338 in the build system.
In particular, it allows compiling a separate boostrap version of flisp
and its dependencies for an architecture different from the target.
The immediate use case here is to build libjulia for wasm. Of course,
there's still the enormous problem of building the system image itself,
but luckily wasm is largely memory-layout-identical to linux32, so doing
that limited bootstrap is fairly easy after this change (though the subject
of a different PR).

The mechanism here is to use the out-of-tree build support to create
separate host/ subdirectories for the build directories of interest.
These have a special make variable set that tell it to include a
different Make.user (or in the absence thereof use the host defaults).
@Keno
Copy link
Member Author

Keno commented Jul 1, 2019

Rebased and addressed review comments (as separate commits for easier review - will squash down to merge).

@Keno
Copy link
Member Author

Keno commented Jul 1, 2019

@staticfloat why did the buildbots not show up to CI this? Is it because the PR was created before those were a thing? Will the show up if I close and re-open?

@Keno Keno closed this Jul 1, 2019
@Keno Keno reopened this Jul 1, 2019
@Keno Keno merged commit 1fc51b7 into master Jul 2, 2019
@martinholters martinholters deleted the kf/flispcross branch July 2, 2019 20:42
$(BUILDDIR)/host/$(EXENAME): $(BUILDDIR)/host/Makefile
make -C $(BUILDDIR)/host $(EXENAME)

ifneq ($(BUILDDIR)$(BUILDING_HOST_TOOLS),.)
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Seems like this change may have introdced a minor build error?

make[2]: Circular /data/vtjnash/julia/src/flisp/flisp.boot <- /data/vtjnash/julia/src/flisp/flisp.boot dependency dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants