[Libav-user] 答复: 答复: 答复: 答复: Are there any ways to use a lib (built from C++ OpenCV) in Ffmpeg filter?

Charles linux2 at orion15.org
Sun Sep 4 03:00:11 EEST 2016

On 09/03/2016 02:13 PM, R n wrote:
>     conf.env['CXXFLAGS'].append('-fPIC')
>     conf.env['CXXFLAGS'].append('-DPIC')
>                    '--extra-libs=-L /lib64 -lstdc++ -lmylibrarytest',
> .../binutils/2.25/centos6-native/da39a3e/bin/ld: .../mylibrary/0.1/gcc-4.9-glibc-2.20-fb/8fd4fe1/lib/libmylibrary.a(my_file.cpp.o):
> relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC

-fPIC is for shared objects, you have to compile all the object code with -fPIC to build a shared library.
libmylibrary.a is a static lib so you probably should not be using -fPIC
The -lstdc++ indicates you are at least linking against it.
Are you doing a cross compile? Centos 6 should be gcc 4.4.7ish and I thought 4.9 was Centos 7

> .../mylibrary/0.1/gcc-4.9-glibc-2.20/8fd4fe1/lib/libmylibrary.a: error adding symbols: Bad value

> So:
> 1.  C++ etc to make the library
> 2. cc -c your_files.c
> 3. C++ -llibrary your_files.o
> In these errors:
>> .../binutils/2.25/centos6-native/da39a3e/bin/ld: .../mylibrary/0.1/gcc-4.9-glibc-2.20/80414d5/lib/libmylibrary.a(mylibrary_file.cpp.o):
>> undefined reference to symbol '_ZdlPv@@GLIBCXX_3.4'
>> .../libgcc/4.9.x/gcc-4.9-glibc-2.20/024dbc3/lib/libstdc++.so: error adding symbols: DSO missing from command line
> “glibcxx” suggests it’s missing the C++ support library, like if you’re linking with cc instead of c++ compiler.

Can you paste just the library compile command, it should look something like this:

g++ -g -std=c++0x -Wall -Wextra -DDEBUG -I/.../ some files [...] -lblah -lblah [...]
cc -Wblah blah somefiles -I/.../blah -L/somepath blah blah

If you are using cmake, add VERBOSE=1 to see all the commands for each compilation


More information about the Libav-user mailing list