Package Details: cado-nfs-git 20221005.5e2777b62-1

Git Clone URL: https://aur.archlinux.org/cado-nfs-git.git (read-only, click to copy)
Package Base: cado-nfs-git
Description: Implementation of the Number Field Sieve (NFS) algorithm for factoring integers
Upstream URL: http://cado-nfs.gforge.inria.fr/
Licenses: LGPL2
Conflicts: cado-nfs
Provides: cado-nfs
Submitter: jdetrey
Maintainer: AquilaIrreale
Last Packager: AquilaIrreale
Votes: 4
Popularity: 0.099937
First Submitted: 2015-12-07 12:57 (UTC)
Last Updated: 2022-10-06 18:14 (UTC)

Latest Comments

1 2 3 4 Next › Last »

AquilaIrreale commented on 2022-10-06 18:21 (UTC) (edited on 2022-10-06 18:22 (UTC) by AquilaIrreale)

@gilcu3 the [ was not extra (it is a special character to be escaped) but apparently, depending on the sed implementation, when present inside a character class it has to be at the very end of it; fixed.

Regarding the strip option, if that's the case then we'll have to keep the sed and -ffile-prefix-map in as you proposed.

gilcu3 commented on 2022-10-05 07:17 (UTC) (edited on 2022-10-05 07:18 (UTC) by gilcu3)

@AquilaIrreale in the last version there is an extra character in the sed command line 70 (one extra '[') which breaks the packaging.

Regarding fixing the commit hash, yes I only had it because at some point building was not working in the last commit, must have been fixed already.

Regarding the strip option, yes I get ==> WARNING: Package contains reference to $srcdir even with the option on.

AquilaIrreale commented on 2022-10-04 22:36 (UTC) (edited on 2022-10-04 22:38 (UTC) by AquilaIrreale)

@gilcu3 thank you for your suggestions, I adopted some of them, with a couple modifications (mainly making sed sturdier against strange characters in the build path, although it's probably futile anyways, since I could not think of a way to protect -ffile-prefix-map=old=new against spaces during the expansion of the $FLAGS variables, and I'm not sure how it behaves in the presence of embedded equal signs (=) in the old and new patterns).

I am not going go to hardcode the commit hash, this being a -git package it should always build the most recent version available on master, and I removed the strip option, that one should be set in makepkg.conf on a per-user basis, even if not having it has the chance to leave additional references to $srcdir in the built binaries (which is expected behavior).

P.s. come to think of it, in my builds it never put references to the $srcdir in my binaries (I always had strip on by default). Are you sure we need all the header file sed'ing and -ffile-prefix-map at all and it's not just the strip option that's fixing it for you?

@ccorn yeah, I left out a cd when I moved the generation of local.sh from build() to prepare() and it somehow still appeared to work fine. Teach me to double check, really, smh :/

ccorn commented on 2022-10-02 08:19 (UTC)

If you are wondering why the package filelist gets messed up with build dirs: Well, local.sh needs to be put into the cado-nfs checkout... ;-)

gilcu3 commented on 2022-09-29 08:11 (UTC)

@Aquilarreale I agree it is quite convoluted. I fixed a few things in the PKGBUILD, mostly this problem with local.sh not being read and another where the $srcdir was embedded in some binaries, feel free to take it as such:

# Maintainer Simone Cimarelli a.k.a. AquilaIrreale <aquilairreale@ymail.com>
# Contributor Jérémie Detrey
# Contributor Christian Cornelssen

_pkg=cado-nfs
pkgname=${_pkg}-git
pkgver=20220915.5fb07ce72
pkgrel=1
pkgdesc="Implementation of the Number Field Sieve (NFS) algorithm for factoring integers"
arch=('x86_64')
url="http://cado-nfs.gforge.inria.fr/"
license=('LGPL2')
# We configure with optional curl, hwloc, gmp-ecm.
# Configuring with hwloc makes binaries in linalg/bwc depend on it.
depends=('gmp' 'python' 'sqlite' 'hwloc')
makedepends=('git' 'cmake' 'inetutils' 'curl' 'gmp-ecm')
optdepends=('curl: for cado-nfs-client.py'
            'gmp-ecm: for JL DLP polynomial selection'
            'perl: for bwc.pl')
conflicts=('cado-nfs')
provides=('cado-nfs')
source=("git+https://gitlab.inria.fr/cado-nfs/${_pkg}.git#commit=5fb07ce722f1b8b1a9e18f444ef92b1ceedad759"
        fmt.patch)
sha384sums=('SKIP'
            '496b2b68ed11d3ad7c5febffd900475502b871bb4541307eb909eb23e0faa9f2e45856393b2c8bf45ab54cdf02c40e58')
options=(strip)
# Need -march for SIMD support. Makes the resulting package less portable.
_march=native

_update_march()
{
  local flags_no_march=''

  for f in $1; do
    if ! [[ "$f" =~ -march=.* ]]; then
      flags_no_march+=" $f"
    fi
  done

  echo "${flags_no_march} -march=$_march"
}

pkgver() {
  cd "$_pkg"
  git log -1 --format="%cd.%h" --date=short | sed 's/-//g'
}

prepare() {
  patch -d "$_pkg" -p1 < fmt.patch
  cd  "$_pkg"
  cat <<EOF >local.sh
PREFIX=/usr
HWLOC="\$PREFIX"
GMPECM="\$PREFIX"
CURL="\$PREFIX"
# Remove 32-bit barriers to big factorizations
FLAGS_SIZE="-DSIZEOF_P_R_VALUES=8 -DSIZEOF_INDEX=8"
EOF
}

build() {
  cd "$_pkg"

  CFLAGS="$(_update_march "$CFLAGS") -ffile-prefix-map=${srcdir}=."
  CPPFLAGS="$(_update_march "$CPPFLAGS") -ffile-prefix-map=${srcdir}=."
  CXXFLAGS="$(_update_march "$CXXFLAGS") -ffile-prefix-map=${srcdir}=."

  make cmake
  escaped=$(echo "${srcdir}" | sed 's/\//\\\//g')
  find ./build -type f -name "*.h" -exec sed -i -e "s/${escaped}/${_pkg}/g" {} \;

  make
}

package() {
  cd "$_pkg"
  make DESTDIR="$pkgdir" install
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}

# vim:set ts=2 sw=2 et:

AquilaIrreale commented on 2022-09-28 22:22 (UTC)

@gilcu3 strange, it should be picking it up automatically from the local.sh script.. anyhow yeah, this build system is a bit (unneededly?) convoluted. Just to be sure, do you need to add it to the build() make command, to the one in install() or both?

gilcu3 commented on 2022-09-24 21:50 (UTC) (edited on 2022-09-26 09:16 (UTC) by gilcu3)

@AquilaIrreale The output is empty for that command. The PKGBUILD is somehow registering the files in the local folder and not in the global one.

EDIT: For some reason the behavior changes depending on which folder I build the package, maybe a bug related to the buildsystem. The problem seems to be the PREFIX variable, that for some reason is not setup properly. Addidng export PREFIX=/usr before the make command fixes the issue for me.

AquilaIrreale commented on 2022-09-24 21:01 (UTC) (edited on 2022-09-24 21:10 (UTC) by AquilaIrreale)

@gilcu3 what do you mean? make install puts both cado-nfs.py and cado-nfs-client.py under /usr/bin (which should most definitely be in your $PATH).

Could you please post the output of

pacman -Qql cado-nfs-git | grep '^/usr/bin'

just to make sure?

gilcu3 commented on 2022-09-24 09:44 (UTC) (edited on 2022-09-24 09:44 (UTC) by gilcu3)

@AquilaIrreale Thank for the fix.

In the current version of the package you are running make install, but not the specific install commands for the executables, so the cado-nfs.py file is not ending up in the global path.

AquilaIrreale commented on 2022-09-23 18:27 (UTC)

@gilcu3 fixed it as you suggested by adding a patch to disable detection of system-installed fmt version.

I did not have Arch's fmt on my system so for me it was already using its own bundled version automatically and I never noticed the incompatibility, so thank you for reporting the issue.