vpncloud icon indicating copy to clipboard operation
vpncloud copied to clipboard

Builds for other targets

Open dswd opened this issue 9 years ago • 27 comments

This is a tracking issue on building VpnCloud for other operating systems and other architectures.

  • Linux x86_64
    • [x] Compiles and links
    • [x] Packaged for Debian/Ubuntu
  • Linux x86 (i686-unknown-linux-gnu)
    • [x] Compiles and links
    • [x] Packaged for Debian/Ubuntu
  • Linux ARMv7 (armv7-unknown-linux-gnueabihf)
    • [x] Compiles and links
    • [x] Packaged for Debian/Ubuntu
  • Linux ARM (arm-unknown-linux-gnueabihf)
    • [x] Compiles and links
    • [x] Packaged for Debian/Ubuntu
  • MacOS (developer wanted)
    • Problem: dependency "ring" does not compile
    • Problem: tun/tap is different on MacOS
    • [ ] Compiles and links
    • [ ] Packaged
  • FreeBSD (developer wanted)
    • Problem: polling and signal handling
    • [ ] Compiles and links
    • [ ] Packaged
  • Windows (developer wanted)
    • Problem: tun/tap is different on Windows
    • OpenVPN has a subproject tap-windows that provides TAP interfaces for windows (Tutorial).
    • [ ] Compiles and links
    • [ ] Packaged
  • iOS (iPad, iPhone) (developer wanted)
    • [ ] Compiles and links
    • [ ] Packaged

Implementation hints:

dswd avatar Apr 11 '16 06:04 dswd

I might have a look at getting it running on OS X, another one to add would be freebsd (pfSense package too).

fourbytes avatar Jun 20 '16 12:06 fourbytes

That would be great. I also added FreeBSD.

dswd avatar Jun 20 '16 18:06 dswd

May be worth looking at OpenVPN's implementation for OS X and FreeBSD.

fourbytes avatar Jun 25 '16 16:06 fourbytes

I added some more documentation and changed the polling mechanism to be more flexible (could now implement kqueue) to make porting easier for you.

dswd avatar Jun 30 '16 08:06 dswd

I've started working on kqueue (bsd/osx) support, just waiting on https://github.com/nix-rust/nix/pull/396 at the moment.

fourbytes avatar Aug 08 '16 22:08 fourbytes

Signal also seems to only be supported on linux so will have to sort that out.

fourbytes avatar Aug 08 '16 22:08 fourbytes

I adore this software. I'm a complete noob. I really want to run it on my RPi and my phone. I've been unable to cross-compile it (and I even tried compiling on the RPi). Here is a sample output:

$ cargo build --target=armv7-unknown-linux-gnueabihf Compiling vpncloud v0.8.1 (file:///home/h0p3/vpncloud.rs) error: failed to run custom build command for vpncloud v0.8.1 (file:///home/h0p3/vpncloud.rs) process didn't exit successfully: /home/h0p3/vpncloud.rs/target/debug/build/vpncloud-641c68931705eb78/build-script-build (exit code: 101) --- stdout TARGET = Some("armv7-unknown-linux-gnueabihf") OPT_LEVEL = Some("0") TARGET = Some("armv7-unknown-linux-gnueabihf") HOST = Some("x86_64-unknown-linux-gnu") TARGET = Some("armv7-unknown-linux-gnueabihf") TARGET = Some("armv7-unknown-linux-gnueabihf") HOST = Some("x86_64-unknown-linux-gnu") CC_armv7-unknown-linux-gnueabihf = None CC_armv7_unknown_linux_gnueabihf = None TARGET_CC = None CC = None HOST = Some("x86_64-unknown-linux-gnu") CROSS_COMPILE = None TARGET = Some("armv7-unknown-linux-gnueabihf") HOST = Some("x86_64-unknown-linux-gnu") CFLAGS_armv7-unknown-linux-gnueabihf = None CFLAGS_armv7_unknown_linux_gnueabihf = None TARGET_CFLAGS = None CFLAGS = None PROFILE = Some("debug") running: "arm-linux-gnueabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-march=armv7-a" "-I" "src" "-o" "/home/h0p3/vpncloud.rs/target/armv7-unknown-linux-gnueabihf/debug/build/vpncloud-6ec0f618f669dc21/out/src/c/tuntap.o" "-c" "src/c/tuntap.c" exit code: 0 TARGET = Some("armv7-unknown-linux-gnueabihf") TARGET = Some("armv7-unknown-linux-gnueabihf") HOST = Some("x86_64-unknown-linux-gnu") AR_armv7-unknown-linux-gnueabihf = None AR_armv7_unknown_linux_gnueabihf = None TARGET_AR = None AR = None TARGET = Some("armv7-unknown-linux-gnueabihf") TARGET = Some("armv7-unknown-linux-gnueabihf") running: "ar" "crs" "/home/h0p3/vpncloud.rs/target/armv7-unknown-linux-gnueabihf/debug/build/vpncloud-6ec0f618f669dc21/out/libtuntap.a" "/home/h0p3/vpncloud.rs/target/armv7-unknown-linux-gnueabihf/debug/build/vpncloud-6ec0f618f669dc21/out/src/c/tuntap.o" exit code: 0 TARGET = Some("armv7-unknown-linux-gnueabihf") cargo:rustc-link-lib=static=tuntap cargo:rustc-link-search=native=/home/h0p3/vpncloud.rs/target/armv7-unknown-linux-gnueabihf/debug/build/vpncloud-6ec0f618f669dc21/out

--- stderr make: *** No rule to make target 'clean'. Stop. sh: 0: Can't open autogen.sh sh: 0: Can't open configure make: *** No targets specified and no makefile found. Stop. thread 'main' panicked at 'called Result::unwrap() on an Err value: Error { repr: Custom(Custom { kind: InvalidInput, error: StringError("the source path is not an existing regular file") }) }', /checkout/src/libcore/result.rs:916:5 note: Run with RUST_BACKTRACE=1 for a backtrace.

Can anyone point me in the right direction?

m6ram avatar Feb 22 '18 19:02 m6ram

@fourbytes so ,have u successfully compiled vpncloud on mac?

luckypoem avatar Dec 04 '19 10:12 luckypoem

@fourbytes

on mac: git clone https://github.com/dswd/vpncloud vpncloud-by-dswd cd vpncloud-by-dswd cargo build --release it shows: ... Compiling rand v0.7.2 error: failed to run custom build command for vpncloud v1.0.0 (/Users/brite/vpncloud-by-dswd)

Caused by: process didn't exit successfully: /Users/brite/vpncloud-by-dswd/target/release/build/vpncloud-d91f8ff6549d48b0/build-script-build (exit code: 1) --- stdout cargo:rerun-if-changed=src/c/tuntap.c TARGET = Some("x86_64-apple-darwin") OPT_LEVEL = Some("3") HOST = Some("x86_64-apple-darwin") CC_x86_64-apple-darwin = None CC_x86_64_apple_darwin = None HOST_CC = None CC = None CFLAGS_x86_64-apple-darwin = None CFLAGS_x86_64_apple_darwin = None HOST_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("false") CARGO_CFG_TARGET_FEATURE = Some("cmpxchg16b,fxsr,mmx,sse,sse2,sse3,ssse3") running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src" "-Wall" "-Wextra" "-o" "/Users/brite/vpncloud-by-dswd/target/release/build/vpncloud-5215daba07884332/out/src/c/tuntap.o" "-c" "src/c/tuntap.c" cargo:warning=src/c/tuntap.c:7:10: fatal error: 'linux/if_tun.h' file not found cargo:warning=#include <linux/if_tun.h> cargo:warning= ^ cargo:warning=1 error generated. exit code: 1

--- stderr

error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src" "-Wall" "-Wextra" "-o" "/Users/brite/vpncloud-by-dswd/target/release/build/vpncloud-5215daba07884332/out/src/c/tuntap.o" "-c" "src/c/tuntap.c" with args "cc" did not execute successfully (status code exit code: 1).

warning: build failed, waiting for other jobs to finish... Building [==============================================> ] 91/105 error: build failed

i saw: "fatal error: 'linux/if_tun.h' file not found",how to fix this issue?

luckypoem avatar Dec 04 '19 11:12 luckypoem

I am sorry, but it won't just compile like that. OS X has a different way of using virtual network devices to Linux, so it will need some code changes.

dswd avatar Dec 04 '19 12:12 dswd

On windows wintun can be used.

ofer-dev avatar Aug 22 '20 21:08 ofer-dev

Just to update wintun 0.9 has been released and should be much nicer to work with. https://lists.zx2c4.com/pipermail/wireguard/2020-November/005921.html

ofer-dev avatar Nov 26 '20 20:11 ofer-dev

@ofer-dev does wintun also support tap devices? Vpncloud supports tun and tap and I would like to have one lib for windows if possible.

dswd avatar Nov 28 '20 22:11 dswd

Wintun only support tun devices. However, it is faster and smaller than tap-windows6, so less room for bugs. But if tap devices are necessary to the best of my knowledge tap-windows6 is the only option.

references: https://lists.zx2c4.com/pipermail/wireguard/2019-March/004038.html https://lists.zx2c4.com/pipermail/wireguard/2019-May/004168.html https://www.wintun.net/

p.s. As of version 2.5 OpenVPN also ships with wintun. https://openvpn.net/community-downloads-2/

ofer-dev avatar Nov 29 '20 21:11 ofer-dev

Any thought to packaging VPNCloud as a SNAP?

Quite a number of Linux distributions support Snap out of the box such as Ubuntu (and e.g. Kubuntu), Manjaro, Zorin OS, KDE Neon, Solus and Li-f-e.

Snap is also available for many other distributions such as CentOS, Debian, Elementary OS, Fedora, GalliumOS, Kali Linux, Linux Mint, OpenEmbedded, Parrot Security OS, Pop! OS, Raspbian, Red Hat Enterprise Linux and openSUSE.

Snap also supports upgrade/rollbacks etc..

Snap's goal was to ease the load on developers and also "containerize" the applications installed instead of speading config files etc all over a disk.

https://snapcraft.io/docs/creating-a-snap

Just an idea.

bmullan avatar Feb 08 '21 14:02 bmullan

Hi Brian. I thought about that but haven't followed that up since I have no experience in writing snaps. So if you want to help, you can create a snap and I will add it to the build process and maintain it as good as I can.

dswd avatar Feb 08 '21 16:02 dswd

It's been ~~two~~ three years, and I've yet to find a serious alternative to this piece of software. I have no idea why this tool is not much bigger than it is, btw. It's amazing (and thank you for providing such a gift to the world). You write code with moral merit. I might not be able to write the snap, but I'd donate for it.

m6ram avatar Feb 08 '21 17:02 m6ram

Hi, thanks a lot for the kind words. I looked into building snaps a little and managed to build a simple snap from the deb package. However:

  • I can't install the manpage as snap does not seem to support manpages
  • I have not found a good way to add vpncloud as a service since snap does not seem to support services with dynamic instances
  • Also I haven't found out how to create a config directory in /etc with a default config using snap

Right now the snap just provides the binary. Any help would be appreciated.

I just thought about something else. Since VpnCloud really just comes as a binary with 3 support files (manpage, system service, example config), maybe I can provide a standalone executable which has install and uninstall commands that create/delete those 3 files. Alternatively, the binary could get the ability to manage instances (create config, delete config) which also creates the required service file. This would work on any Linux system I can think of. What do you think about that? Would that be useful to you?

dswd avatar Feb 09 '21 07:02 dswd

@dswd

I don't know if this helps but here is the OpenVPN SNAP:

IBCNServices/easy-openvpn-server: Plug-and-play OpenVPN server which generates server and client config files for you.

SnapStore - OpenVPN SNAP

bmullan avatar Feb 09 '21 12:02 bmullan

@dswd

First, I want to introduce myself to you. Hi there! My name is h0p3. It's an honor and a pleasure to meet you. I've been an admirer from afar. Maybe that will change; I don't know. If you ever need a friend, a madman, or a retard in your life, HMU: https://philosopher.life/ (feel free to ignore my public self-modeling; it's currently being quietly written [can check the diffs]). I record my conversations (including this one, and I'm happy to think about that with you, if you want), and if you prefer an alias, let me know (you've already earned one with me).

I've been thinking about your words. I like many of the changes you've made to this software over the years (to my poor understanding, of course). I'm sure I sound like an entitled user, and I apologize. I am grateful for this gift.

Perhaps all I can offer in return at the moment is my paranoid, ignorant opinion here (might not be worth much, sorry). I think you have a tool that competes with Zerotier (this is the tit I'm trying to get off) and perhaps even https://github.com/yggdrasil-network/yggdrasil-go. Having something that "just werx" on any Linux machine is quite an accomplishment, especially if there is a simple installation (if you had more people helping you, it seems like it could be used on most unlocked platforms [perhaps even inside the browser via WASM one day]). I like to think that this tool could be the basis of the decentralization that so many applications are really seeking in the end. Here's some dumb questions and uses I have in mind:

  • Can I hand my brother a key and few lines to run almost blindly with zero compilation?
  • Can I connect to hundreds of networks, some of them quite large?
  • Can I nest VPNs?
  • Can I route this over i2p/loki/tor with ease? (ws-proxy and hooks are dope, btw)
  • Can I run it on a potato (in some mode, perhaps), especially an android phone (I'm close to just giving up and going for a pinephone)? (would it need to leverage other machines to limit battery usage?)
  • Given the continued centralization of and censorship within internet infrastructures, is it easy to run a volunteer beacon-router-tracker-proxy on behalf of any vpnclouds that may need the extra foothold? (I admit that federation may still be a required, though avoiding it is preferred).

You need a dozen people to solve these problems maybe. Please ignore my questions (they are insane, I know). You have already given more than you have to.

I don't know what fitting assumptions you ought to make here. I'm not a dev; I'm just a skiddie who uses his computer to get shit done. If you can avoid package managers, then why not avoid them? I like the last binary option you mentioned the most.

m6ram avatar Feb 10 '21 20:02 m6ram

@m6ram Thanks for the compliments. As those questions go beyond the topic of this issue, I quoted and answered them in #159.

dswd avatar Feb 12 '21 08:02 dswd

Debian packages for armel (eg. raspberry pi zero and older raspberry pi) would be much appreciated

xek avatar Dec 16 '21 12:12 xek

Created a pull request for armel #274

xek avatar Dec 17 '21 11:12 xek

With armel build target support merged (#274) and version 2.3.0 released, a deployment of the latest debs to https://repo.ddswd.de/deb would be much appreciated.

uliluckas avatar Mar 08 '22 22:03 uliluckas

A new crate may be of help, particularly for running as a Windows service: https://github.com/chipsenkbeil/service-manager-rs

Lyamc avatar Jul 25 '22 05:07 Lyamc

Any chance to have this packaged for OpenWRT with LUCI support?

neoOpus avatar Aug 03 '22 06:08 neoOpus

Very much looking forward to vpncloud supporting windows platform

aa51513 avatar Oct 23 '23 07:10 aa51513