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

Any instreuctions on how to build? #4

Open
molaeiali opened this issue Oct 18, 2024 · 5 comments
Open

Any instreuctions on how to build? #4

molaeiali opened this issue Oct 18, 2024 · 5 comments

Comments

@molaeiali
Copy link

Is there any instructions on how to build and what are the dependencies?

@antermin
Copy link

Maybe it can be built like this?

pkgname=python-proton-vpn-local-agent
pkgver=1.0.0
pkgrel=1
pkgdesc="Proton VPN local agent written in Rust"
arch=('x86_64')
url="https://github.com/ProtonVPN/local-agent-rs"
license=("GPL3")
groups=("ProtonVPN")
depends=('python')
makedepends=('cargo')
source=("https://github.com/ProtonVPN/local-agent-rs/archive/01332194d217d91a514ecaebcdfbfa3d21ccd1ed.tar.gz")
sha256sums=('SKIP')

prepare() {
    mv "$srcdir/local-agent-rs-01332194d217d91a514ecaebcdfbfa3d21ccd1ed" "$srcdir/local-agent-rs-${pkgver}"
}

build() {
    cd "$srcdir/local-agent-rs-${pkgver}/python-proton-vpn-local-agent"
    cargo build --release
}

package() {
    mkdir -p "$pkgdir/usr/lib/python3.12/site-packages/proton/vpn"
    cp "$srcdir/local-agent-rs-${pkgver}/python-proton-vpn-local-agent/target/release/libpython_proton_vpn_local_agent.so" "$pkgdir/usr/lib/python3.12/site-packages/proton/vpn/local_agent.abi3.so"
}

@molaeiali
Copy link
Author

I've managed to package it: https://aur.archlinux.org/packages/python-proton-vpn-local-agent

How ever if I install it, opening the setting page on protonvpn-app causes this error:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/proton/vpn/app/gtk/widgets/headerbar/menu/settings/settings_window.py", line 83, in _build_ui
    self._connection_settings.build_ui()
  File "/usr/lib/python3.12/site-packages/proton/vpn/app/gtk/widgets/headerbar/menu/settings/connection_settings.py", line 60, in build_ui
    self.build_protocol()
  File "/usr/lib/python3.12/site-packages/proton/vpn/app/gtk/widgets/headerbar/menu/settings/connection_settings.py", line 70, in build_protocol
    for protocol in self._controller.get_available_protocols()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/proton/vpn/app/gtk/controller.py", line 363, in get_available_protocols
    available_protocols = self._connector.get_available_protocols_for_backend(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/proton/vpn/core/connection.py", line 338, in get_available_protocols_for_backend
    supported_protocols = Loader.get_all(backend_class.backend)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/proton/loader/loader.py", line 180, in get_all
    self.__known_types[type_name][ep.name] = ep.load()
                                             ^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/proton/vpn/backend/linux/networkmanager/protocol/wireguard/__init__.py", line 22, in <module>
    from .wireguard import Wireguard
  File "/usr/lib/python3.12/site-packages/proton/vpn/backend/linux/networkmanager/protocol/wireguard/wireguard.py", line 40, in <module>
    from proton.vpn.backend.linux.networkmanager.protocol.wireguard.local_agent \
  File "/usr/lib/python3.12/site-packages/proton/vpn/backend/linux/networkmanager/protocol/wireguard/local_agent/__init__.py", line 28, in <module>
    from .external_local_agent import (
  File "/usr/lib/python3.12/site-packages/proton/vpn/backend/linux/networkmanager/protocol/wireguard/local_agent/external_local_agent.py", line 22, in <module>
    import proton.vpn.local_agent  # pylint: disable=import-error, no-name-in-module
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: /usr/lib/python3.12/site-packages/proton/vpn/local_agent.abi3.so: undefined symbol: aws_lc_0_20_1_EVP_sha3_256
^CTraceback (most recent call last):
  File "/usr/bin/protonvpn-app", line 33, in <module>
    sys.exit(load_entry_point('proton-vpn-gtk-app==4.7.1', 'console_scripts', 'protonvpn-app')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/proton/vpn/app/gtk/__main__.py", line 36, in main
    sys.exit(App(controller).run(sys.argv))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/gi/overrides/Gio.py", line 40, in run
    with register_sigint_fallback(self.quit):
  File "/usr/lib/python3.12/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/usr/lib/python3.12/site-packages/gi/_ossighelper.py", line 239, in register_sigint_fallback
    signal.default_int_handler(signal.SIGINT, None)

I can confirm that when building it, I see Compiling aws-lc-sys v0.20.1 but this line is in the error log anyway:

ImportError: /usr/lib/python3.12/site-packages/proton/vpn/local_agent.abi3.so: undefined symbol: aws_lc_0_20_1_EVP_sha3_256

@antermin
Copy link

antermin commented Nov 5, 2024

Note that the latest version of python-proton-vpn-network-manager requires python-proton-vpn-local-agent>=1.1.0:
ProtonVPN/python-proton-vpn-network-manager@v0.9.1...v0.9.4

But apparently this repo has not been updated yet, even though binaries for 1.1.4 are available: #5

@molaeiali
Copy link
Author

I built 9cc170b (1.1.4) this commit as well but the issue is not resolved for me with that as well

@lainedfles
Copy link

lainedfles commented Nov 29, 2024

@molaeiali Thanks for your efforts with your AUR packages. I've made an AUR comment demonstrating a PKGBUILD version that works on my systems.

I can confirm that protonvpn-app loads the shared object without error in the settings (strace):

[pid 137380] newfstatat(AT_FDCWD, "/usr/lib/python3.12/site-packages/proton/vpn", {st_mode=S_IFDIR|0755, st_size=134, ...}, 0) = 0
[pid 137380] newfstatat(AT_FDCWD, "/usr/lib/python3.12/site-packages/proton/vpn/local_agent.abi3.so", {st_mode=S_IFREG|0755, st_size=5500944, ...}, 0) = 0
[pid 137380] openat(AT_FDCWD, "/usr/lib/python3.12/site-packages/proton/vpn/local_agent.abi3.so", O_RDONLY|O_CLOEXEC) = 26

I can also re-produce a similar error by truncating it (sudo truncate -s0 /usr/lib/python3.12/site-packages/proton/vpn/local_agent.abi3.so).

The Archlinux Rust Package Guidelines mention setting the following environment variable within the PKGBUILD but I've omitted it purposefully since it may be desired to build with an experimental version.

export RUSTUP_TOOLCHAIN=stable

If you're using rustup, you might try building with this variable.

Update

Per my comment on the AUR, the problem is caused by the Archlinux link time optimization: builds succeed with only options=(!lto) but because we build with cargo --release, it doesn't make sense to add additional debug buildflags. I've updated the PKGBUILD in my prior comment to include: options=(!debug !lto)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants