undefined reference to zgesdd_, zgesv_, zgetri_, zgetrf_

Issue #370 wontfix
rpal created an issue

Hi!

I get undefined reference error when trying to compile my code. It includes matrix multiplications and inversions. I use cygwin, and blaze, blas and lapack are installed.

Thank you!

g++ -mcmodel=large -L/usr/local/lib/ -lblas -llapack BlazeTest.cpp
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc8URigd.o:BlazeTest.cpp:(.rdata$.refptr.zgesdd_[.refptr.zgesdd_]+0x0): undefined reference to zgesdd_'

/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc8URigd.o:BlazeTest.cpp:(.rdata$.refptr.zgesv_[.refptr.zgesv_]+0x0): undefined reference to zgesv_'
/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc8URigd.o:BlazeTest.cpp:(.rdata$.refptr.zgetri_[.refptr.zgetri_]+0x0): undefined reference to zgetri_'

/usr/lib/gcc/x86_64-pc-cygwin/9.3.0/../../../../x86_64-pc-cygwin/bin/ld: /tmp/cc8URigd.o:BlazeTest.cpp:(.rdata$.refptr.zgetrf_[.refptr.zgetrf_]+0x0): undefined reference to zgetrf_'
collect2: error: ld returned 1 exit status

Comments (5)

  1. Klaus Iglberger

    Hi!

    Thanks for reporting this potential defect. This is clearly a linking error, but without further information there is nothing we can do. You you please provide the information which BLAS/LAPACK library you use? Could you please also provide a minimum example to give us an idea of the kind of matrix you are trying to invert? Thank you,

    Best regards,

    Klaus!

  2. rpal reporter

    Hi,

    sorry for the lack of details. What I’m using is: blaze v 3.7 , lapack v. 3.9.0, blas v 3.8.0 on Cygwin on Windows 10.

    and this is my code:

    #include <vector>
    #include <fstream>
    #include <iostream>
    #include <complex>
    #include <blaze/Blaze.h>
    #include <blaze/Math.h>
    #include <blaze/math/HermitianMatrix.h>
    #include <blaze/math/LAPACK.h>

    using namespace blaze;
    using blaze::DynamicVector;
    using blaze::columnVector;
    using blaze::rowVector;
    using blaze::StaticVector;
    using cplx = std::complex<double>;
    using blaze::HermitianMatrix;
    using blaze::DynamicMatrix;
    using blaze::rowMajor;

    int main(int argc, char **argv) {

    blaze::StaticVector<cplx,2UL,columnVector> s1_vv{cplx(-2.0,3.0),cplx(3.0,-1.0)};
    blaze::StaticVector<cplx,2UL,columnVector> s1_vh{cplx(-5.0,6.0),cplx(10.0,-15.0)};
    blaze::StaticVector<cplx,2UL,columnVector> s2_vv{cplx(10.0,3.0),cplx(3.0,-1.0)};
    blaze::StaticVector<cplx,2UL,columnVector> s2_vh{cplx(5.0,7.0),cplx(1.0,5.0)};

    blaze::DynamicMatrix<cplx> T11(2UL,2UL,cplx{0,0}); // The Hermitian matrix A
    blaze::DynamicMatrix<cplx> T22(2UL,2UL,cplx{0,0}); // The Hermitian matrix A
    blaze::DynamicMatrix<cplx> W12(2UL,2UL,cplx{0,0}); // The Hermitian matrix A
    blaze::DynamicMatrix<cplx> W21(2UL,2UL,cplx{0,0}); // The Hermitian matrix A

    blaze::HermitianMatrix< blaze::DynamicMatrix<cplx> > M_1; // The Hermitian matrix A
    blaze::HermitianMatrix< blaze::DynamicMatrix<cplx> > M_2; // The Hermitian matrix A

    blaze::DynamicVector<cplx,columnVector> m1(2UL); // The vector for the real eigenvalues
    blaze::DynamicMatrix<cplx,rowMajor> V1(2UL,2UL); // The matrix for the left eigenvectors
    blaze::DynamicVector<cplx,columnVector> m2(2UL); // The vector for the real eigenvalues
    blaze::DynamicMatrix<cplx,rowMajor> V2(2UL,2UL); // The matrix for the left eigenvectors
    blaze::DynamicVector<cplx,columnVector> k1(2UL);
    blaze::DynamicVector<cplx,columnVector> k2(2UL);
    blaze::DynamicMatrix<cplx> A(2UL,2UL,cplx{0,0});
    blaze::DynamicMatrix<cplx> B(2UL,2UL,cplx{0,0});
    blaze::DynamicMatrix<cplx> C(2UL,2UL,cplx{0,0});
    int i,N_ML;
    N_ML=2;

    for (i=0;i<N_ML;i++)
    {

    k1[0]=s1_vv[i];
    k1[1]=cplx(2.0,0)*s1_vh[i];

    k2[0]=s2_vv[i];
    k2[1]=cplx(2.0,0)*s2_vh[i];
    A=outer(k1,conj(k1));
    B=outer(k2,conj(k2));
    C=outer(k1,conj(k2));
    T11=T11+A;
    T22=T22+B;
    W12=W12+C;

    }

    if ((rank(T11) == 2) && (rank(T22) == 2) && (rank(W12) == 2) &&(isnan(T11)==false) &&( isnan(T22)==false ) && ( isnan(W12)==false ))
    {
    T11=T11/N_ML;
    T22=T22/N_ML;
    W12=W12/N_ML;
    W21=ctrans(W12);
    M_1=inv(T11)_W12_inv(T22)*W21;
    M_2=inv(T22)_W21_inv(T11)*W12;
    }

    return 0;
    }

  3. Klaus Iglberger

    Hi!

    Thanks a lot for providing additional information. In order to reproduce the issue, we have downloaded BLAS 3.8 and LAPACK 3.9 from the official GitHub repository, build from scratch and compiled your minimum example. We did not experience any problems when linking the LAPACK libraries (i.e. we don’t see linker errors for zgesdd, zgesv, zgetri and zgetrf). From our point of view the problem now can be related to either your environment (i.e. Cygwin) or the LAPACK library. In order to proceed, could you please try another LAPACK library (e.g. OpenBLAS from this GitHub repo)? Thanks for your help,

    Best regards,

    Klaus!

  4. Klaus Iglberger

    Hi!

    We would like to understand the problems you experience and if necessary improve Blaze accordingly. In this case we are depending on your help. We appreciate the extra effort and time. Thanks,

    Best regards,

    Klaus!

  5. Klaus Iglberger

    Hi!

    Since we cannot reproduce the error and without further information we cannot proceed, we close the issue. Thanks for taking the time to report this potential defect,

    Best regards,

    Klaus!

  6. Log in to comment