mariusae / trickle

Trickle is a userland bandwidth shaper for Unix-like systems.
https://www.usenix.org/legacy/event/usenix05/tech/freenix/full_papers/eriksen/eriksen.pdf
Other
549 stars 61 forks source link

[FIXED] can't compile on Arch #34

Open perpetuallyhorni opened 1 month ago

perpetuallyhorni commented 1 month ago

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 commented 1 month ago

my PKGBUILD:

# Maintainer:  Jonathon Fernyhough <jonathon at+m2x dev>
# Contributor: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: Romain Bouchaud-Leduc <r0m1.bl@camaris.org>

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 commented 1 month ago

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 <svetlemodry@archlinux.org>
# Contributor: Romain Bouchaud-Leduc <r0m1.bl@camaris.org>

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
}
rtikw commented 1 month ago

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 <svetlemodry@archlinux.org>
# Contributor: Romain Bouchaud-Leduc <r0m1.bl@camaris.org>

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.