Error building from AUR
Hello,
I have an error during the build of project to update it. V1 had no problem to install but update to V2 crash/
Distro info:
Arch Linux x86_64 6.8.5-arch1-1
AUR package manager : Trizen
Logs :
Repository : AUR
Name : privatebin-cli
Version : 2.0.1-2
Maintainer : barbuk
URL : https://github.com/gearnode/privatebin
AUR URL : https://aur.archlinux.org/packages/privatebin-cli
License : ISC
Votes : 2
Popularity : 0.00098%
Installed : Yes
Out Of Date : No
Depends On : None
Make Deps : go
pandoc
Check Deps : None
Optional Deps : None
Provides : None
Conflicts With : privatebin-cli-bin
Replaces : None
Package Base : privatebin-cli
Last Update : Tue Apr 16 13:09:18 2024
Description : A powerful CLI for creating and managing PrivateBin pastes with ease
==> Making package: privatebin-cli 2.0.1-2 (Tue 16 Apr 2024 15:32:42 CEST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found privatebin-cli-2.0.1.tar.gz
==> Validating source files with sha256sums...
privatebin-cli-2.0.1.tar.gz ... Passed
==> Extracting sources...
-> Extracting privatebin-cli-2.0.1.tar.gz with bsdtar
==> Starting prepare()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
# command-line-arguments
flag provided but not defined: -Wl,--sort-common
usage: link [options] main.o
-B note
add an ELF NT_GNU_BUILD_ID note when using ELF; use "gobuildid" to generate it from the Go build ID
-E entry
set entry symbol name
-H type
set header type
-I linker
use linker as ELF dynamic linker
-L directory
add specified directory to library path
-R quantum
set address rounding quantum (default -1)
-T int
set the start address of text symbols (default -1)
-V print version and exit
-X definition
add string value definition of the form importpath.name=value
-a no-op (deprecated)
-asan
enable ASan interface
-aslr
enable ASLR for buildmode=c-shared on windows (default true)
-benchmark string
set to 'mem' or 'cpu' to enable phase benchmarking
-benchmarkprofile base
emit phase profiles to base_phase.{cpu,mem}prof
-buildid id
record id as Go toolchain build id
-buildmode mode
set build mode
-c dump call graph
-capturehostobjs string
capture host object files loaded during internal linking to specified dir
-compressdwarf
compress DWARF if possible (default true)
-cpuprofile file
write cpu profile to file
-d disable dynamic executable
-debugnosplit
dump nosplit call graph
-debugtextsize int
debug text section max size
-debugtramp int
debug trampolines
-dumpdep
dump symbol dependency graph
-extar string
archive program for buildmode=c-archive
-extld linker
use linker when linking in external mode
-extldflags flags
pass flags to external linker
-f ignore version mismatch
-g disable go package data checks
-h halt on error
-importcfg file
read import configuration from file
-installsuffix suffix
set package directory suffix
-k symbol
set field tracking symbol
-libgcc string
compiler support lib for internal linking; use "none" to disable
-linkmode mode
set link mode
-linkshared
link against installed Go shared libraries
-memprofile file
write memory profile to file
-memprofilerate rate
set runtime.MemProfileRate to rate
-msan
enable MSan interface
-n no-op (deprecated)
-o file
write output to file
-pluginpath string
full path name for plugin
-pruneweakmap
prune weak mapinit refs (default true)
-r path
set the ELF dynamic linker search path to dir1:dir2:...
-race
enable race detector
-s disable symbol table
-strictdups int
sanity check duplicate symbol contents during object file reading (1=warn 2=err).
-tmpdir directory
use directory for temporary files
-v print link trace
-w disable DWARF generation
==> ERROR: A failure occurred in build().
Aborting...
:: Unable to build privatebin-cli - makepkg exited with code: 4
The error is: flag provided but not defined: -Wl,--sort-common
What are your LDFLAGS ? What is your go version ?
Mine are:
❯ grep LDFLAGS /etc/makepkg.conf
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
❯ go version
go version go1.22.2 linux/amd64
Can you try to do a clean build by downloading https://aur.archlinux.org/cgit/aur.git/snapshot/privatebin-cli.tar.gz, uncompress the archive and:
makepkg --cleanbuild
Thanks for the answer,
I have the correct go version but my LDFLAGS was looking like this
LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
-Wl,-z,pack-relative-relocs"
I don't know why as i'm not really aware of how this works. I commented it and replaced it by yours ending up looking like this:
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
# LDFLAGS="-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
# -Wl,-z,pack-relative-relocs"
With this the build worked through my AUR helper.
Thanks for your help :)