- edited description
PAPI code requires `-ldl` flag to compile successfully
Issue #119
resolved
I have configured PAPI with (last commit 411c9f94e9522abfd704df97bf490961b4ed9d11)
$ ./configure --with-debug=yes --prefix=$PWD/install
$ make
$ make install
I have a C code main.c
#include <papi.h>
int main(int argv, char** argc)
{
int retval;
retval = PAPI_library_init(PAPI_VER_CURRENT);
PAPI_shutdown();
return 0;
}
and compiling this program with
$ gcc main.c -o main -I$PAPI_PATH/include -L$PAPI_PATH/lib -lpapi
give the following linking error
/home/anustuv/papidev/papi-AP/src/install/lib/libpapi.so: undefined reference to `dlopen'
/home/anustuv/papidev/papi-AP/src/install/lib/libpapi.so: undefined reference to `dlclose'
/home/anustuv/papidev/papi-AP/src/install/lib/libpapi.so: undefined reference to `dlerror'
/home/anustuv/papidev/papi-AP/src/install/lib/libpapi.so: undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
make: *** [issue49] Error 1
The error gets fixed if compiled with -ldl
flag as
gcc main.c -o main -I$PAPI_PATH/include -L$PAPI_PATH/lib -lpapi -ldl
Comments (3)
-
reporter -
@Anustuv Pal I am not able to reproduce the problem. I am trying on methane. Where did you try this?
-
- changed status to resolved
Not an issue
- Log in to comment