0

I am trying to use OMPTrace which is a tool for tracing and visualizing OpenMP program execution as shown here https://github.com/passlab/omptrace. The codes given in the examples is written in C. (jacobi.c and axpy.c) The library is well installed in /home/hakim/llvm-openmp/BUILD/omptrace/build/libomptrace.so. I created a makefile as following:

OMP_INSTALL=/home/hakim/llvm-openmp-install
OMP_LIB_PATH=${OMP_INSTALL}/lib
OMPTRACE_LIB=/home/hakim/llvm-openmp/BUILD/omptrace/build/libomptrace.so

default:runaxpy

axpyclang: axpy.c
    clang -g -fopenmp axpy.c -o axpyclang
    objdump -d axpyclang >axpyclang.objdump

jacobi: jacobi.c
    clang -g -fopenmp jacobi.c -o jacobi -lm
    objdump -d jacobi >jacobi.objdump

runaxpy: axpyclang
    LD_PRELOAD=${OMP_LIB_PATH}/libomp.so:${OMPTRACE_LIB} ./axpyclang 1024   

runjacobi: jacobi
    LD_PRELOAD=${OMP_LIB_PATH}/libomp.so:${OMPTRACE_LIB} ./jacobi

clean:
    rm axpyclang axpyclang.objdump core jacobi jacobi.objdump

and when executing it, I get :

clang -g -fopenmp axpy.c -o axpyclang
axpy.c:18:5: warning: 'ftime' is deprecated [-Wdeprecated-declarations]
    ftime(&tm);
    ^
/usr/include/x86_64-linux-gnu/sys/timeb.h:40:19: note: 'ftime' has been explicitly marked deprecated here
  __nonnull ((1)) __attribute_deprecated__;
                  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:251:51: note: expanded from macro '__attribute_deprecated__'
# define __attribute_deprecated__ __attribute__ ((__deprecated__))
                                                  ^
axpy.c:25:5: warning: 'ftime' is deprecated [-Wdeprecated-declarations]
    ftime(&tm);
    ^
/usr/include/x86_64-linux-gnu/sys/timeb.h:40:19: note: 'ftime' has been explicitly marked deprecated here
  __nonnull ((1)) __attribute_deprecated__;
                  ^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:251:51: note: expanded from macro '__attribute_deprecated__'
# define __attribute_deprecated__ __attribute__ ((__deprecated__))
                                                  ^
axpy.c:95:5: warning: implicit declaration of function 'sleep' is invalid in C99 [-Wimplicit-function-declaration]
    sleep(1); 
    ^
3 warnings generated.
/usr/bin/ld: cannot find -lomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [makefile:8: axpyclang] Error 1

What is really bothering me is that I succeded 3 hours ago to execute the makefile and to generate a graphml file but now, I'm getting new multiples warnings + an error. I wonder if it comes from the clang compiler (version 10.0.0-4ubuntu1) because getting new warnings gave me the idea that maybe I updated the compiler (and forgot).

Any help, please ?

6
  • 1
    /usr/bin/ld: cannot find -lomp < here is your error, library omp cannot be found, make sure libomp.a (or omp.lib) actually exists in your library search path. Commented Jun 7, 2021 at 19:25
  • 2
    Include unistd.h for the sleep function warning Commented Jun 7, 2021 at 19:26
  • 1
    The replacement for ftime is clock_gettime or GetLocalTime depending on your system. Commented Jun 7, 2021 at 19:35
  • 1
    The linker command failed due to the reason stated immediately above the linker commend failed notification. Don't read error message from the bottom-up. Although here you appear to have read the bottom line only and not even up. All those warnings can be overwhelming, causing you not not be able to see the actual errors. The solution to that is simple - fix the warnings too! Commented Jun 7, 2021 at 20:01
  • @ Thanks ! I got rid of the sleep function warning. Commented Jun 7, 2021 at 20:08

1 Answer 1

1
  1. You need to locate the libomp.a
  2. Add the path where libomp.a lives to the ld command line parameters -Lpath
  3. enjoy
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for the answer ! but I'm still confused. I located libomp.so. Since I don't know really well the ld command, can you give me more information please ?
@hakimo2 the part "use -v to see invocation" would provide useful diagnostic information. It will show you how LD is being called.
@Clifford Thanks a lot ! It works by adding -L/home/hakim/llvm-openmp-install/lib.
@hakimo2 you are thanking the wrong person this answer was by 0______.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.