Skip to content

Building from OpenBLAS 0.3.21 error due to LAPACK_FORTRAN_STRLEN_END #3877

Closed
@mfauvel

Description

@mfauvel

Hello,

I have a c function that use dpbrtf as follows

 dpbtrf_("U", n_, order_, Ab, ldab, info)

The program compiled and openblas was provided by the debian repo of my distribution:

libopenblas-dev/stable,now 0.3.13+ds-3 amd64  [installé]
  Optimized BLAS (linear algebra) library (dev, meta)

And it runs fine (assessed with some handcrafted tests). I try to use the last openblas version (0.3.21) : the compilation was fine but when I try to compile my program with the new openblas library I got an error because of missing argument:

gcc -I /opt/OpenBLAS/include/ -L /opt/OpenBLAS/lib/ -O3 -Wall -pedantic -fpic -shared -o shared_function.so ref_c_func.c -lopenblas -fopenmp -lgfortran
ref_c_func.c: In functionbatch_cholesky_banded’:
ref_c_func.c:579:7: error: too few arguments to functiondpbtrf_579 |       dpbtrf_("U", n_, order_, Ab, ldab, info);
      |       ^~~~~~~
In file included from /opt/OpenBLAS/include/lapack.h:11,
                 from ref_c_func.c:5:
/opt/OpenBLAS/include/lapack.h:12304:42: note: declared here
12304 | #define LAPACK_dpbtrf_base LAPACK_GLOBAL(dpbtrf,DPBTRF)
      |                                          ^~~~~~
/opt/OpenBLAS/include/lapacke_mangling.h:12:39: note: in definition of macroLAPACK_GLOBAL12 | #define LAPACK_GLOBAL(lcname,UCNAME)  lcname##_
      |                                       ^~~~~~
/opt/OpenBLAS/include/lapack.h:12305:6: note: in expansion of macroLAPACK_dpbtrf_base12305 | void LAPACK_dpbtrf_base(
      |      ^~~~~~~~~~~~~~~~~~

When I check in lapack.h, I see that when LAPACK_FORTRAN_STRLEN_END is defined it adds a new parameter to the function dpbtrf_ (from lapack.h)

#define LAPACK_dpbtrf_base LAPACK_GLOBAL(dpbtrf,DPBTRF)
void LAPACK_dpbtrf_base(
    char const* uplo,
    lapack_int const* n, lapack_int const* kd,
    double* AB, lapack_int const* ldab,
    lapack_int* info
#ifdef LAPACK_FORTRAN_STRLEN_END
    , size_t
#endif
);
#ifdef LAPACK_FORTRAN_STRLEN_END
    #define LAPACK_dpbtrf(...) LAPACK_dpbtrf_base(__VA_ARGS__, 1)
#else
    #define LAPACK_dpbtrf(...) LAPACK_dpbtrf_base(__VA_ARGS__)
#endif

I try to comment the line #define LAPACK_FORTRAN_STRLEN_END : the program now compile but I get a segmentation fault.

I don't know how to handle this point: I search but I did not find what is the meaning of the parameter size_t and how to provide this value to the function ?

I am aware of the FAQ to replace the library (https://github.com/xianyi/OpenBLAS/wiki/faq#replacing-system-blasupdating-apt-openblas-in-mintubuntudebian).

ps: the objective of using compiled version of openblas is to use my program on another computer were I cannot install packages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions