Below is my setup file to setup a python wrapper. The issue I am having is that in my c code I am writing is making calls to clock_gettime for profiling reasons. The thing is when I try to import the module I get the following: error undefined symbol: clock_gettime
. I understand that I need to compile with -lrt, but obviously my compiler is not getting that flag. What am I doing wrong?
from distutils.core import setup, Extension
import os
module1 = Extension('relaymod',
extra_compile_args = ["-lrt"], #flag so compiler links to realtime lib
sources=['relaymodule.c']
)
setup (name = 'relaymod',
version = '1.0',
description = "CTec Relay Board controller",
author='Richard Kelly',
url='site',
ext_modules=[module1])
EDIT:
looking at the distutils.core documentation I believe I need to set extra_link_args
Below is my new change, but I am now getting this error: NameError: name 'extra_link_args' is not defined
EDIT2: ok the code below is now working. Had a few things going on. after I removed the build folder and rebuilt this worked.
from distutils.core import setup, Extension
import os
module1 = Extension('relaymod',
extra_link_args=["-lrt"],
sources=['relaymodule.c']
)
setup (name = 'relaymod',
version = '1.0',
description = "CTec Relay Board controller",
author='Richard Kelly',
url='site',
ext_modules=[module1])