ProtonMail / proton-bridge

Proton Mail Bridge application
GNU General Public License v3.0
1.14k stars 155 forks source link

Unable to build and missing dependency #20

Closed A6GibKm closed 4 years ago

A6GibKm commented 4 years ago

When building on fedora 32 I get the issue /usr/bin/ld: cannot find -lGL, this is fixed by installing libGL.so, which should be listed in BUILDS.md. In the particular case of fedora it is provided by libglvnd-devel.

After fixing this issue it will give the error

/usr/bin/go
go install -v -tags=no_env github.com/therecipe/qt/cmd/...
go mod vendor
github.com/ProtonMail/proton-bridge/internal/frontend/qt imports
    github.com/therecipe/qt/core imports
    github.com/therecipe/qt imports
    syscall/js: package syscall/js is not in GOROOT (/usr/src/syscall/js)
make: *** [Makefile:94: prepare-vendor] Error 1

The error persists if I set GOROOT=/usr/lib/golang which is where syscall/js is.

A6GibKm commented 4 years ago

I also get

go mod vendor
ln -sf /var/home/deathwish/src/proton-bridge/vendor-cache/github.com/therecipe/env_linux_amd64_513 vendor/github.com/therecipe/env_linux_amd64_513
rm -rf deploy linux cmd/Desktop-Bridge/deploy
cp cmd/Desktop-Bridge/main.go .
qtdeploy -tags='pmapi_prod' -ldflags '-X main.Version=32 -X main.(Container -X main.Image) -X main.Revision=409abba995 -X main.BuildTime=2020-04-20T01:50:52-0400' build desktop
ERRO[0061] failed to run command                         _func=RunCmd cmd="go build -p 8 -v -ldflags=all=\"-s\" \"-w\" \"-X\" \"main.Version=32\" \"-X\" \"main.(Container\" \"-X\" \"main.Image)\" \"-X\" \"main.Revision=409abba995\" \"-X\" \"main.BuildTime=2020-04-20T01:50:52-0400\" -trimpath -o /var/home/deathwish/src/proton-bridge/deploy/linux/proton-bridge -tags=minimal,pmapi_prod" dir=/var/home/deathwish/src/proton-bridge env="TERM=xterm-256color GOPATH=/var/home/deathwish/.local/share/go COLUMNS=173 GO111MODULE=on XDG_DATA_DIRS=/var/home/deathwish/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/ FGC=f32 GEM_HOME=/var/home/deathwish/.local/share/gem GEMRC=/var/home/deathwish/.config/gem/config JUPYTER_CONFIG_DIR=/var/home/deathwish/.config/jupyter MAKEFLAGS= LANG=C.UTF-8 CGO_ENABLED=1 _=/usr/bin/make ANDROID_SDK_HOME=/var/home/deathwish/.config/android HOME=/var/home/deathwish WAYLAND_DISPLAY=wayland-0 INPUTRC=/var/home/deathwish/.config/readline/inputrc HOSTNAME=toolbox SHLVL=1 MFLAGS= MAKE_TERMERR=/dev/pts/2 ICEAUTHORITY=/var/home/deathwish/.cache/ICEauthority COLORTERM=truecolor RANDFILE=/var/home/deathwish/.cache/openssl/rnd SHELL=/bin/bash _JAVA_OPTIONS=-Djava.util.prefs.userRoot=/var/home/deathwish/.config/java DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus GEM_SPEC_CACHE=/var/home/deathwish/.cache/gem HISTFILE=/var/home/deathwish/.config/bash/history BUNDLE_USER_PLUGIN=/var/home/deathwish/.local/share/bundle XDG_CONFIG_HOME=/var/home/deathwish/.config JRE_HOME=/var/home/deathwish/.config/jre ZDOTDIR=/var/home/deathwish/.config/zsh DISTTAG=f32container BUNDLE_USER_CACHE=/var/home/deathwish/.cache/bundle VSCODE_EXTENSIONS=/var/home/deathwish/.local/share/vscode-oss/extensions PYTHONPATH=:/var/home/deathwish/src/python GOFLAGS=-mod=vendor WGETRC=/var/home/deathwish/.config/wgetrc NUGET_PACKAGES=/var/home/deathwish/.cache/NuGetPackages XDG_RUNTIME_DIR=/run/user/1000 LESSKEY=/var/home/deathwish/.config/less/lesskey BASH_COMPLETION_USER_FILE=/var/home/deathwish/.config/bash-completion/bash_completion PATH=/usr/lib/golang/bin:/var/home/deathwish/.local/share/pyenv/shims:/var/home/deathwish/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/home/deathwish/.local/share/cargo/bin:/var/home/deathwish/.local/share/node/bin:/var/home/deathwish/.local/share/gem/bin:/var/home/deathwish/.local/share/go/bin:/var/home/deathwish/.local/share/npm/bin:/var/home/deathwish/.local/share/luarocks/bin:/var/home/deathwish/.emacs.d/.local/etc/mspyls:/var/home/deathwish/.local/share/pyenv/bin:/var/home/deathwish/.local/share/go/bin/ GOARCH=amd64 DESKTOP_SESSION=gnome XDG_SESSION_TYPE=wayland NAME=Fedora OLDPWD=/var/home/deathwish SAVEHIST=10000 NO_PROXY=localhost,127.0.0.0/8,::1 USER=deathwish QT_DIR=/var/home/deathwish/src/proton-bridge/vendor/github.com/therecipe/env_linux_amd64_513 LESSHISTFILE=/var/home/deathwish/.cache/less/history MAKELEVEL=1 CCACHE_DIR=/var/home/deathwish/.cache/ccache PYENV_ROOT=/var/home/deathwish/.local/share/pyenv PYENV_SHELL=bash XDG_CURRENT_DESKTOP=GNOME MAIL=/var/spool/mail/deathwish MAKE_TERMOUT=/dev/pts/2 GOROOT=/usr/lib/golang IPYTHONDIR=/var/home/deathwish/.config/jupyter XDG_SESSION_DESKTOP=gnome HISTSIZE=4000 XDG_MENU_PREFIX=gnome- DISPLAY=:0 container=oci XDG_CACHE_HOME=/var/home/deathwish/.cache GNUPGHOME=/var/home/deathwish/.local/share/gnupg XDG_DATA_HOME=/var/home/deathwish/.local/share SHARE_HISTORY=true CARGO_HOME=/var/home/deathwish/.local/share/cargo GOOS=linux LINES=43 HISTCONTROL=ignoredups GTK_THEME=Adwaita-dark PWD=/var/home/deathwish/src/proton-bridge PYLINTHOME=/var/home/deathwish/.cache/pylint CGO_LDFLAGS=-Wl,-rpath,$ORIGIN/lib -Wl,--disable-new-dtags VERSION=32 (Container Image) LS_COLORS=rs=0:di=38;5;33:ln=38;5;51:mh=00:pi=40;38;5;11:so=38;5;13:do=38;5;5:bd=48;5;232;38;5;11:cd=48;5;232;38;5;3:or=48;5;232;38;5;9:mi=01;37;41:su=48;5;196;38;5;15:sg=48;5;11;38;5;16:ca=48;5;196;38;5;226:tw=48;5;10;38;5;16:ow=48;5;10;38;5;21:st=48;5;21;38;5;15:ex=38;5;40:*.tar=38;5;9:*.tgz=38;5;9:*.arc=38;5;9:*.arj=38;5;9:*.taz=38;5;9:*.lha=38;5;9:*.lz4=38;5;9:*.lzh=38;5;9:*.lzma=38;5;9:*.tlz=38;5;9:*.txz=38;5;9:*.tzo=38;5;9:*.t7z=38;5;9:*.zip=38;5;9:*.z=38;5;9:*.dz=38;5;9:*.gz=38;5;9:*.lrz=38;5;9:*.lz=38;5;9:*.lzo=38;5;9:*.xz=38;5;9:*.zst=38;5;9:*.tzst=38;5;9:*.bz2=38;5;9:*.bz=38;5;9:*.tbz=38;5;9:*.tbz2=38;5;9:*.tz=38;5;9:*.deb=38;5;9:*.rpm=38;5;9:*.jar=38;5;9:*.war=38;5;9:*.ear=38;5;9:*.sar=38;5;9:*.rar=38;5;9:*.alz=38;5;9:*.ace=38;5;9:*.zoo=38;5;9:*.cpio=38;5;9:*.7z=38;5;9:*.rz=38;5;9:*.cab=38;5;9:*.wim=38;5;9:*.swm=38;5;9:*.dwm=38;5;9:*.esd=38;5;9:*.jpg=38;5;13:*.jpeg=38;5;13:*.mjpg=38;5;13:*.mjpeg=38;5;13:*.gif=38;5;13:*.bmp=38;5;13:*.pbm=38;5;13:*.pgm=38;5;13:*.ppm=38;5;13:*.tga=38;5;13:*.xbm=38;5;13:*.xpm=38;5;13:*.tif=38;5;13:*.tiff=38;5;13:*.png=38;5;13:*.svg=38;5;13:*.svgz=38;5;13:*.mng=38;5;13:*.pcx=38;5;13:*.mov=38;5;13:*.mpg=38;5;13:*.mpeg=38;5;13:*.m2v=38;5;13:*.mkv=38;5;13:*.webm=38;5;13:*.webp=38;5;13:*.ogm=38;5;13:*.mp4=38;5;13:*.m4v=38;5;13:*.mp4v=38;5;13:*.vob=38;5;13:*.qt=38;5;13:*.nuv=38;5;13:*.wmv=38;5;13:*.asf=38;5;13:*.rm=38;5;13:*.rmvb=38;5;13:*.flc=38;5;13:*.avi=38;5;13:*.fli=38;5;13:*.flv=38;5;13:*.gl=38;5;13:*.dl=38;5;13:*.xcf=38;5;13:*.xwd=38;5;13:*.yuv=38;5;13:*.cgm=38;5;13:*.emf=38;5;13:*.ogv=38;5;13:*.ogx=38;5;13:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: LOGNAME=deathwish BUNDLE_USER_CONFIG=/var/home/deathwish/.config/bundle RADV_PERFTEST=aco VTE_VERSION=6001 JAVA_HOME=/var/home/deathwish/.config/java CCACHE_CONFIGPATH=/var/home/deathwish/.config/ccache.config NPM_CONFIG_USERCONFIG=/var/home/deathwish/.config/npm/npmrc LESSOPEN=||/usr/bin/lesspipe.sh %s SSH_AUTH_SOCK=/run/user/1000/keyring/ssh TOOLBOX_PATH=/usr/bin/toolbox no_proxy=localhost,127.0.0.0/8,::1 NODE_HOME=/var/home/deathwish/.local/share/node" error="exit status 2" name="build for linux on linux"
# github.com/therecipe/qt/widgets
widgets-minimal.cpp: In function ‘void* QDesktopWidget_AvailableGeometry(void*, int)’:
widgets-minimal.cpp:1265:88: warning: ‘const QRect QDesktopWidget::availableGeometry(int) const’ is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations]
 1265 |  return ({ QRect tmpValue = static_cast<QDesktopWidget*>(ptr)->availableGeometry(screen); new QRect(tmpValue.x(), tmpValue.y(), tmpValue.width(), tmpValue.height()); });
      |                                                                                        ^
In file included from /var/home/deathwish/src/proton-bridge/vendor/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtWidgets/QDesktopWidget:1,
                 from widgets-minimal.cpp:18:
/var/home/deathwish/src/proton-bridge/vendor/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtWidgets/qdesktopwidget.h:88:67: note: declared here
   88 |     QT_DEPRECATED_X("Use QGuiApplication::screens()") const QRect availableGeometry(int screen = -1) const;
      |                                                                   ^~~~~~~~~~~~~~~~~
widgets-minimal.cpp: In function ‘int QDesktopWidget_PrimaryScreen(void*)’:
widgets-minimal.cpp:1275:58: warning: ‘int QDesktopWidget::primaryScreen() const’ is deprecated: Use QGuiApplication::primaryScreen() [-Wdeprecated-declarations]
 1275 |  return static_cast<QDesktopWidget*>(ptr)->primaryScreen();
      |                                                          ^
In file included from /var/home/deathwish/src/proton-bridge/vendor/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtWidgets/QDesktopWidget:1,
                 from widgets-minimal.cpp:18:
/var/home/deathwish/src/proton-bridge/vendor/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtWidgets/qdesktopwidget.h:73:65: note: declared here
   73 |     QT_DEPRECATED_X("Use QGuiApplication::primaryScreen()") int primaryScreen() const;
      |                                                                 ^~~~~~~~~~~~~
widgets-minimal.cpp: In function ‘void* QDesktopWidget_Screen(void*, int)’:
widgets-minimal.cpp:1280:57: warning: ‘QWidget* QDesktopWidget::screen(int)’ is deprecated: Use QScreen [-Wdeprecated-declarations]
 1280 |  return static_cast<QDesktopWidget*>(ptr)->screen(screen);
      |                                                         ^
In file included from /var/home/deathwish/src/proton-bridge/vendor/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtWidgets/QDesktopWidget:1,
                 from widgets-minimal.cpp:18:
/var/home/deathwish/src/proton-bridge/vendor/github.com/therecipe/env_linux_amd64_513/5.13.0/gcc_64/include/QtWidgets/qdesktopwidget.h:77:45: note: declared here
   77 |     QT_DEPRECATED_X("Use QScreen") QWidget *screen(int screen = -1);
      |                                             ^~~~~~
github.com/ProtonMail/proton-bridge/internal/frontend/qt
github.com/ProtonMail/proton-bridge/internal/frontend
# github.com/ProtonMail/proton-bridge
/usr/lib/golang/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value

make: *** [Makefile:62: cmd/Desktop-Bridge/deploy/linux/proton-bridge] Error 1
ciehanski commented 4 years ago

Just curious, what does echo $GOPATH output?

A6GibKm commented 4 years ago

Nothing, I have to set it manually. I have tried exporting it to $(pwd)/cache or ~/.local/share/go and I get the above error when running qtdeploy

jameshoulahan commented 4 years ago

You are correct that libglvnd-devel is a dependency, missing by default on fedora. I will ensure that's added to BUILDS.md.

I just set up a freshly installed Fedora 32 VM and make build ran perfectly fine, producing a working bridge with GUI. It is fascinating that you are having such issues.

Could you please post the output of go env?


For reference, this is what I ran on the freshly installed Fedora 32 VM to build bridge:

$ git clone https://github.com/ProtonMail/proton-bridge
$ cd proton-bridge
$ sudo yum install make go g++ libglvnd-devel libsecret-devel
$ PATH=~/go/bin:$PATH make build
A6GibKm commented 4 years ago

Thats weird, I am using a toolbox container, maybe thats the issue. Thanks I will report later.

A6GibKm commented 4 years ago

I created a new toolbox without .bashrc. The error is the same

   77 |     QT_DEPRECATED_X("Use QScreen") QWidget *screen(int screen = -1);
      |                                             ^~~~~~
github.com/ProtonMail/proton-bridge/internal/frontend/qt
github.com/ProtonMail/proton-bridge/internal/frontend
# github.com/ProtonMail/proton-bridge
/usr/lib/golang/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value

make: *** [Makefile:62: cmd/Desktop-Bridge/deploy/linux/proton-bridge] Error 1

full log and go env in the following paste https://paste.centos.org/view/26c0946e

jameshoulahan commented 4 years ago

I see that something went wrong while generating the ld flags. On your system, the makefile executes the following command:

qtdeploy -tags='pmapi_prod' -ldflags '-X main.Version=32 -X main.(Container -X main.Image) -X main.Revision=409abba995 -X main.BuildTime=2020-04-22T12:00:12-0400' build desktop

while on my system, I get this:

qtdeploy -tags='pmapi_prod' -ldflags '-X main.Version=1.2.6-git -X main.Revision=409abba995 -X main.BuildTime=2020-04-22T18:17:43+0200' build desktop

As you can see, you have main.(Container -X main.Image) added in there; this is incorrect syntax and causes the error.

This is because VERSION is being set to 32 (Container Image) rather than 1.2.6-git; the addprefix in the makefile adds prefixes split by whitespace and thus adds the prefix main. to each word.

Have you modified the makefile in any way? Or, why is VERSION changing? Perhaps you could explicitly override the VERSION environment variable (setting to something not containing spaces) before invoking make build

A6GibKm commented 4 years ago

No, I am using the exact chain of commands that you sent me.

Using a fedora 32 container from podman, with a small difference on sudo dnf install make go g++ libglvnd-devel libsecret-devel git which it builded correctly.

On the toolbox side, using VERSION=1.2.6-git PATH=~/go/bin:$PATH make build did the trick.

Thanks for the help.

Note that Fedora 32 (Desktop), Fedora Silverblue 32.20200420.n.0 (Silverblue) and Fedora toolbox 32 (Container) use the VERSION env variable, but the container and vm image do not, this explains why it builds in a vm or in a podman container, I will report this upstream but I also think that this might be a bad name for the variable.

jameshoulahan commented 4 years ago

Ah that explains it! I wasn't aware of the VERSION envvar being set by default on those distros/environments.

I agree we should change the name of the VERSION envvar to something more specific so as to not have a chance at conflicting.

As both of your initial issues have been resolved (changes will appear in this repository soon), I will close this issue now.