OliveTin / package-arch-aur

Arch Linux AUR package
https://aur.archlinux.org/packages/olivetin
0 stars 1 forks source link

fail to install with aur package 2024.03.24-4 #2

Open wushuzh opened 4 months ago

wushuzh commented 4 months ago

I'm having trouble building the app on a new Arch Linux virtual machine using the AUR package. I get an error message saying 'make: buf: No such file or directory'.

I think the AUR package needs to include some package with this command buf as a dependency tool. I found several Arch packages related to Protocol Buffers.

I'm confused about the differences between 'extra/buf', 'extra/grpc-cli', and 'extra/protobuf'. What are they best used for? Can you give me some advice?

$ pacman -Ss "Protocol Buffers"
extra/buf 1.35.0-1
    A tool for working with Protocol Buffers
extra/grpc-cli 1.65.1-1
    gRPC protocol buffers cli
extra/protobuf 27.2-1
    Protocol Buffers - Google's data interchange format
extra/protobuf-c 1.5.0-3
    Protocol Buffers implementation in C
extra/python-protobuf 27.2-1
    Python 3 bindings for Google Protocol Buffers

Here is the install log:

==> Making package: olivetin 2024.03.24-4 (Fri Jul 26 06:30:02 2024)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating olivetin-2024.03.24 git repo...
  -> Found systemd-unit-usr-bin.patch
==> Validating source files with md5sums...
    olivetin-2024.03.24 ... Skipped
    systemd-unit-usr-bin.patch ... Skipped
==> Extracting sources...
  -> Creating working copy of olivetin-2024.03.24 git repo...
Reset branch 'makepkg'
==> Starting prepare()...
patching file OliveTin.service
==> Removing existing $pkgdir/ directory...
==> Starting build()...
go install "github.com/bufbuild/buf/cmd/buf"
go install "github.com/fzipp/gocyclo/cmd/gocyclo"
go install "github.com/go-critic/go-critic/cmd/gocritic"
go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway"
go install "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2"
go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
go install "google.golang.org/protobuf/cmd/protoc-gen-go"
buf generate
make: buf: No such file or directory
make: *** [Makefile:56: grpc] Error 127
jamesread commented 4 months ago

Hey, buf is the protocol buffers command I use to compile the OliveTin.proto into the Golang gRPC stub. You don't have to use it, you can just use the proto-gen-go-grpc tool directly, but buf makes it a bit easier.

buf is usually installed using the make grpc target (which calls make go-tools - that installs buf). I can see from your command output that go is indeed installing buf properly, but I would guess that it's not on your $PATH.

Is your gobin directory (that includes buf) in your $PATH?

wushuzh commented 4 months ago

Hey James,

Spot on about the $PATH! I double-checked the buf binary is in the gobin directory after running the grpc target, but it's not accessible from the system path. This means the PKGBUILD script definitely needs to handle setting the $PATH correctly, wouldn't you agree ?

Here's some interesting stuff I found:

Last week, when I built the Arch Linux package, I jumped straight to makepkg. However, the recommended way is to use it indirectly, as described in the DeveloperWiki article on building in a clean chroot DeveloperWiki:Building in a clean chroot.

The clean chroot build process feels similar to Docker's multi-stage builds. The chroot creates a clean environment for building packages. It creates a fresh environment specifically for building packages. This lets us run the build process repeatedly without any leftover changes messing things up. Once the package is built, we can ditch the build environment. End users will do the same, they only need the final package itself, not extra tools like Go or npm cluttering their system.

On another note, for the gobin directory's $PATH, I also think using npx to launch the parcel command for the web part is also needed. I'll be submitting a pull request to make this change later. Could you give it a review?

wushuzh commented 4 months ago

A namcap reported with the generated aur package in my local dev env.

$ namcap olivetin-2024.03.24-5-x86_64.pkg.tar.zst
olivetin W: ELF file ('usr/bin/OliveTin') lacks FULL RELRO, check LDFLAGS.
olivetin W: ELF file ('usr/bin/OliveTin') lacks PIE.
olivetin W: ELF file ('usr/bin/OliveTin') lacks GNU_PROPERTY_X86_FEATURE_1_SHSTK.
olivetin W: File (var/www/) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/OliveTinLogo-120px.f44fc3eb.png) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/OliveTinLogo-180px.34156bf4.png) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/OliveTinLogo-57px.a96cecc3.png) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/OliveTinLogo.cfcd091e.png) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/index.06cee549.js) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/index.06cee549.js.map) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/index.2ae43d12.css) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/index.2ae43d12.css.map) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/index.7016963a.js) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/index.7016963a.js.map) exists in a non-standard directory.
olivetin W: File (var/www/olivetin/index.html) exists in a non-standard directory.
olivetin E: AGPLv3 is not a valid SPDX license identifier. See https://spdx.org/licenses/ for valid identifiers, or prefix the identifier with 'LicenseRef-', if it is custom.
olivetin W: Unused shared library '/usr/lib/libresolv.so.2' by file ('usr/bin/OliveTin')
olivetin E: Dependency glibc detected and not included (libraries ['usr/lib/libc.so.6', 'usr/lib/libresolv.so.2'] needed in files ['usr/bin/OliveTin'])