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

Manual Build Instructions for Production Builds Do Not Work #633

Closed
gflohr opened this issue Sep 25, 2024 · 3 comments
Closed

Manual Build Instructions for Production Builds Do Not Work #633

gflohr opened this issue Sep 25, 2024 · 3 comments
Assignees

Comments

@gflohr
Copy link

gflohr commented Sep 25, 2024

I am trying to build the daemon from sources:

$ go  build -buildmode=pie -tags=drop,moose,telio -ldflags='-s -w -linkmode=external -X main.Version=3.18.5 -X main.Environment=prod -X main.Arch=i386 -X main.Salt=charmgoofyropegritmamatilt -X main.PackageType=ebuild' -o bin/nordvpnd cmd/daemon
package cmd/daemon is not in std (/usr/lib/go/src/cmd/daemon)

When I replace cmd/daemon with ./cmd/daemon, I get the next error:

$ go  build -buildmode=pie -tags=drop,moose,telio -ldflags='-s -w -linkmode=external -X main.Version=3.18.5 -X main.Environment=prod -X main.Arch=i386 -X main.Salt=charmgoofyropegritmamatilt -X main.PackageType=ebuild' -o bin/nordvpnd ./cmd/daemon
events/moose/errors.go:12:2: package moose/events is not in std (/usr/lib/go/src/moose/events)
events/moose/moose.go:33:2: package moose/worker is not in std (/usr/lib/go/src/moose/worker)

From #3 I kind of understood that moose is not strictly necessary. So, I tried to omit it:

$ go  build -buildmode=pie -tags=drop,telio -ldflags='-s -w -linkmode=external -X main.Version=3.18.5 -X main.Environment=prod -X main.Arch=i386 -X main.Salt=charmgoofyropegritmamatilt -X main.PackageType=ebuild' -o bin/nordvpnd ./cmd/daemon
# github.com/jbowtie/gokogiri/xpath
/home/yourstruly/go/pkg/mod/github.com/jbowtie/[email protected]/xpath/expression.go:47:8: could not determine kind of name for C.free
# github.com/NordSecurity/libtelio/ffi/bindings/linux/go
In file included from /home/yourstruly/go/pkg/mod/github.com/!nord!security/[email protected]/ffi/bindings/linux/go/callbacks.h:1,
                 from teliogo.go:20,
                 from _cgo_export.c:4:
/home/yourstruly/go/pkg/mod/github.com/!nord!security/[email protected]/ffi/bindings/linux/go/../../telio.h:457:34: warning: ‘struct telio_protect_cb’ declared inside parameter list will not be visible outside of this definition or declaration
  457 |                           struct telio_protect_cb);
      |                                  ^~~~~~~~~~~~~~~~
# github.com/NordSecurity/libtelio/ffi/bindings/linux/go
In file included from /home/yourstruly/go/pkg/mod/github.com/!nord!security/[email protected]/ffi/bindings/linux/go/callbacks.h:1,
                 from /home/yourstruly/go/pkg/mod/github.com/!nord!security/[email protected]/ffi/bindings/linux/go/teliogo.go:20:
/home/yourstruly/go/pkg/mod/github.com/!nord!security/[email protected]/ffi/bindings/linux/go/../../telio.h:457:34: warning: ‘struct telio_protect_cb’ declared inside parameter list will not be visible outside of this definition or declaration
  457 |                           struct telio_protect_cb);
      |                                  ^~~~~~~~~~~~~~~~

Any idea how to fix that?

The client bin/nordvpn compiled without problems.

@bartoszWojciechO bartoszWojciechO self-assigned this Sep 26, 2024
@bartoszWojciechO
Copy link
Contributor

Hi, these build instructions weren't updated for a long time and might be outdated. Have you tried building with mage(aka mage build:binaries or mage build:binariesDocker)?

This looks like a compile error in one of the dependencies. I have tried to build on my machine and a fresh VM(Ubuntu 24.04) and didn't run into this issue. Which distribution/go version are you using? Which commit are you trying to build?

@gflohr
Copy link
Author

gflohr commented Sep 26, 2024

I'm on Gentoo Linux for amd64, with go 1.23.1, GCC 13.3.1, and rust 1.80.1.

I have used the release tarball for 3.18.5 but have the same issue with the current HEAD from main.

With mage I run into a different, but unrelated problem:

...
          /home/me/src/nordvpn-linux/build/foss/libtelio/linkers/d-x86_64-linux-gnu-gcc: line 26: exec: x86_64-linux-gnu-gcc: not found
          

error: could not compile `libc` (build script) due to 1 previous error
Error: running "ci/build_rust.sh " failed with exit code 101

This can be fixed with a symlink: cd /usr/bin && ln -s x86_64-pc-linux-gnu-gcc x86_64-linux-gnu-gcc. The compiler is x86_64-pc-linux-gnu-gcc, not just x64_64-linux-gnu-gcc on Gentoo. This could be determined with gcc --dumpmachine instead of hard-coding the name.

But then I run into another error:

error[E0282]: type annotations needed for `Box<_>`
  --> /home/myself/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.20/src/format_description/parse/mod.rs:83:9
   |
83 |     let items = format_items
   |         ^^^^^
...
86 |     Ok(items.into())
   |              ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 |     let items: Box<_> = format_items
   |              ++++++++

At this point, I gave up.

Don't worry to close this as WONTFIX. For myself, I can use the pre-compiled binaries from the .deb without problems. My intention was to build a package for Gentoo.

@bartoszWojciechO
Copy link
Contributor

Closing as we do not support Gentoo at this moment. One alternative you can try is the docker build(mage build:binariesDocker.

@bartoszWojciechO bartoszWojciechO closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2024
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

2 participants