-3

I currently have the error 2): Symbol not found ___kmpc_begin. I have encountered other symbol not found errors but this message doesnt provide me any information on how to correct the problem.

If it helps, I am compiling the code with ifort using the following command: f2py -c --fcompiler=intelem --f77exec=/usr/bin/ifort -m main main.f

Where can I look to be able to figure out what the Symbol not found error means and how to correct it?

davidism
  • 121,510
  • 29
  • 395
  • 339
CodeGuyRoss
  • 786
  • 1
  • 10
  • 23
  • Is all your code contained in one file or several files? Are you using any external libraries? – SethMMorton Oct 30 '14 at 21:23
  • There is a main file that references several subroutines in other files all contained in the same directory. There are no external libraries. – CodeGuyRoss Oct 30 '14 at 21:28
  • It looks like you aren't passing those other filenames to f2py. If that is the case, the linker has no idea where to find them, hence the symbol not found error. – SethMMorton Oct 30 '14 at 21:29
  • Is there and easy way to link the other 20+ files that get called other than typing them one at a time inline? – CodeGuyRoss Oct 30 '14 at 21:31
  • You could try using a glob, i.e. *.f. Or write a makefile. – SethMMorton Oct 30 '14 at 21:31
  • *.f generates a bunch of errors. I will try the makefile. – CodeGuyRoss Oct 30 '14 at 21:36
  • IIRC `__kmpc_begin` comes from a runtime library of the Intel compiler. You have to link that one too. I think it is used for OpenMP. Do you use OpenMP? – Vladimir F Героям слава Oct 30 '14 at 21:57
  • I do not use OpenMP in the code anywhere. I am searching through the intel folder found at /opt/intel but I am not finding anything that would give me a clue of what to link to fix the __kmpc_begin not being found. Im still lost on how to fix the Symbol not found error... – CodeGuyRoss Oct 31 '14 at 15:43

1 Answers1

0

Basically what this error is saying is that the library is not included in the .so file being created by f2py. There may be some extra library files here and command options that you don't need but at least this gives a clue on how to fix the symbol not found error.

To fix the "2): Symbol not found ___kmpc_begin" I did the following but you can apply this idea to other Symbol not found errors.

First run this:

f2py -m main -h sgnFile.pyf main.f

Then run this:

f2py -c --fcompiler=intelem --f77exec=/usr/bin/ifort -L/opt/intel/composer_xe_2015.0.077/mkl/lib -L/opt/intel/composer_xe_2015.0.077/compiler/lib -llibiomp5 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -lmkl_intel_thread -lpthread -lm -m main sgnFile.pyf main.f *.o

I put the files from the intel folder in the same folder containing my main.f file and that allowed me to be able to use pycharm to compile my application so you may need to do this also.

Hope this helps!

CodeGuyRoss
  • 786
  • 1
  • 10
  • 23