chaoyuaw / pytorch-coviar

Compressed Video Action Recognition
https://www.cs.utexas.edu/~cywu/projects/coviar/
GNU Lesser General Public License v2.1
500 stars 126 forks source link

Solution for linker errors #73

Open LukasBommes opened 5 years ago

LukasBommes commented 5 years ago

I had issues during the build procedure. The linker could not find some symbols. So, it's better to use pkgconfig to let the pkgconfig files decide which additional libraries to install. If someone has the same issue use code below (but alter the location of your ffmpeg build).

from distutils.core import setup, Extension
import pkgconfig
import numpy as np

d = pkgconfig.parse('libavutil libavcodec libavformat libswscale')

coviar_utils_module = Extension('coviar',
        sources = ['coviar_data_loader.c'],
        include_dirs=[np.get_include(), '/home/ffmpeg_build/include/'],
        library_dirs = d['library_dirs'],
        libraries = d['libraries'],
        extra_compile_args=['-DNDEBUG', '-O3'],
        extra_link_args=['-fPIC', '-Wl,-Bsymbolic']
)

setup ( name = 'coviar',
    version = '0.1',
    description = 'Utils for coviar training.',
    ext_modules = [ coviar_utils_module ]
)
lkhphuc commented 3 years ago

Thank you. For those who get '... undefined symbol', add extra_link_args=['-fPIC', '-Wl,-Bsymbolic', '-lavutil', '-lavcodec', '-lavformat', '-lswscale', '-L/home/phuc/pytorch-coviar/ffpmeg-install/lib/'] with the correct path of your install in the end.