Hi, We recently worked through the situation where we had a collection of packages which used LAPACK and some of them required the ILP64 (64-bit integer) ABI. The environment had >100 packages in R, Java, C and Python (+ python C extensions), and many of them called BLAS/LAPACK functions. Due to the size of the software stack, it is prone to symbol clashes and ABI mismatches: a package expectes `cblas_dgemm` to have the ILP64 ABI, but if some other package has already loaded a library with the LP64 ABI, the function receives 64-bit ints where it expected 32-bit integers, and it segfaults or corrupts data.
To avoid the problem, we're rebuilding the whole environment so that we only load the -ilp64 BLAS and LAPACK variants; all user code uses 64-bit integers at the BLAS/LAPACK interface, and all calls properly name-mangled routines. One part of this effort is a patch for the GSL library, which makes it possible to build GSL in the ILP64-only environment. I uploaded the patch to github here: https://github.com/ev-br/gsl-orig/pull/1 Would GSL maintainers be interested in accepting this kind of a patch? To be honest, I'm not enterely sure this is a correct venue to ask about a patch---would appreciate pointers to a better venue if this is not the right one! In case this is not completely wrong mailing list, a couple of quick notes: - the patch does not try to allow problem sizes > INT_MAX in GSL submodules. 32-bit integer overflows in BLAS-using code are exactly what they are; the only thing the patch does is it allows building/linking to ILP64-only BLAS; - a large part of the patch is the build system support: a new `--with-blas-ilp64=` switch to the `configure` script + RPATH support. The key use case was linking to MKL, installed to /opt/intel instead of the standard library paths. I'd be happy to tweak this part of course, according to maintainers' preference; - the name mangling machinery is taken verbatim from SciPy; In SciPy, we test it for several BLAS providers (MLK, OpenBLAS, Apple Accelerate), so I included it verbatim. In SciPy however, we use Fortran names directly, not CBLAS interface, so this part of the patch does quite a bit more than GSL needs. Am also happy to trim this down if desired. One other note is that SciPy parts are BSD-licensed. - last but not least, the patch is generated with pretty heavy AI usage (Claude Sonnet to be specific). Not sure what is the project's stance w.r.t. using these kinds of tools? In any case, there's a human in the loop (me), I carefully review/rework every line of code, take responsibility for all code and so on. Cheers, Evgeni Burovski
