Subject: [bug#57954] Some details about why and see if there is no other solution.

From: Maxime Devos <[email-masked]>
Date: Sat, 24 Sep 2022 11:46:36 +0200

On 24-09-2022 10:37, Nicolas Graves wrote:
> 
>>     * compile the static library as -fPIC (your patch)
>>     * let kaldi link to a shared clapack (which is -fPIC by default)
> 
>> Hence, my proposed (and untested) solution is to make 'kaldi' link to a
>> shared clapack.
> 
> Thanks Maxime for your quick answer.
> 
> Just to be sure of what that would imply (using the second answer here:
> https://stackoverflow.com/questions/2649735/how-to-link-static-library-into-dynamic-library-in-gcc):
> 
> 1) We keep the version of clapack patched for -fPIC.
> 2) I need to make a package providing a shared version of clapack based
> on this version of clapack compiled with -fPIC.
> 
> Also, my original patch is wrong, I'll send a corrected one once I
> understand the process.

That should do it AFAIK.

However, going by 
https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html#variable:BUILD_SHARED_LIBS 
, you can ask CMake to do these steps instead.

Also, going by the descriptio of 'clapack': ‘"The CLAPACK library was 
built using a Fortran to C conversion utility
called f2c.  The entire Fortran 77 LAPACK library is run through f2c to 
obtain C code, and then modified to improve readability.  CLAPACK's goal 
is to provide LAPACK for someone who does not have access to a Fortran 
compiler.’

... it sounds like clapack could be replaced with lapack without any 
problems (and even removed), and our 'lapack' package already makes 
shared libraries, which seems like a simpler course of action.

Greetings,
Maxime