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

Build from source #28

Open
A6GibKm opened this issue Apr 21, 2020 · 18 comments
Open

Build from source #28

A6GibKm opened this issue Apr 21, 2020 · 18 comments
Labels
help wanted Extra attention is needed

Comments

@A6GibKm
Copy link
Collaborator

A6GibKm commented Apr 21, 2020

The source for protonmail-bridge has recently ben released at github.com/ProtonMail/proton-bridge.

I am not familiar to building packages using golang, any help would be appreciated, this might fix issues related to the build being created with libraries older than the ones provided by the flatpak runtime.

@A6GibKm A6GibKm added the help wanted Extra attention is needed label Apr 21, 2020
@tristan957
Copy link

@A6GibKm I am familiar with Go and can help you out.

@tristan957
Copy link

tristan957 commented May 4, 2020

So first thing is we need to probably start using the icons provided by the repository instead of the svg in this repo, unless for some reason you wanted to keep it.

After that, all you need is to run go build after adding the bridge repo as a source. Does not look like they have releases just yet. All your Go dependencies will be fetched automatically and you will end up with a statically linked binary (most likely). If any of the dependencies wrap C libs, they may be dynamically linked. Unsure on that part.

@A6GibKm
Copy link
Collaborator Author

A6GibKm commented May 4, 2020

The icon is generated when buidling as far as I remember, currently I am using the one in this repo because the one that comes in the debfile cannot be put in \app because it is part of extra-data. A temporal solution could be to use https://github.com/ProtonMail/proton-bridge/blob/master/internal/frontend/share/icons/logo.svg, but that path could change and using an specific commit is no better than the current solution.

On the go side, as I understand it flatpak-builder builds without internet so you have to manually add sources for all dependencies and put them in a path where go knows they are installed.

besides the go libs, libGL.so is also needed, idk if the runtime bundles it.

@tristan957
Copy link

I spent most of the night working on it and I have to say this is the worst tech stack in the world. I have built electron and it was easier than this. I'll keep trying tomorrow but my god I am running out of ideas and the proton-bridge repo has zero instructions for building as far as I can tell. Great software all around.

@A6GibKm
Copy link
Collaborator Author

A6GibKm commented May 4, 2020

Well the instructions are make build, which do work after pulling a few dependencies. Here is how I build it https://github.com/A6GibKm/protonmail-bridge.spec/blob/master/protonmail-bridge.spec (note that the rpm doesn't work since I am not installing in the system all the Qt libs that are generated together with protonmail-bridge).

Also note that the installer will use the env variable VERSION which should be set to 1.2.6 or the like, and will fail if it contains spaces, which is the case of Fedora (workstation, silverblue, toolbox but NOT the container image).

@tristan957
Copy link

It is tough because you have to vendor the go dependencies for flatpak, which is really annoying with the way therecipe/qt works.

@A6GibKm
Copy link
Collaborator Author

A6GibKm commented May 6, 2020

Here therecipe/qt is builded, it migth help.

@MatMaul
Copy link

MatMaul commented May 14, 2020

The easiest would be that the authors provides all the vendor dependencies in the release tarball, when they do one, otherwise it will be a nightmare. I will open a ticket.

@sergeyklay
Copy link
Contributor

Could someone explain me what is the difficulty? I have compile protonmail bridge many times on my machine (Gentoo) and have never experienced any issue. By the way, all dependencies are defined here: https://github.com/ProtonMail/proton-bridge/blob/master/go.sum

@tristan957
Copy link

Building in Flatpak is the issue

@A6GibKm
Copy link
Collaborator Author

A6GibKm commented Sep 16, 2020

To build a flatpak you don't have internet during the process. So you have to specify everything that will be downloaded prior to the m̀ake part, this might not pair very well with certain make files.

On the other hand go packaging is a mess and I don't know much go anyways. The bridge builds the entire Qt stack so that might be hard to track in terms of dependencies. If I were a little more comfortable with go modules I would try this again, but for the moment I haven't found the time.

Again, I would highly appreciate if someone makes some progress.

@sergeyklay
Copy link
Contributor

@A6GibKm
Copy link
Collaborator Author

A6GibKm commented Sep 16, 2020

I will look at it later, the problem is not making a manifest with the ~300 modules (listed in your link) and their respective hashes/commits etc, but knowing what to do with those, and for the time being go modules are a mystery to me.

@A6GibKm
Copy link
Collaborator Author

A6GibKm commented Sep 18, 2020

Some progress at #46. What is missing is to add sources to the manifest. I am not able to get docker-credential-helpers tho

go install -v -tags=no_env github.com/therecipe/qt/cmd/...
go: github.com/ProtonMail/[email protected]: Get "https://proxy.golang.org/github.com/%21proton%21mail/docker-credential-helpers/@v/v1.1.0.mod": dial tcp: lookup proxy.golang.org on 10.43.255.252:53: dial udp 10.43.255.252:53: connect: network is unreachable
make: *** [Makefile:112: prepare-vendor] Error 1
Error: module protonmail-bridge: Child process exited with code 2

@Avamander
Copy link

Any progress with this, or was it too difficult to achieve?

@A6GibKm
Copy link
Collaborator Author

A6GibKm commented Feb 16, 2021

None. More than difficult I lack the knowledge for distributing a go program, but it certainly is not straightforward.

@tristan957
Copy link

ProtonMail needs to come forward and support the Flatpak distribution. The bridge project is just too much work to distribute from source. Their Go/Qt toolchain is so hard to work with. People using Go + Qt must hate themselves.

@julianfairfax
Copy link

If this is big concern, it's relatively easy to build the CLI version of Proton Bridge. I also have this automated (may only work on Debian, needs testing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants