API compiling issues: undefined reference to dr_app_setup

33 views
Skip to first unread message

Xin He

unread,
Jun 27, 2021, 10:21:42 PM6/27/21
to DynamoRIO Users
Hi all,

I'm trying to use DynamoRIO's start/stop API dr_app_setup_and_start() and dr_app_stop_and_cleanup() to mark the region of interests of my application when using DynamoRIO DrCacheSim tool's offline memory address traces. However, I cannot get the code to compile correctly.

My application code looks  somehow like below:

#Include "dr_api.h"

int main () {
    // initialization from file
    dr_app_setup_and_start();
    // some MKL routine
    dr_app_stop_and_cleanup();
    // deallocate data structures
    return 0;
}

My Makefile looks like the following:

MKLROOT=${HOME}/intel/compilers_and_libraries_2019.3.199/linux/mkl

DRROOT := ${HOME}/DynamoRIO-Linux-8.0.0-1

MODE := release

I_INC1 = $(DRROOT)/include

I_INC2 = $(DRROOT)/ext/include

C_INCLUDES = -I$(I_INC1) -I$(I_INC2)

CFLAGS= -std=c++11 -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl  -DMKL_ILP64 -m64 -I${MKLROOT}/include -DLINUX -DX86_64 -fPIC

spmm:   mkl_spmm.cpp

        g++ $(C_INCLUDES) $(CFLAGS) mkl_spmm.cpp -o mkl_spmm -g

When I run "make spmm", I will get the following error:

    error: undefined reference to 'dr_app_setup_and_start'

    error: undefined reference to 'dr_app_stop_and_cleanup'

If I add '-shared' to CFLAGS in the Makefile, it would successfully compile but when I run the executable, it will give me segmentation fault.

I am new to DynamoRIO and I haven't found similar problems anywhere. Please let me know if I am missing anything.


Thanks in advance!


Derek Bruening

unread,
Jun 29, 2021, 12:30:43 PM6/29/21
to dynamor...@googlegroups.com
Nothing obvious jumps out.  I would make a CMake version and then diff the flags.

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/f646272f-64d7-4827-b4c4-d49e965075b8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages