OrchidTechnologies / orchid

Orchid: VPN, Personal Firewall
https://www.orchid.com/
GNU Affero General Public License v3.0
655 stars 102 forks source link

compile on Ubuntu 18.04 #14

Closed lavarok closed 4 years ago

lavarok commented 4 years ago

command: make all-srv-lnx

Gets to here and fails:

[CC] lnx/x86_64 p2p/./openvpn3/client/ovpncli.cpp p2p/./openvpn3/client/ovpncli.cpp:24:10: fatal error: 'iostream' file not found

include

     ^~~~~~~~~~

1 error generated. env/output.mk:146: recipe for target 'out-lnx/x86_64/./p2p/./openvpn3/client/ovpncli.cpp.o' failed make[1]: *** [out-lnx/x86_64/./p2p/./openvpn3/client/ovpncli.cpp.o] Error 1

What am I missing?

nhandler commented 4 years ago

Can you try following the instructions on https://github.com/OrchidTechnologies/orchid/blob/master/srv-shared/README.md to see if that helps?

lavarok commented 4 years ago

I was able to get it compiled by following the additional steps:

orchid_diff.txt

A guide on where to go from here would be appreciated. I'm looking to setup at least one node with bandwidth for the network.

trees-smoke commented 4 years ago

I don't seem to get past the iostreams error unless I add cflags += -stdlib=libstdc++ to srv-shared/makefile

Then I run into './p2p/cppcoro/include/cppcoro/async_auto_reset_event.hpp:8:10: fatal error: 'experimental/coroutine' file not found'

lavarok commented 4 years ago

I don't seem to get past the iostreams error unless I add cflags += -stdlib=libstdc++ to srv-shared/makefile

Then I run into './p2p/cppcoro/include/cppcoro/async_auto_reset_event.hpp:8:10: fatal error: 'experimental/coroutine' file not found'

The iostream error goes away when you install the appropriate g++ package for your clang version.

trees-smoke commented 4 years ago

Ah, k, I'm dumb. It was easier for me going to ubuntu 19.10 and following the https://github.com/OrchidTechnologies/orchid/blob/master/srv-shared/README.md after installing the clang, clang++, clang-tidy, libc++-dev, libc++abi-dev and it worked. Thanks guys.

Geri1590 commented 4 years ago

Ah, k, I'm dumb. It was easier for me going to ubuntu 19.10 and following the https://github.com/OrchidTechnologies/orchid/blob/master/srv-shared/README.md after installing the clang, clang++, clang-tidy, libc++-dev, libc++abi-dev and it worked. Thanks guys.

Hi there, I'm trying to compile on Ubuntu 19.10, installing clang, clang++, clang-tidy, libc++-dev, libc++abi-dev as you said, and even though the previous errors are gone, now it shows a different one:

[LD] out-lnx/x86_64/orchidd
/usr/bin/ld: unrecognized option '--icf=all'
/usr/bin/ld: use the --help option for usage information
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Do you know why is that? Thanks,

zaniko commented 4 years ago

Ah, k, I'm dumb. It was easier for me going to ubuntu 19.10 and following the https://github.com/OrchidTechnologies/orchid/blob/master/srv-shared/README.md after installing the clang, clang++, clang-tidy, libc++-dev, libc++abi-dev and it worked. Thanks guys.

Hi there, I'm trying to compile on Ubuntu 19.10, installing clang, clang++, clang-tidy, libc++-dev, libc++abi-dev as you said, and even though the previous errors are gone, now it shows a different one:

[LD] out-lnx/x86_64/orchidd
/usr/bin/ld: unrecognized option '--icf=all'
/usr/bin/ld: use the --help option for usage information
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Do you know why is that? Thanks,

Hi, Have you solved your problem ?

dluman commented 4 years ago

I reproduced @Geri1590's issue on an install using Fedora 31. The issue lies with the compiler's use of ld; a different linker (lld) works in its place. You may need to restart the make process from the beginning using the following flags in the srv-shared/makefile:

cflags += -stdlib=libc++
cflags += -Qunused-arguments
cflags += -fuse-ld=ld.lld

wflags += -fuse-ld=lld

This changes the linked to use lld. I completed the build with clang-9, and needed to install dependencies libcxx,libcxx-devel, lld, and stand-up rust using the sh file which also installs rustup.

I encountered the same issues on other distros, so there may be something to a PR against the makefile?

zaniko commented 4 years ago

Yes I solved it too by deleting ld binary to be able to symlink lld binary to replace the original ld. This was the last error. Then the binary will be built

Edit : it’s a little dirty but works

Now the thing is how to use it. A lot of args have to be entered from reading the output of —help arg which don’t help me so much. Someone is running orchidd ?

saurik commented 4 years ago

When we compile orchidd for Linux, even when we do so on Linux, we do it as a cross-compile using debug=crossndk, in order to allow the resulting binary to run on older versions of Linux no matter where it was compiled (and also to get a more consistent build of the binary, as the goal is to have a fully deterministic and reproducible build). I thereby, honestly, just don't ever test "bare" / non-cross Linux compiles.

I've gone ahead and added a target orchid-lnx-bad to the GitHub CI in https://github.com/OrchidTechnologies/orchid/commit/2180fcde6a21023de83b35f5f44a238b98cc20ec that does a non-cross build of Orchid using the system copy of clang (which of course must be 8 or above, probably 9; you can do this either by selecting the "alternative" with dpkg or setting suffix=-9) and fixed all of the resulting build errors. I will thereby be able to maintain this build going forward to make sure it does not break again.