GNU bug report logs - #57954
[PATCH] gnu: clapack: Use position-independent code for use as a library.

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Tue, 20 Sep 2022 12:42:02 UTC

Severity: normal

Tags: patch

Done: Nicolas Graves <ngraves <at> ngraves.fr>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 57954 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Nicolas Graves <ngraves <at> ngraves.fr>, 57954 <at> debbugs.gnu.org
Subject: Re: [bug#57954] Some details about why and see if there is no other
 solution.
Date: Thu, 22 Sep 2022 17:48:32 +0200
[Message part 1 (text/plain, inline)]

On 20-09-2022 14:58, Nicolas Graves via Guix-patches via wrote:
> 
> I am trying to get a vosk package to work for guix.
> The build process is a bit tricky with replaced dependencies etc.
> 
> The team from vosk uses a version where they replace fortran by having
> both openblas and clapack in libraries (which is incompatible in the
> base kaldi configuration, so they have their own fork).
> 
> I don't know why exactly the library should be called from another
> place, but when compiling kaldi with clapack, I get the following
> message (and siblings):
> 
> ld: /gnu/store/yvc2w9mg554y6i4frvahjhacj0np9c7s-clapack-3.2.1/lib/liblapack.a(ssptrf.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
> 
> I actually does work when recompiling with this flag, but I've also read
> that it might make the package a bit slower.
> 
> In case it might help to answer, here's where I am for this package,
> although not done yet (I still do have to untangle some ffi segmentation
> fault issue) :
> https://git.sr.ht/~ngraves/dotfiles/tree/main/item/packages/vosk.scm
> 
> What is the best option / course of action ?

'kaldi' is compiled as a shared library.  However, going by the error 
message, it is linked to the (static!) clapack.  IIUC, this is not a 
problem per se (the static library would be embedded into the shared 
library IIUC) -- however, shared libraries must be position-independent, 
whereas static libraries aren't by default.

As such, there appear to be three potential solutions:

  * compile the static library as -fPIC (your patch)
  * let kaldi link to a shared clapack (which is -fPIC by default)
  * let 'kaldi' (and its dependent, vosk) be a static library instead
    of a shared library.  Is likely problematic due to 'python-vosk'
    though.

Both 'real' solutions have -fPIC (explicit or implied), so I don't think 
we have to worry about performance.  My default option for deciding 
between static and shared is 'shared' (makes 'clapack' graftable, and 
better interaction with "guix build --repair" and "guix gc --references").

Hence, my proposed (and untested) solution is to make 'kaldi' link to a 
shared clapack.

Greetings,
Maxime.
[OpenPGP_0x49E3EE22191725EE.asc (application/pgp-keys, attachment)]
[OpenPGP_signature (application/pgp-signature, attachment)]

This bug report was last modified 2 years and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.