trickle icon indicating copy to clipboard operation
trickle copied to clipboard

[FIXED] can't compile on Arch

Open perpetuallyhorni opened this issue 1 year ago • 11 comments

I compiled this on a freshly installed and updated arch VPS around 15 days ago, today I'm trying to install (on a freshly installed as well) local arch machine to no avail. Tried AUR, AUR 'trickle-git', this repo and echiu64's fork

log reads:

checking if we can access libc without dlopen... no
checking if we can access libc with libc.so... no
checking if we can access libc with /usr/lib/libc.so... no
checking if we can access libc with /usr/lib/libc.so.6... no
checking if we can access libc with /lib/libc.so.6... no
configure: error: cannot figure out how to access libc
make: *** No targets specified and no makefile found.  Stop.

I tried applying the patch described in ArchLinux forums post from 2024-05-13: Cannot install trickle because libc is not found to AUR's trickle-git

but that results in

...
patching file configure.in
patching file configure.in
patching file xdr.c
configure.in:5: warning: The macro 'AC_CANONICAL_SYSTEM' is obsolete.
configure.in:5: You should run autoupdate.
./lib/autoconf/general.m4:2081: AC_CANONICAL_SYSTEM is expanded from...
configure.in:5: the top level
configure.in:47: warning: The macro 'AC_HEADER_STDC' is obsolete.
configure.in:47: You should run autoupdate.
./lib/autoconf/headers.m4:663: AC_HEADER_STDC is expanded from...
configure.in:47: the top level
configure.in:53: warning: The macro 'AC_HELP_STRING' is obsolete.
configure.in:53: You should run autoupdate.
./lib/autoconf/general.m4:204: AC_HELP_STRING is expanded from...
./lib/autoconf/general.m4:1534: AC_ARG_ENABLE is expanded from...
configure.in:53: the top level
configure.in:64: warning: The macro 'AC_TRY_LINK' is obsolete.
configure.in:64: You should run autoupdate.
./lib/autoconf/general.m4:2918: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:690: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
configure.in:64: the top level
configure.in:81: warning: The macro 'AC_HEADER_TIME' is obsolete.
configure.in:81: You should run autoupdate.
./lib/autoconf/headers.m4:702: AC_HEADER_TIME is expanded from...
configure.in:81: the top level
configure.in:89: warning: The macro 'AC_PROG_GCC_TRADITIONAL' is obsolete.
configure.in:89: You should run autoupdate.
./lib/autoconf/c.m4:1676: AC_PROG_GCC_TRADITIONAL is expanded from...
configure.in:89: the top level
configure.in:90: warning: The macro 'AC_TYPE_SIGNAL' is obsolete.
configure.in:90: You should run autoupdate.
./lib/autoconf/types.m4:805: AC_TYPE_SIGNAL is expanded from...
configure.in:90: the top level
configure.in:99: warning: The macro 'AC_ERROR' is obsolete.
configure.in:99: You should run autoupdate.
./lib/autoconf/oldnames.m4:34: AC_ERROR is expanded from...
lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
./lib/autoconf/general.m4:1553: AC_ARG_WITH is expanded from...
configure.in:99: the top level
configure.in:99: warning: The macro 'AC_ERROR' is obsolete.
configure.in:99: You should run autoupdate.
./lib/autoconf/oldnames.m4:34: AC_ERROR is expanded from...
lib/m4sugar/m4sh.m4:690: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
./lib/autoconf/general.m4:1553: AC_ARG_WITH is expanded from...
configure.in:99: the top level
configure.in:139: warning: The macro 'AC_TRY_RUN' is obsolete.
configure.in:139: You should run autoupdate.
./lib/autoconf/general.m4:2995: AC_TRY_RUN is expanded from...
configure.in:139: the top level
configure.in:163: warning: The macro 'AC_TRY_RUN' is obsolete.
configure.in:163: You should run autoupdate.
./lib/autoconf/general.m4:2995: AC_TRY_RUN is expanded from...
configure.in:163: the top level
configure.in:198: warning: The macro 'AC_TRY_RUN' is obsolete.
configure.in:198: You should run autoupdate.
./lib/autoconf/general.m4:2995: AC_TRY_RUN is expanded from...
configure.in:198: the top level
configure.in:243: warning: AC_OUTPUT should be used without arguments.
configure.in:243: You should run autoupdate.
configure.in:8: error: possibly undefined macro: AM_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.in:9: error: possibly undefined macro: AM_CONFIG_HEADER
configure.in:15: error: possibly undefined macro: AM_PROG_LIBTOOL
configure.in:31: error: possibly undefined macro: AC_DEFINE
configure.in:60: error: possibly undefined macro: AC_MSG_ERROR
==> ERROR: A failure occurred in prepare().
    Aborting...

If anyone gets this to work could you share your PKGBUILD file please?

perpetuallyhorni avatar May 27 '24 23:05 perpetuallyhorni

my PKGBUILD:

# Maintainer:  Jonathon Fernyhough <jonathon at+m2x dev>
# Contributor: Jaroslav Lichtblau <[email protected]>
# Contributor: Romain Bouchaud-Leduc <[email protected]>

pkgname=trickle-git
pkgver=r23.09a1d95
pkgrel=3
pkgdesc="Lightweight userspace bandwidth shaper"
arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
url="https://github.com/mariusae/trickle"
license=('BSD')
depends=('libevent' 'libtirpc')
makedepends=('git')
provides=("${pkgname/-git/}")
conflicts=("${pkgname/-git/}")
source=("git+$url.git"
        "remove-libtrickle.patch"
        "fix-trickle-overload.patch"
        "$url/pull/28/commits/4171f1716eb2e37d36fb9189800c53b83723569d.patch"
        "$url/pull/29/commits/29de2a4704d9843d3c6cba1d4a4ac177f2d6e568.patch"
        trickle-gcc14.patch)
sha256sums=('SKIP'
            '7e148c9526dbd6667c94ce3ee4f1a1fd550e61ab185735939c4d5312cf13b7a1'
            'd3f91fa4b05777c936cb95fbfee04b5955e366755e682368e626d004f07d9c75'
            'dfffeb04a403e7eeb67e0fd5e611f2e428569b68139324fe7af8dee7e7b7cacb'
            '0b5ae4357c8b383b30235172a10b673eb2bfa5d640cfe86dd0b890d0d8c3dcc0'
            '07614e2a07ab61e95572da44b22b7a05b14d958ec62f4c400f7527104ff3492f')

pkgver() {
	cd ${pkgname/-git/}
	# https://wiki.archlinux.org/index.php/VCS_package_guidelines#The_pkgver.28.29_function
	( set -o pipefail
	git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
		printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
	)
}

prepare() {
	cd ${pkgname/-git/}

	# https://github.com/mariusae/trickle/issues/16
	patch -Np1 -i ../remove-libtrickle.patch

	# https://aur.archlinux.org/packages/trickle-git#comment-885736
	# https://github.com/mariusae/trickle/pull/29
	patch -Np1 -i ../fix-trickle-overload.patch

	# Fix rpc support, https://github.com/mariusae/trickle/pull/28
	patch -Np1 -i ../4171f1716eb2e37d36fb9189800c53b83723569d.patch

	# Use $libdir for preload object lookup, https://github.com/mariusae/trickle/pull/29
	patch -Np1 -i ../29de2a4704d9843d3c6cba1d4a4ac177f2d6e568.patch
        patch -Np1 -i ../trickle-gcc14.patch
        autoconf
}

build() {
	cd ${pkgname/-git/}

	autoreconf -if
	./configure --prefix=/usr \
		--mandir=/usr/share/man
	make -j1
}

package() {
	cd ${pkgname/-git/}

	make DESTDIR="${pkgdir}" install
	install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ LICENSE
}

patch with sha256 sum '07614e2a07ab61e95572da44b22b7a05b14d958ec62f4c400f7527104ff3492f':

diff --git a/configure.in b/configure.in
index 6ebf3b2..5c85682 100644
--- a/configure.in
+++ b/configure.in
@@ -198,6 +198,7 @@ if test "$HAVEMETHOD" = "no"; then
         AC_TRY_RUN(
         #include <dlfcn.h>
         #include <stdio.h>
+        #include <stdlib.h>
     
         int
         main(int argc, char **argv)
diff --git a/xdr.c b/xdr.c
index ed8bf5b..a20bbd9 100644
--- a/xdr.c
+++ b/xdr.c
@@ -103,7 +103,7 @@ xdr_msg(XDR *xdrs, struct msg *msg)
 {
 	X(xdr_short(xdrs, &msg->status));
 	X(xdr_union(xdrs, (int *)&msg->type, (char *)&msg->data,
-	      xdr_msg_discrim, _xdr_void));
+	      xdr_msg_discrim, (xdrproc_t)_xdr_void));
 
 	return (TRUE);
 }

perpetuallyhorni avatar May 27 '24 23:05 perpetuallyhorni

FIXED

I have successfully built. All I did was apply the patch above to regular trickle from AUR as opposed to applying it to trickle-git.

PKGBUILD:

# Maintainer:  Jonathon Fernyhough <jonathon+m2x+dev>
# Contributor: Jaroslav Lichtblau <[email protected]>
# Contributor: Romain Bouchaud-Leduc <[email protected]>

pkgname=trickle
pkgver=1.07
pkgrel=12
pkgdesc="Lightweight userspace bandwidth shaper"
arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
url="https://github.com/mariusae/trickle"
license=('BSD')
depends=('libevent' 'libtirpc')
_commit=a2aeb9f30aa3c651580b9be9ba3c9c13bf51a416 # "import of trickle 1.07"
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/mariusae/trickle/archive/${_commit}.tar.gz"
        "fix-crasher.patch"
        "$url/commit/20f221f166fc03323ed28dc3cad0b0da2c879513.patch"
        trickle-gcc14.patch)
sha256sums=('b07ffdff831d11972dc802a4fc2d4000af844933b39ad7f88de20a2866a55f37'
            '495aeb95039dcdeb3bfde46c40b3391fe2416ec51678a1ded9bbeced6f6d1349'
            '432194c2a25e934a865a06de9fa876545431a1729028ca1a60943554865fb40c'
            '07614e2a07ab61e95572da44b22b7a05b14d958ec62f4c400f7527104ff3492f')

prepare() {
  cd $pkgname-$_commit

  # FS#27549
  sed -i 's|^_select(int|select(int|' trickle-overload.c

  # FS#35872
  patch -Np1 -i ../fix-crasher.patch

  # Fix build with -Werror=format-security, https://github.com/mariusae/trickle/commit/20f221f166fc03323ed28dc3cad0b0da2c879513
  patch -Np1 -i ../20f221f166fc03323ed28dc3cad0b0da2c879513.patch
  patch -Np1 -i ../trickle-gcc14.patch
  autoconf
}

build() {
  cd $pkgname-$_commit

  CPPFLAGS+=" -I/usr/include/tirpc/"
  LDFLAGS+=" -ltirpc"

  ./configure --prefix=/usr \
              --mandir=/usr/share/man \
              --build=$(gcc -dumpmachine)
  sed -i "s|.*in_addr_t.*||g" config.h
  make -j1
}

package(){
  cd $pkgname-$_commit

  make DESTDIR="${pkgdir}" install
  install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ LICENSE
}

perpetuallyhorni avatar May 27 '24 23:05 perpetuallyhorni

FIXED

I have successfully built. All I did was apply the patch above to regular trickle from AUR as opposed to applying it to trickle-git.

PKGBUILD:

# Maintainer:  Jonathon Fernyhough <jonathon+m2x+dev>
# Contributor: Jaroslav Lichtblau <[email protected]>
# Contributor: Romain Bouchaud-Leduc <[email protected]>

pkgname=trickle
pkgver=1.07
pkgrel=12
pkgdesc="Lightweight userspace bandwidth shaper"
arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
url="https://github.com/mariusae/trickle"
license=('BSD')
depends=('libevent' 'libtirpc')
_commit=a2aeb9f30aa3c651580b9be9ba3c9c13bf51a416 # "import of trickle 1.07"
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/mariusae/trickle/archive/${_commit}.tar.gz"
        "fix-crasher.patch"
        "$url/commit/20f221f166fc03323ed28dc3cad0b0da2c879513.patch"
        trickle-gcc14.patch)
sha256sums=('b07ffdff831d11972dc802a4fc2d4000af844933b39ad7f88de20a2866a55f37'
            '495aeb95039dcdeb3bfde46c40b3391fe2416ec51678a1ded9bbeced6f6d1349'
            '432194c2a25e934a865a06de9fa876545431a1729028ca1a60943554865fb40c'
            '07614e2a07ab61e95572da44b22b7a05b14d958ec62f4c400f7527104ff3492f')

prepare() {
  cd $pkgname-$_commit

  # FS#27549
  sed -i 's|^_select(int|select(int|' trickle-overload.c

  # FS#35872
  patch -Np1 -i ../fix-crasher.patch

  # Fix build with -Werror=format-security, https://github.com/mariusae/trickle/commit/20f221f166fc03323ed28dc3cad0b0da2c879513
  patch -Np1 -i ../20f221f166fc03323ed28dc3cad0b0da2c879513.patch
  patch -Np1 -i ../trickle-gcc14.patch
  autoconf
}

build() {
  cd $pkgname-$_commit

  CPPFLAGS+=" -I/usr/include/tirpc/"
  LDFLAGS+=" -ltirpc"

  ./configure --prefix=/usr \
              --mandir=/usr/share/man \
              --build=$(gcc -dumpmachine)
  sed -i "s|.*in_addr_t.*||g" config.h
  make -j1
}

package(){
  cd $pkgname-$_commit

  make DESTDIR="${pkgdir}" install
  install -Dm644 -t "${pkgdir}"/usr/share/licenses/${pkgname}/ LICENSE
}

Yes this worked for me too. Only on trickle from AUR (v1.07-12), but not on the more recent version.

rtikw avatar Jun 01 '24 12:06 rtikw

I just pushed the patch to the trickle-git AUR, i should work again now (for me it does).

mkurz avatar Mar 22 '25 20:03 mkurz

It doesn't compile on my system. Any solutions?

https://pastebin.com/QPRLrSp4

[...]

/bin/sh ./libtool  --tag=CC   --mode=link gcc -Wall -Icompat -I/usr/include/tirpc -ltirpc  -march=native -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto  -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now          -Wl,-z,pack-relative-relocs -flto=auto -o trickle trickle.o util.o getopt.o  -lnsl  -ldl
libtool: link: gcc -Wall -Icompat -I/usr/include/tirpc -march=native -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto=auto -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-z -Wl,pack-relative-relocs -flto=auto -o trickle trickle.o util.o getopt.o  -ltirpc -lnsl -ldl
gcc -DHAVE_CONFIG_H -I.    -Wall -Icompat -I/usr/include/tirpc -ltirpc  -march=native -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto -c -o trickled.o trickled.c
gcc -DHAVE_CONFIG_H -I.    -Wall -Icompat -I/usr/include/tirpc -ltirpc  -march=native -O3 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -flto=auto -c -o atomicio.o atomicio.c
atomicio.c: In function ‘atomicio’:
atomicio.c:40:1: warning: old-style function definition [-Wold-style-definition]
   40 | atomicio(f, fd, _s, n)
      | ^~~~~~~~
atomicio.c:50:23: error: too many arguments to function ‘f’; expected 0, have 3
   50 |                 res = (f) (fd, s + pos, n - pos);
      |                       ^    ~~
make[1]: *** [Makefile:527: atomicio.o] Error 1
make[1]: Leaving directory '/home/myxi/.cache/paru/clone/trickle-git/src/trickle'
make: *** [Makefile:410: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
error: failed to build 'trickle-git-r23.09a1d95-4':
error: packages failed to build: trickle-git-r23.09a1d95-4

Update

I managed to "install" it. I ran a Ubuntu 22.04 container, installed it there, then copied over the files to my host system.

host > docker run -it ubuntu:22.04 bash

docker > apt update && apt install trickle -y

host > docker ps # find the container id
host > sudo mkdir /usr/lib/x86_64-linux-gnu/trickle -p
host > docker cp <id>:/usr/lib/x86_64-linux-gnu/trickle/trickle-overload.so /usr/lib/x86_64-linux-gnu/trickle/
host > docker cp <id>:/usr/bin/trickle ~/.local/bin/

[!NOTE] I tried LD_PRELOAD thing to avoid having to create /usr/lib/x86_64-linux-gnu/trickle but it doesn't work since it is hardcoded to find the .so file on that path (I checked with strace).

I couldn't use it for my purposes (the app kept crashing after some time), but I don't think it's because I didn't install trickle properly:

❯ trickle -sd 200 -u 111 -- speedtest++ --download
SpeedTest++ version 1.15
Speedtest.net command line interface
Info: https://github.com/taganaka/SpeedTest
Fixed: https://github.com/gglluukk/SpeedTest
Author: Francesco Laurita <[email protected]>

Server: ...
Ping: 100 ms.
Jitter: 3 ms.
Determine line type (2) ....
Very-slow-line line type detected: profile selected slowband

Testing download speed (2) ............................
Download: 1.79 Mbit/s

(200kB == 1.6 Mbit)

eeriemyxi avatar Jun 27 '25 14:06 eeriemyxi

@eeriemyxi Which version of gcc you have installed?

$ pacman -Qii gcc

mkurz avatar Jun 30 '25 07:06 mkurz

@eeriemyxi Which version of gcc you have installed?

$ pacman -Qii gcc
Installed From  : cachyos-znver4
Name            : gcc
Version         : 15.1.1+r7+gf36ec88aa85a-2
Description     : The GNU Compiler Collection - C and C++ frontends
Architecture    : x86_64_v4
URL             : https://gcc.gnu.org
Licenses        : GPL-3.0-with-GCC-exception  GFDL-1.3-or-later
Groups          : None
Provides        : gcc-multilib
Depends On      : gcc-libs=15.1.1+r7+gf36ec88aa85a-2  binutils>=2.28  libmpc
                  zstd  libisl.so=23-64
Optional Deps   : lib32-gcc-libs: for generating code for 32-bit ABI [installed]
Required By     : base-devel  clang  lib32-clang  libgccjit  rust
Optional For    : node-gyp  xorg-xrdb
Conflicts With  : None
Replaces        : gcc-multilib
Installed Size  : 207.77 MiB
Packager        : CachyOS <[email protected]>
Build Date      : Tuesday 29 April 2025 08:24:21 PM
Install Date    : Friday 20 June 2025 11:00:10 PM
Install Reason  : Installed as a dependency for another package
Install Script  : No
Validated By    : Signature
Backup Files    : None
Extended Data   : pkgtype=split

eeriemyxi avatar Jun 30 '25 09:06 eeriemyxi