Linking on Linux - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English

These instructions assume your application is written in C++, but the AOCL-DA C APIs have been designed to make calling from other languages as straightforward as possible. In the example compilation commands below, INT_LIB is either LP64 or ILP64 for 32 and 64 bit integers respectively.

To compile and link to static AOCL libraries using g++:

g++ <your_source_code>.cpp -I /<path to aocl-da headers>/include_<INT_LIB>
    /<path to aocl-da>/lib_<INT_LIB>/libaocl-da.a
    /<path to amd-sparse>/lib_<INT_LIB>/libaoclsparse.a
    /<path to amd-libflame>/lib_<INT_LIB>/libflame.a
    /<path to amd-blis>/lib_<INT_LIB>/libblis-mt.a
    /<path to libaoclutils>/lib_<INT_LIB>/libaoclutils.a -lgfortran -lgomp

To compile and link to static AOCL libraries using clang++:

clang++ <your_source_code>.cpp -I /<path to aocl-da headers>/include_<INT_LIB>
        /<path to aocl-da>/lib_<INT_LIB>/libaocl-da.a
        /<path to amd-sparse>/lib_<INT_LIB>/libaoclsparse.a
        /<path to amd-libflame>/lib_<INT_LIB>/libflame.a
        /<path to amd-blis>/lib_<INT_LIB>/libblis-mt.a
        /<path to libaoclutils>/lib_<INT_LIB>/libaoclutils.a -lflang -lomp -lpgmath

To compile and link to dynamic AOCL libraries using g++:

g++ <your_source_code>.cpp -I /<path to aocl-da headers>/include_<INT_LIB>
    -L /<path to aocl-da>/lib_<INT_LIB> -L /<path to amd-sparse>/lib_<INT_LIB>
    -L /<path to amd-libflame>/lib_<INT_LIB> -L /<path to amd-blis>/lib_<INT_LIB>
    -L /<path to amd-utils>/lib -laocl-da -laoclsparse -lflame -lblis-mt -laoclutils
    -lgfortran -lgomp

To compile and link to dynamic AOCL libraries using clang++:

clang++ <your_source_code>.cpp -I /<path to aocl-da headers>/include_<INT_LIB>
        -L /<path to aocl-da>/lib_<INT_LIB> -L /<path to amd-sparse>/lib_<INT_LIB>
        -L /<path to amd-libflame>/lib_<INT_LIB> -L /<path to amd-blis>/lib_<INT_LIB>
        -L /<path to amd-utils>/lib -laocl-da -laoclsparse -lflame -lblis-mt -laoclutils
        -lflang -lomp -lpgmath

Note that for dynamic linking you will need to update your LD_LIBRARY_PATH environment variable, e.g. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<AOCL_ROOT>/lib_<INT_LIB>.

If you wish to call AOCL-DA from a C code, then you should compile using your C compiler (e.g. gcc), but link separately, using a C++ linker (e.g. g++).