-
Notifications
You must be signed in to change notification settings - Fork 82
Initial cross-compiling support #23
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
Initial cross-compiling support #23
Conversation
Also documentation needs to be created |
Tested out on a Linux host trying to compile windows app, it worked great! On the first run, the compilation didn't reach the end (don't know why) but on the second First Run ouput (clickable)
OH mb, on first run it did reach the end and produce a valid windows app! (echo $? == 0). |
Wow I've tested the cross-compiled app on another windows laptop, it's insane, it works as expected. The flutter app was using multiple plug-in including the sqlite one. I'm very very impressed! |
With empty go-build cache cross-compiling takes about 3 minutes for me and the second run it only takes about 17 seconds. |
@Drakirus did you test if the normal compiling for windows still works? I'm afraid I broke something. |
I'll just wait for @GeertJohan to finish (no pressure lol) code review and the fix the issues on the code. |
For cross-Compiling & for normal compiling.
No I haven't tested. I've tested the generated MacOS build and it also work great (except the DPI..) The PC ans Mac aren't mine, I cannot install flutter and hover.. |
the Just add a check to ensure |
We could just set a environment variable using Docker run and check in the command in the Dockerfile if that environment variable is set to debug. |
Can we have a |
Yep, I'm fine with that! |
Oh that's interesting. Do you think distributing using for example a deb repository would be worth the effort? Interesting would be which people use go-flutter and which people the binary distribution would help? |
Some scenarios I can think of:
Maybe a flag is not needed? But I think for convenience the flag should be added |
I don't know, maybe a |
From your list of scenarios, all excepted I'm down for the |
But we would also need to add a .bat install script :( |
|
Even when the user is not using hover with the cross-compilation feature?
related to Personally I think the missing behavior/feature in this PR are:
|
Yes
But only if docker is found? Would be bad if someone thinks the can't build, because the would need docker and not just go installed. I would only set it if docker is available and if none of the showing a message that the user could install docker or go
I was thinking about making |
It's not for cross-running (I don't want to mess with wine and others...) it only for building the linux app on the linux host using docker/go instead of host/go. This way we can have Maybe we shouldn't name the flag Concerning:
It doesn't allow you to switch between |
Ok I understand what you mean. I would also prefer |
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.
If you add:
--docker
flag- docker go build
main.vmArguments
through environment variables
It's good for me, the docker fallback can be done later.
@Drakirus should |
Yes, as the the build generated by |
@Drakirus Shipping hover as standalone binary with just docker as dependency is currently not possible, because |
That didn't work, because the go API for command execution doesn't like inline environment variables, but I just created seperate Dockerfiles for the different build modes. I also implemented the Docker fallback which was really easy |
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.
👍 awesome job!
@jld3103 WoW awesome work dude! |
🚀 |
@jld3103 fantastic stuff. |
} | ||
dockerFileContent := []string{ | ||
"FROM dockercore/golang-cross", | ||
"RUN apt-get install libgl1-mesa-dev xorg-dev -y", |
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.
@GeertJohan So i'm failing on this due to wayland :)
This PR add support for cross-compiling on any machine with docker installed.
How it works:
If the target OS doesn't match the machine's OS a Docker container is created and builds the app using the cross-compiling tools installed in the container.
Tests needed to be done before merging:
Currently a temporary Dockerfile is created, but could be redundant if the build command gets correctly escaped. That would be no change for the user or performance, but the could would be smaller.
Please test if you have the machine(s) needed for the tests.