openppl-public / ppl.cv

ppl.cv is a high-performance image processing library of openPPL supporting various platforms.
Apache License 2.0
484 stars 108 forks source link

undefined symbol #122

Closed tp-nan closed 8 months ago

tp-nan commented 8 months ago

Hi, when I link libpplcv_static.a to another dynamic lib, it says:

ImportError: /workspace/libxxx.so: undefined symbol: _ZN3ppl6common10LogMessageC1EjPNS0_6LoggerEPKcj

nm /workspace/libxxx.so |grep _ZN3ppl6common10LogMessageC1EjPNS0_6LoggerEPKcj
                 U _ZN3ppl6common10LogMessageC1EjPNS0_6LoggerEPKcj

nm /tmp/ppl.cv/./cuda-build/install/lib/libpplcommon_static.a |grep _ZN3ppl6common10LogMessageC1EjPNS0_6LoggerEPKcj
0000000000000000 T _ZN3ppl6common10LogMessageC1EjPNS0_6LoggerEPKcj

the source

    if PPLCV_INSTALL:
        include_dirs.append(os.path.join(PPLCV_INSTALL, "include"))
        pplcv_lib_dir=os.path.join(PPLCV_INSTALL, "lib")
        extra_link_args.append(f'-Wl,-rpath={pplcv_lib_dir}')
        extra_link_args.append('-Wl,-Bsymbolic')
        extra_link_args.append(os.path.join(pplcv_lib_dir,"libpplcv_static.a"))

    ext_modules = [
        extension(
            "xxx.libxxx",
            sorted(sources),
            include_dirs=include_dirs,
            define_macros=define_macros + image_macros,
            extra_compile_args=extra_compile_args,
            extra_link_args=extra_link_args + link_fs,  # "-lstdc++fs"
            library_dirs=["./lib", "/usr/local/lib/"] +[pplcv_lib_dir],
            libraries=opencv_libs
            + thirdpart_libs
            + extra_lib,
        )
    ]
tp-nan commented 8 months ago

I forgot to link libpplcommon_static.a ...