My issue is with the openmp not working with a C Extension in a python setup.py
file.
I am running this code and I have a setup.py
file as below:
from setuptools import *
libTM = Extension('libTM',
sources = ['pyTsetlinMachineParallel/ConvolutionalTsetlinMachine.c', 'pyTsetlinMachineParallel/MultiClassConvolutionalTsetlinMachine.c', 'pyTsetlinMachineParallel/Tools.c'],
include_dirs=['pyTsetlinMachineParallel'],
extra_compile_args=['-fopenmp'],
extra_link_args=['-lgomp'])
setup(
name='pyTsetlinMachineParallel',
version='0.2.1',
]
)
Now when I compile this using python3 setup.py build
, I get a clang-13 error:
ld: library not found for -lgomp
clang-13: error: linker command failed with exit code 1 (use -v to see invocation)
I know openmp is installed on my mac (installed with Homebrew) because I can run the OpenMP test code with the following Makefile:
CPP = /usr/local/opt/llvm/bin/clang
CPPFLAGS = -I/usr/local/opt/llvm/include -fopenmp
LDFLAGS = -L/usr/local/opt/llvm/lib
omp_hello: omp_hello.c
$(CPP) $(CPPFLAGS) $^ -o $@ $(LDFLAGS)
This is the result if I do echo $PATH
:
/usr/local/opt/llvm/lib:/usr/local/opt/llvm/include:/usr/local/opt/llvm/bin:/usr/local/opt/python@3.7/bin:/Users/Saram/bin:/usr/local/bin:/usr/local/opt/llvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands
ANY help would be appreciated, I have tried nearly everything I can find on StackOverflow and I am really struggling. Thank you.