Math symbol (blas/lapack) linker error's

Discussion in 'C++' started by pervinder, Sep 22, 2004.

  1. pervinder

    pervinder Guest

    Hi,
    I am building a c++ executable which uses fortan math libs. blas,
    lapack etc.
    But when i build this on HP-UX, i get below linker errors while it
    build
    without anyissues on Sun and Linux platforms.

    dgetrs_ (first referenced in
    .../../output/HPUX_32/lib/acc352/dbg/libmtx.a(denseMatrix.o)) (code)
    dsytrs_ (first referenced in
    .../../output/HPUX_32/lib/acc352/dbg/libmtx.a(denseMatrix.o)) (code)
    zgetrf_ (first referenced in
    ....
    dlamch (first referenced in
    .../../output/tarkits/HPUX_32/acc352/dbg/cadmosPub/pub/lib/32bit/liblapack

    Any poniters as what needs to be done to overcome these link errors ?
    Regards,
    ~Pervinder
     
    pervinder, Sep 22, 2004
    #1
    1. Advertisements

  2. Re: [OT] Math symbol (blas/lapack) linker error's

    pervinder wrote:

    > Hi,
    > I am building a c++ executable which uses fortan math libs. blas,
    > lapack etc.
    > But when i build this on HP-UX, i get below linker errors while it
    > build
    > without anyissues on Sun and Linux platforms.
    >
    > dgetrs_ (first referenced in
    > ../../output/HPUX_32/lib/acc352/dbg/libmtx.a(denseMatrix.o)) (code)
    > dsytrs_ (first referenced in
    > ../../output/HPUX_32/lib/acc352/dbg/libmtx.a(denseMatrix.o)) (code)
    > zgetrf_ (first referenced in
    > ...
    > dlamch (first referenced in
    > ../../output/tarkits/HPUX_32/acc352/dbg/cadmosPub/pub/lib/32bit/liblapack
    >
    > Any poniters as what needs to be done to overcome these link errors ?
    > Regards,
    > ~Pervinder


    This is off-topic here, but here are a few suggestions...

    You could try all combinations of
    a) either capitalizing or not-capitalizing all characters of the
    Fortran function name in your C++ code
    b) appending one (_), two (__) or no () underscores to the name of the
    Fortran function in your C++ code.

    So you might try to declare your Fortran functions in C++ code
    as:
    dgetrs
    dgetrs_
    dgetrs__
    DGETRS
    DGETRS_
    DGETRS__

    In my system the second one works, but it looks like you're also
    using it and it doesn't, so you might want to experiment.


    Also, are you sure you declare your Fortran functions as
    'extern "C"' in your C++ code? An example from my code that
    compiles fine:

    extern "C" void dsyevd_ (char *job, char *uplo, int *n, double *a,
    int *lda, double *w, double *work,
    int *lwork, int *iwork, int *liwork,
    int *info);

    Finally, it looks like the 'dlamch' function referenced from
    lapack itself is missing, so apart from your C++ code not seeing
    the lapack/blas functions dgetrs, dsytrs, zgetrf, your lapack
    lib might require some external library also (like libg2c or blas).
    You might want to check this.

    HTH, if you fix this please let know
    - J.
     
    Jacek Dziedzic, Sep 22, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wolfgang Rueckert

    Linker error - unsolved external symbol

    Wolfgang Rueckert, Jun 30, 2003, in forum: C++
    Replies:
    0
    Views:
    984
    Wolfgang Rueckert
    Jun 30, 2003
  2. Serge
    Replies:
    4
    Views:
    9,043
    Paavo Helde
    Dec 19, 2004
  3. el prinCipante

    Symbol undefined? Linker error!

    el prinCipante, Jan 26, 2004, in forum: C Programming
    Replies:
    2
    Views:
    687
    Mark McIntyre
    Jan 27, 2004
  4. Edward C. Jones
    Replies:
    1
    Views:
    437
    RickMuller
    Apr 23, 2005
  5. Ken Dere
    Replies:
    1
    Views:
    956
    Robert Kern
    Jul 24, 2006
  6. Replies:
    2
    Views:
    794
    Bernard Bru
    Oct 23, 2006
  7. echidnasunrise
    Replies:
    0
    Views:
    1,577
    echidnasunrise
    Sep 16, 2008
  8. VK
    Replies:
    15
    Views:
    1,916
    Dr J R Stockton
    May 2, 2010
Loading...