-
Notifications
You must be signed in to change notification settings - Fork 282
Cross compile with custom engine. #363
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
Comments
@jld3103 Can you please make sure that this is labeled correctly? |
I'd like to know more about how docker is involved in cross-compiling and how the current targets on desktop are defined then. Do you also plan to make targets like RPI "standard" (so that you don't have to specify the arguments every time)? Also adding something like a "profiles" config file for custom defined targets would be good. Moving from the current hover structure to the one you're proposing is a lot of effort, but it will be wortwhile. |
Lets separate these for a moment, i'll call it "hover compile". So running hover build, without any arguments is a sure host compilation requiring no cross compile steps, but it will go trough the hover compile, so we can support local engines. So flow wise:
We can probably create a "build config / presets" with predefined setups, so the users can easily target what they want, and decide if they want to use their host machine or docker to do the build. by a preset list we could go for something like fyne: darwin/amd64 And could add wasm with more effort to that list, or nacl, tizen etc :) So an overview:
Then hover compile could be used with docker (and for CI) and for dev on host machine as well without docker. So command wise: I hope it makes sense. |
Regarding the docker base image @GeertJohan created an PR for a new docker approach that uses a single image that we define |
Also I created a PR for AOT that currently only works on linux, but would be needed for your changes I guess. |
Nice! Ill check it.
Nice! ill add some comments regarding deps so it could be used by this! |
Also we are currently using https://github.com/flutter-rs/engine-builds as |
For the default set thats fine, i dont want to change the setup for that, just adding the option for users to use local engine :) non of these arguments should be required, regarding prebuilts, these should be ok. The flow somewhat similiar to flutter build bundle. |
@fourscience any news? Since you last wrote a lot of things have changed in hover. We finally have better Docker cross-compiling support. I'd recommend to make yourself familiar with the new hover features to further discuss the progress on this issue. |
Hello, yes and no :)
same works for darwin using the cc above with the engine for go ill post an update when its somewhat stable
Im still on quite far of having a feature ready setup, at the moment what is left to do besides the basic setup is a more proper configuration for linker, compiler, assembler steps and a pr against go glfw :) Feel free to close this issue if needed as the changes takes place in hover anyway. A quick note on this is more of an advanced use case simplified down, as this can be achived by hand, so its somewhat targets developers who intend to use go and flutter on devices which are not common targets like the rpi or smart devices. I hope when its done it can be used within the docker setup as well with an ease. I can share a gist if needed with the changes i made for an early preview if anyone interested in it. |
Could you upload your code on a new branch in your hover fork? Then we could see the progress as you work on it. And this issue should be kept open. |
I am not a specific developer, so I am not familiar with the specific implementation methods. But now Flutter has some third-party arm implementations For example, this https://github.com/sony/flutter-elinux What I want to ask is, is it possible to combine this project and complete the construction of arm/arm64 Or refer to its implementation direction. This project should appear after all the above conclusions |
This is a placeholder issue to track hover build and cross compile changes discussed in #128.
Proposal:
List of steps.
Proposed arguments
- target
<arch><sub>-<vendor>-<sys>-<abi>
Description: Describes the target as a triplet.
Format: The triple has the general format
<arch><sub>-<vendor>-<sys>-<abi>
where:Use case: Whenever the target triple is given it can describe the target system and the compiler/linker setup needed. Therefor adding ability to run it on any system.
(Disclaimer: It's up to the developer to make sure he is able to compile to the target and that target is a valid system for flutter to use. Eg: libdl, libpthread, librt, libm must be present for flutter engine.)
Example values: armv7-linux-gnueabi, armv7-linux-gnueabihf, x86_64-linux-eabi
Behavior: By default, if no other options given, it will translate the value given to GOOS, GOARCH, GOARM and validate it (not all permutations are valid), if the base set or host os does not support it should warn the user to specify the docker flag.
If the toolchain arguments is given, this will specify the gcc/g++ (might be clang or other compilers) to use.
An example would be:
- toolchain
path/to/toolchain
Description: Describes the CC used by go.
Format: Absolute path.
Use case: Adding custom toolchains for custom target systems.
Example values: /opt/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi
Behavior: By default it does set CC to a gcc/g++/clang etc found in path + /bin/gcc, if target is specified it would suffix the target triple to the gcc binary, as it would be path + /bin/arm-linux-gnueabi-gcc, if the compiler is presented in the environment it might be skipped.
(Disclaimer: if the toolchain path is set, and it is desired to use a sysroot with it, it's up to the developer to either compile the toolchain with support for it, or set the compile flags with-sysroot)
- cflags/cxxflags
Description: Adds CFLAGS/CXXFLAGS to the compilation steps
Format: Any supported flags by the compiler.
Use case: It might be needed if the target needs custom flags, an example would be nacl which requires some flags to use, an other would be the runtime set or std set to use.
Example values:
--sysroot=/path/to/sysroot --std=c90
Behavior: By default this should not be used, but custom targets might require this.
- ldflags
Description: Adds LDFLAGS to the linker steps
Format: Any supported flags by the linker.
Use case: It might be needed if the target needs custom flags, as an example setting a custom rpath, or for other use cases where the system would have example glfw already installed and the user would rather use that then the compiled one.
Example values:
-rpath,/lib/
Behavior: By default this should not be used, but custom targets might require this.
- local-engine-path
/engine/src
Description: Describes the path for the local engine setup for use.
Format: Absolute path.
Use case: When we want to target a custom target, it requires the flutter_engine to be built for that target as well. Therefore it can be linked to the binary.
Example values:
/engine/src
${FLUTTER_ROOT}/../engine/src
Behavior: It would use the artifact from this directory, it comes with a pair arguments
-local-engine
to narrow down which build the user wants, since the flutter tool requires the engine built for the host (host_debug, host_debug_unopt, host_release, host_release_jit) to be present for bundling. It should point only to the engine src, by default as flutter/engine states it's a peer directory to flutter so we could assume that. Otherwise hover might have a new command to support the whole local engine setup. I'll write about it later in the discussion.- local-engine
host_debug_unopt
Description: Describes which artifact directory should be used.
Format: Sub path name for the out directory.
Use case: When we want to target a custom target, it requires the flutter_engine to be built for that target as well. Therefore it can be linked to the binary.
Example values:
host_debug_unopt, linux_release_jit
Behavior: It should specify which artifact directory will be used, it contains all the necessary files for the embedder to work. Including the engine library, icu and headers.
- tags
gles2
Description: As far as we depend on glfw at the moment it's not mandatory to have this. It would allow to specify build tags for later use cases.
Format: Space separated strings.
Use case: An example use case is when we would like to target a system with specific requirements, like it should use OpenGL ES 2, and use Wayland. This is for now a specific mention for glfw. SDL does this at runtime. Custom drivers might need it or not.
Example values:
gles3 wayland
Behavior: It propagates down build tags for dependencies and for our own ones.
- output
/path/to/output
Description: A path for the output binary and assets to land in.
Format: Absolute or relative path.
Use case: Since we might have different targets, we might need a different output directory. And don't want to pollute the working dir.
Example values:
../custom-output
Behavior: It should create the given folder and copy the necessary assets (icu, engine) to it, and build the flutter bundle to this folder. This folder should be used as a cache, if it already contains the engine or icu, it matches the artifact directory given then we should not call any copy or recompile step. Recompile steps might be involved when the local engine changes.
Proposed sanity checks.
Proposed refactor on high level.
Other notes:
we could use depot tools, and flutter tool to create an unmanaged local engine, with the revision specified by the tool, making sure about version parity.
I'll extend this in the following days and rewrite some parts, so this is a subject to change by itself and by other inputs from you.
The text was updated successfully, but these errors were encountered: