manuels / wg-p2p-nm-plugin

A NetworkManager VPN plugin for WireGuard
9 stars 2 forks source link

Questions on how to build this project #1

Open depau opened 6 years ago

depau commented 6 years ago

Hello, I was looking for a NM integration for WireGuard and stumbled upon this repo. The problem is I never dealed with Rust before and have no idea how it works. I looked at Cargo.toml and noticed it expects gdbus-rs in the parent directory. Well okay, I cloned it, but I got dependency issues.

I fiddled around with version numbers and then include paths, and eventually it stopped complaining (fyi I'm using Arch Linux):

gdbus-rs

diff --git a/Cargo.toml b/Cargo.toml
index 28affd7..59addeb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +14,4 @@ gobject-sys = "0.5.0"

 [dev-dependencies]
 log = "^0.3.6"
-
-[dev-dependencies.gtk]
-git = "https://github.com/gtk-rs/gtk"
-version = "0.3.0"
+gtk = "0.3.0"

wg-p2p-nm-plugin

diff --git a/Cargo.toml b/Cargo.toml
index dd663da..e87ccfb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,21 +16,24 @@ path = "src/service/service.rs"
 cc = "*"

 [dependencies]
-gtk = "*"
-gio-sys = "*"
+gtk = "0.3.0"
+gio-sys = "0.5.0"
 gtk-sys = "*"
 libc = "*"
 docopt = "*"

-glib = "*"
-gdk = "*"
-gobject-sys = "*"
+glib = "0.4.0"
+gdk = "0.7.0"
+gobject-sys = "0.5.0"
 #gdbus = { git = "https://github.com/manuels/gdbus-rs" }
 gdbus = { path = "../gdbus-rs" }
 drunken_bishop = "*"
 crslmnl = "*"
 time = "*"

+[dev-dependencies]
+cairo-rs = "0.3.0"
+
 [dependencies.glib-sys]
-version = "*"
+version = "0.5.0"
 features = [ "dox" ]

diff --git a/build.rs b/build.rs
index a1a503a..71c9b87 100644
--- a/build.rs
+++ b/build.rs
@@ -30,6 +30,7 @@ fn main() {
         .include(Path::new("/usr/include/gdk-pixbuf-2.0"))
 //        .include(Path::new("/usr/include/libpng16"))
         .include(Path::new("/usr/include/glib-2.0"))
+        .include(Path::new("/usr/lib/glib-2.0/include/"))
         .include(Path::new("/usr/lib/x86_64-linux-gnu/glib-2.0/include"))
         .include(Path::new("/usr/include/dbus-1.0/"))
         .file("src/gui/wg-p2p-vpn-editor-plugin.c")
@@ -63,6 +64,7 @@ fn main() {
         .include(Path::new("/usr/include/gdk-pixbuf-2.0"))
 //        .include(Path::new("/usr/include/libpng16"))
         .include(Path::new("/usr/include/glib-2.0"))
+        .include(Path::new("/usr/lib/glib-2.0/include/"))
         .include(Path::new("/usr/lib/x86_64-linux-gnu/glib-2.0/include"))
         .pic(true)
         .file("src/service/service.c")

(the additional include path is the location for glibconfig.h; without it it says it's missing)

gdbus-rs on its own builds fine if I run cargo build --release (or at least that's how it looks to me not knowing anything about Rust), wg-p2p-nm-plugin fails:

   Compiling wg-p2p-nm-plugin v0.1.0 (file:///home/depau/Beans/nm-wireguard-aur/wg-p2p-nm-plugin)
   Compiling docopt v0.8.3
   Compiling gdk-pixbuf v0.3.0
   Compiling gtk-sys v0.5.0
warning: src/service/service.c: In function ‘nm_wg_p2p_vpn_plugin_class_init’:
warning: src/service/service.c:143:29: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
warning:   parent_class->connect      = real_connect;
warning:                              ^
warning: src/service/service.c:144:36: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
warning:   parent_class->connect_interactive = real_connect_interactive;
warning:                                     ^
   Compiling gdk v0.7.0
   Compiling gtk v0.3.0
error[E0061]: this function takes 3 parameters but 2 parameters were supplied
   --> src/gui/editor.rs:190:28
    |
190 |                 let text = drunken_bishop::drunken_bishop(&key, drunken_bishop::OPENSSL);
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 parameters

error[E0061]: this function takes 3 parameters but 2 parameters were supplied
   --> src/gui/editor.rs:205:28
    |
205 |                 let text = drunken_bishop::drunken_bishop(&key, drunken_bishop::OPENSSL);
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 parameters

error: aborting due to 2 previous errors

The following warnings were emitted during compilation:

warning: src/service/service.c: In function ‘nm_wg_p2p_vpn_plugin_class_init’:
warning: src/service/service.c:143:29: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
warning:   parent_class->connect      = real_connect;
warning:                              ^
warning: src/service/service.c:144:36: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
warning:   parent_class->connect_interactive = real_connect_interactive;
warning:                                     ^

error: Could not compile `wg-p2p-nm-plugin`.

To learn more, run the command again with --verbose.

I don't know if it's relevant, maybe I just screwed up everything with the changes above; do you have any hints on how to get it to build?

I would eventually like, if that's okay with you, to make an AUR package for this plugin.

Thank you ;)

manuels commented 6 years ago

Hi, @Depau,

looks like you use the wrong version of drunken_bishop. Try to set

drunken_bishop = "0.1.2"

(or 0.1.1) in Cargo.toml.

depau commented 6 years ago

No such luck: https://hastebin.com/dotoyiromo.coffeescript

For some reason it uses 0.1.2 even if I specify 0.1.1 in Cargo.toml.

manuels commented 6 years ago

Oh, give

drunken_bishop = { git = "https://github.com/manuels/drunken_bishop-rs" }

a try.