msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.28k stars 1.22k forks source link

Unification of package scotch naming #19678

Open 3rav opened 10 months ago

3rav commented 10 months ago

Package name

mingw-w64-scotch

New version number

No response

Other information that may be useful

May I ask you to update the scotch package, more precisely, to unify the int64 version so that it fits as: openblas64 or arpack64? Currently it is impossible to have both int32 and int64 versions

Since version 7 it is possible to use CMake https://gitlab.inria.fr/scotch/scotch/-/commit/e79c9301dc19df60d9e11d3c0e5717930b55ec58

Are you willing to submit a PR?

No response

3rav commented 4 months ago

?

3rav commented 2 months ago

New version (7.0.5) is available and it includes:

The installation of Scotch on Windows-like environments has been improved.
Native Windows threads are now supported.
The CMake compilation chain is now fully mature.
New routines have been added, to run the upcoming "ScotchPy" Python interface for Scotch and PT-Scotch.

https://gitlab.inria.fr/scotch/scotch/-/releases/v7.0.5

3rav commented 1 month ago

@mmuetzel @Biswa96

May I ask you for help, I have two problems:

  1. .dll library files are not installed to the BIN directory, even though they are in the folders: build-MINGW64-shared-32/bin
  2. There is no distinction in file/folder names of int32 and int64 versions
# Contributor: Oleg A. Khlybov <fougas@mail.ru>

_realname=scotch
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
         "${MINGW_PACKAGE_PREFIX}-${_realname}64")
pkgdesc='Graph partitioning and sparse matrix ordering package (mingw-w64)'
pkgver=7.0.5
pkgrel=1
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://www.labri.fr/perso/pelegrin/scotch/"
msys2_repository_url="https://gitlab.inria.fr/scotch/scotch"
license=('spdx:CECILL-C')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-libsystre")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
         "${MINGW_PACKAGE_PREFIX}-ninja"
             $([[ ${CARCH} == aarch64 ]] || echo "${MINGW_PACKAGE_PREFIX}-msmpi"))
options=('!strip')
source=("https://gitlab.inria.fr/scotch/scotch/-/archive/v${pkgver}/${_realname}-v${pkgver}.tar.gz"
        "Makefile.idx32.inc"
        "Makefile.idx64.inc"
        "0002-pipe-fix.patch"
        "0004-dummysizes-regex.patch")
sha256sums=('385507a9712bb9057497b9ac3f24ad2132bd3f3f8c7a62e78324fc58f2a0079b'
            '4221b69dcc53230ff4d6bc18e3982f6d39971a99fc17f4dab609fc19b99d8a30'
            'c52bf0598332d8139a37606e7ea9376b7f841059047c0c977b205a763fc7e97a'
            'b6e76b1d2f35b3fcc771b97a35a468d6314ee3a619defef18b82fc7654638a49'
            '15dd82d4c7b118e08316df4242d647bdaa1f180ff143ee33fe84633c97aac111')

prepare() {
  cd "${srcdir}/${_realname}-v${pkgver}"
  for p in ${source[*]:3}; do
    patch -p1 -i "$srcdir/$p"
  done
  #sed -i 's/DESTINATION man/DESTINATION share\/man/g' ${srcdir}/${_realname}-v${pkgver}/CMakeLists.txt
}

_build_scotch() {
  _idx_opt=$1

  declare -a extra_config
  if check_option "debug" "n"; then
    extra_config+=("-DCMAKE_BUILD_TYPE=Release")
  else
    extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
  fi

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -GNinja \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    "${extra_config[@]}" \
    ${_idx_opt} \
    -DINSTALL_METIS_HEADERS=ON \
    -DBUILD_PTSCOTCH=ON \
    -DBUILD_LIBESMUMPS=ON \
    -DBUILD_LIBSCOTCHMETIS=OFF \
    ../${_realname}-v${pkgver}

  ${MINGW_PREFIX}/bin/cmake --build .

}

build() {
  mkdir -p "${srcdir}"/build-${MSYSTEM}-static-32 && cd "${srcdir}"/build-${MSYSTEM}-static-32

  msg2 "Build static Scotch with 32-bit indexing"
  _build_scotch "-DINTSIZE=32"

  mkdir -p "${srcdir}"/build-${MSYSTEM}-shared-32 && cd "${srcdir}"/build-${MSYSTEM}-shared-32

  msg2 "Build shared Scotch with 32-bit indexing"
  _build_scotch "-DINTSIZE=32 -DCMAKE_C_STANDARD_LIBRARIES=-lscotcherr -DBUILD_SHARED_LIBS=ON"

  if [ "${CARCH}" != "i686" ]; then
    mkdir -p "${srcdir}"/build-${MSYSTEM}-static-64 && cd "${srcdir}"/build-${MSYSTEM}-static-64

    msg2 "Build static Scotch with 64-bit indexing"
    _build_scotch "-DINTSIZE=64"

    mkdir -p "${srcdir}"/build-${MSYSTEM}-shared-64 && cd "${srcdir}"/build-${MSYSTEM}-shared-64

    msg2 "Build shared Scotch with 64-bit indexing"
    _build_scotch "-DINTSIZE=64 -DCMAKE_C_STANDARD_LIBRARIES=-lscotcherr -DBUILD_SHARED_LIBS=ON"
  fi

}

package_scotch() {
  pkgdesc="Graph partitioning and sparse matrix ordering package (mingw-w64)"

  # Static Install
  cd "${srcdir}"/build-${MSYSTEM}-static-32
  DESTDIR=${pkgdir} cmake --install . 

  # Shared Install
  cd "${srcdir}"/build-${MSYSTEM}-shared-32
  DESTDIR=${pkgdir} cmake --install . 
  install -Dm644 "${srcdir}"/${_realname}-v${pkgver}/doc/CeCILL-C_V1-en.txt "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}

package_scotch64() {
  pkgdesc="Graph partitioning and sparse matrix ordering package with 64-bit indexing (mingw-w64)"
  provides=()
  conflicts=()

  # Static Install
  cd "${srcdir}"/build-${MSYSTEM}-static-64
  DESTDIR=${pkgdir} cmake --install . 

  # Shared Install
  cd "${srcdir}"/build-${MSYSTEM}-shared-64
  DESTDIR=${pkgdir} cmake --install . 
  install -Dm644 "${srcdir}"/${_realname}-v${pkgver}/doc/CeCILL-C_V1-en.txt "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE
}

# template start; name=mingw-w64-splitpkg-wrappers; version=1.0;
# vim: set ft=bash :

# generate wrappers
for _name in "${pkgname[@]}"; do
  _short="package_${_name#${MINGW_PACKAGE_PREFIX}-}"
  _func="$(declare -f "${_short}")"
  eval "${_func/#${_short}/package_${_name}}"
done
# template end;

https://gitlab.inria.fr/scotch/scotch/-/issues/37

Biswa96 commented 1 month ago

The cmake file may need some changes for the dll path. Could you create a pull request with your changes? It'll help to reproduce the issues.

New 32 bit packages are not being added. Do you need that 32bit condition?

3rav commented 1 month ago

Unfortunately new errors have become apparent (pull request):

Error for mingw64/ucrt64:

[244/520] Linking C shared library bin\libscotch.dll
FAILED: bin/libscotch.dll lib/libscotch.dll.a 
C:\Windows\system32\cmd.exe /C "cd . && D:\M\msys64\mingw64\bin\gcc.exe -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1 -O3 -DNDEBUG   -shared -o bin\libscotch.dll -Wl,--out-implib,lib\libscotch.dll.a -Wl,--major-image-version,7,--minor-image-version,0 @CMakeFiles\scotch.rsp && cd ."
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/arch.c.obj:arch.c:(.text+0x220): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/arch.c.obj:arch.c:(.text+0x238): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/arch.c.obj:arch.c:(.text+0x278): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/arch.c.obj:arch.c:(.text+0x2f8): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/arch_build.c.obj:arch_build.c:(.text+0x6cc): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/arch_build.c.obj:arch_build.c:(.text+0xbe1): more undefined references to `SCOTCH_errorPrint' follow
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/parser_yy.c.obj:parser_yy.c:(.text+0xc2b): undefined reference to `SCOTCH_errorPrintW'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/parser_yy.c.obj:parser_yy.c:(.text+0x1494): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/parser_yy.c.obj:parser_yy.c:(.text+0x18e5): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/parser_yy.c.obj:parser_yy.c:(.text+0x1a71): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/parser_yy.c.obj:parser_yy.c:(.text+0x1a95): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/parser_yy.c.obj:parser_yy.c:(.text+0x1ab9): undefined reference to `SCOTCH_errorPrint'
D:/M/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/libscotch/CMakeFiles/scotch.dir/parser_yy.c.obj:parser_yy.c:(.text+0x1aef): more undefined references to `SCOTCH_errorPrint' follow
collect2.exe: error: ld returned 1 exit status
[245/520] Building C object src/libscotch/CMakeFiles/ptscotch.dir/bdgraph_bipart_ml.c.obj

Error for clang:

[6/520] Building C object src/libscotch/CMakeFiles/dummysizes.dir/dummysizes.c.obj
  FAILED: src/libscotch/CMakeFiles/dummysizes.dir/dummysizes.c.obj 
  D:\M\msys64\clang64\bin\clang.exe -DCOMMON_OS_WINDOWS -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DCOMMON_THREAD_WIN32 -DINTSIZE32 -DSCOTCH_PATCHLEVEL_NUM=5 -DSCOTCH_PTHREAD -DSCOTCH_RELEASE_NUM=0 -DSCOTCH_RENAME -DSCOTCH_VERSION_NUM=7 -Drestrict=__restrict  -march=nocona -msahf -mtune=generic -O2 -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wp,-D__USE_MINGW_ANSI_STDIO=1 -O3 -DNDEBUG -MD -MT src/libscotch/CMakeFiles/dummysizes.dir/dummysizes.c.obj -MF src\libscotch\CMakeFiles\dummysizes.dir\dummysizes.c.obj.d -o src/libscotch/CMakeFiles/dummysizes.dir/dummysizes.c.obj -c C:/_/B/src/scotch-v7.0.5/src/libscotch/dummysizes.c
  In file included from C:/_/B/src/scotch-v7.0.5/src/libscotch/dummysizes.c:94:
  In file included from C:/_/B/src/scotch-v7.0.5/src/libscotch/common.h:153:
  C:/_/B/src/scotch-v7.0.5/src/libscotch/pthread_win32.h:87:13: error: use of undeclared identifier 'EINVAL'
     87 |     return (EINVAL);
        |             ^
  C:/_/B/src/scotch-v7.0.5/src/libscotch/pthread_win32.h:91:13: error: use of undeclared identifier 'EAGAIN'
     91 |     return (EAGAIN);
        |             ^
  C:/_/B/src/scotch-v7.0.5/src/libscotch/pthread_win32.h:114:15: error: use of undeclared identifier 'EINVAL'
    114 |       return (EINVAL);
        |               ^
  C:/_/B/src/scotch-v7.0.5/src/libscotch/pthread_win32.h:132:13: error: use of undeclared identifier 'EINVAL'
    132 |     return (EINVAL);
        |             ^
  C:/_/B/src/scotch-v7.0.5/src/libscotch/pthread_win32.h:156:13: error: use of undeclared identifier 'EINVAL'

    156 |     return (EINVAL);

        |             ^

  C:/_/B/src/scotch-v7.0.5/src/libscotch/pthread_win32.h:169:13: error: use of undeclared identifier 'EINVAL'

    169 |     return (EINVAL);

        |             ^

  C:/_/B/src/scotch-v7.0.5/src/libscotch/pthread_win32.h:215:13: error: use of undeclared identifier 'EINVAL'

    215 |     return (EINVAL);

        |             ^

  7 errors generated.

  ninja: build stopped: subcommand failed.
mmuetzel commented 1 month ago

New 32 bit packages are not being added. Do you need that 32bit condition?

I haven't looked into Scotch. But since @3rav is comparing it to OpenBLAS or ARPACK, I guess this is about 32-bit indices (for matrix indexing in linear algebra) and not about 32-bit binaries. The background to this is that most linear algebra libraries to this day are based on BLAS (and LAPACK). These are written in Fortran in their reference implementations. These libraries are using integer arrays in their interfaces to pass matrix indices. Integers in Fortran are 32-bit by default (independent of whether the binaries are built for 32-bit or 64-bit pointer systems). So, most linear algebra libraries are using 32-bit integers for indices by default.

Some linear algebra libraries started to support opting into 64-bit indices. But if a user does that, every linear algebra library must use that same index size. You can't mix, e.g., a BLAS library that is built with 32-bit indices with an ARPACK library with 64-bit indices . Some of these libraries added options to name the libraries (and headers) differently if they are built with the (non-default) 64-bit index size. But some did not. I don't know what the case is for Scotch.

To allow users and downstream developers to opt into one or the other index size, some distributors started to create separate packages for one and for the other index size. I guess @3rav's goal is to additionally provide a scotch package that is built with 64-bit indices that doesn't conflict with the default version of scotch (that is built with 32-bit indices).

3rav commented 1 month ago

Exactly @mmuetzel, I want to build CalculiX in the basic version as well as in the i8 version for very large models

ccx: needs pastix, arpack, openblas; pastix needs scotch
ccx i8: needs pastix i8, arpack i8, openblas i8, pastix i8 needs scotch i8
3rav commented 1 month ago

Draft version: https://github.com/msys2/MINGW-packages/pull/22063

clang off shared off