pgCC and ACML

I am having trouble compiling some basic code that uses the ACML library. I am simply making calls to zgetrf and zgetri, and this is what I get:

$ /usr/pgi52/linux86-64/5.2/bin/pgCC -L/usr/pgi52/linux86-64/5.2/lib -lacml test.cc -o test
/usr/pgi52/linux86-64/5.2/lib/libacml.a(ztrtri.o): In function `ztrtri_':
ztrtri.o(.text+0x23e): undefined reference to `ftn_str_copy'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(ilaenv.o): In function `ilaenv_':
ilaenv.o(.text+0x6f): undefined reference to `ftn_str_copy'
ilaenv.o(.text+0x1d0): undefined reference to `ftn_str_copy'
ilaenv.o(.text+0x1f1): undefined reference to `ftn_str_copy'
ilaenv.o(.text+0x212): undefined reference to `ftn_str_copy'
ilaenv.o(.text+0x24e): undefined reference to `ftn_strcmp'
ilaenv.o(.text+0x271): undefined reference to `ftn_strcmp'
ilaenv.o(.text+0x2b7): undefined reference to `ftn_strcmp'
ilaenv.o(.text+0x2f7): undefined reference to `ftn_strcmp'
ilaenv.o(.text+0x337): undefined reference to `ftn_strcmp'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(ilaenv.o)(.text+0x377): more undefined references to `ftn_strcmp' follow
/usr/pgi52/linux86-64/5.2/lib/libacml.a(xerbla.o): In function `xerbla_':
xerbla.o(.text+0x4e): undefined reference to `fio_src_info'
xerbla.o(.text+0x63): undefined reference to `fio_fmtw_init'
xerbla.o(.text+0x7d): undefined reference to `fio_fmt_write'
xerbla.o(.text+0x90): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x95): undefined reference to `fio_fmtw_end'
xerbla.o(.text+0x9e): undefined reference to `ftn_stop'
xerbla.o(.text+0xc5): undefined reference to `ftn_strcmp'
xerbla.o(.text+0xfe): undefined reference to `fio_src_info'
xerbla.o(.text+0x11c): undefined reference to `fio_fmtr_intern_init'
xerbla.o(.text+0x135): undefined reference to `fio_fmt_read'
xerbla.o(.text+0x14e): undefined reference to `fio_fmt_read'
xerbla.o(.text+0x167): undefined reference to `fio_fmt_read'
xerbla.o(.text+0x180): undefined reference to `fio_fmt_read'
xerbla.o(.text+0x185): undefined reference to `fio_fmtr_end'
xerbla.o(.text+0x1e1): undefined reference to `fio_src_info'
xerbla.o(.text+0x1f8): undefined reference to `fio_fmtw_init'
xerbla.o(.text+0x20b): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x223): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x228): undefined reference to `fio_fmtw_end'
xerbla.o(.text+0x242): undefined reference to `fio_src_info'
xerbla.o(.text+0x259): undefined reference to `fio_fmtw_init'
xerbla.o(.text+0x26c): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x271): undefined reference to `fio_fmtw_end'
xerbla.o(.text+0x28a): undefined reference to `ftn_strcmp'
xerbla.o(.text+0x2a4): undefined reference to `fio_src_info'
xerbla.o(.text+0x2bb): undefined reference to `fio_fmtw_init'
xerbla.o(.text+0x2d5): undefined reference to `fio_fmt_write'
xerbla.o(.text+0x2f1): undefined reference to `fio_fmt_write'
xerbla.o(.text+0x2f6): undefined reference to `fio_fmtw_end'
xerbla.o(.text+0x332): undefined reference to `fio_src_info'
xerbla.o(.text+0x350): undefined reference to `fio_fmtw_intern_init'
xerbla.o(.text+0x368): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x380): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x398): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x3b0): undefined reference to `fio_sc_fmt_write'
xerbla.o(.text+0x3b5): undefined reference to `fio_fmtw_end'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(zgemv.o): In function `zgemv_':
zgemv.o(.text+0x6e6): undefined reference to `ftn_str_index'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(zgetrf7art.o): In function `zgetrf7art_':
zgetrf7art.o(.text+0x243): undefined reference to `__mth_i_cddiv'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(ztrsmLkernf.o): In function `ztrsmlkernf_':
ztrsmLkernf.o(.text+0x13a): undefined reference to `__mth_i_cddiv'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(ztrsmUkernf.o): In function `ztrsmukernf_':
ztrsmUkernf.o(.text+0x14a): undefined reference to `__mth_i_cddiv'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(ztrti2.o): In function `ztrti2_':
ztrti2.o(.text+0x270): undefined reference to `__mth_i_cddiv'
ztrti2.o(.text+0x468): undefined reference to `__mth_i_cddiv'
/usr/pgi52/linux86-64/5.2/lib/libacml.a(zgeblk2mat.o): In function `zgeblk2mat_':
zgeblk2mat.o(.text+0x67): undefined reference to `ftn_str_index'

What am I doing wrong?
Scott Kilpatrick

Here is my test.cc that I am trying to execute:

#include <iostream>
#include <acml.h>
using namespace std;


int main() {

        doublecomplex A[16];
        A[0].real = 6.0;
        A[5].real = 2.0;
        A[10].real = 3.0;
        A[15].real = 5.0;

        int M = 4;
        int N = 4;
        int LDA = 4;
        int ipiv[4];
        int info;

        zgetrf(M, N, A, LDA, ipiv, &info);
        cout << "after zgetrf, info = " << info << endl;

        zgetri(N, A, LDA, ipiv, &info);
        cout << "after zgetri, info = " << info << endl;
}

Hi skilpat,

Since ACML was built using pgf77, you need to add the f77 runtime libraries ("-lpgftnrtl") to your link.

% pgCC tmp.cpp -lacml  -V5.2 -lpgftnrtl
% a.out
after zgetrf, info = 0
after zgetri, info = 0

With the 6.0 and 6.1 release of the compilers, you can use “-pgf77libs” (or “-pgf90libs” for the F90 runtime) instead.

Hope this helps,
Mat

It works perfectly now, thanks!

Scott

At the beginning, I met the problem:
=OPT c: Level_1B_AIRS_Main.o - Level_1B_Main.c
– Linking File – /net/orbit154l/home/pub/airs/Software/JPL/AIRS5.0.14.0/linux/bin/run_level_1B_airs
/net/orbit154l/home/pub/airs/Software/JPL/AIRS5.0.14.0/linux/lib/libEXEC_IO.a(r2s.o)(.text+0x4e): In function r2s_': : undefined reference to ftn_str_copy
/net/orbit154l/home/pub/airs/Software/JPL/AIRS5.0.14.0/linux/lib/libEXEC_IO.a(r2s.o)(.text+0x72): In function r2s_': : undefined reference to ftn_str_cpy1’
/net/orbit154l/home/pub/airs/Software/JPL/AIRS5.0.14.0/linux/lib/libEXEC_IO.a(r2s.o)(.text+0x8e): In function r2s_': : undefined reference to fio_src_info’
/net/orbit154l/home/pub/airs/Software/JPL/AIRS5.0.14.0/linux/lib/libEXEC_IO.a(r2s.o)(.text+0xdc): In function r2s_': : undefined reference to ftn_str_copy’

Then I read this forum, and I used the option “-lpgftnrtl”. The new problem arose as:
=OPT c: Level_1B_AIRS_Main.o - Level_1B_Main.c
– Linking File – /net/orbit154l/home/pub/airs/Software/JPL/AIRS5.0.14.0/linux/bin/run_level_1B_airs
/usr/local/pgi/linux86/6.2/lib/libpgftnrtl.a(fmtwrite.o)(.text+0x49e): In function fio_fmt_write64': : undefined reference to __mth_i_kcmp’
/usr/local/pgi/linux86/6.2/lib/libpgftnrtl.a(fmtwrite.o)(.text+0x534): In function fio_fmt_write64': : undefined reference to __mth_i_kcmp’
/usr/local/pgi/linux86/6.2/lib/libpgftnrtl.a(fmtwrite.o)(.text+0x1c91): In function fw_write_record': : undefined reference to __pgio_errno’

How can I fix it?

Thanks you very much for any help.****

Hi,

__mth_i_kcmp and __pgio_errno are in libpgc.a. Can you post the link command and its output when you add -v at the end.

Hongyon