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

R n flynewdream at hotmail.com
Sun Sep 4 09:45:27 EEST 2016


Thanks, Charles.


I am not doing a cross compile. I just want to build it anyway to make it work [😊]


1. This is the error:

***************

.../binutils/2.25/centos6-native/da39a3e/bin/ld: .../mylibrary/0.1/gcc-4.9-glibc-2.20/80414d5/lib/libmylibrary.a(mylibrary_file.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC

.../mylibrary/0.1/gcc-4.9-glibc-2.20/80414d5/lib/libmylibrary.a: error adding symbols: Bad value

collect2: error: ld returned 1 exit status

make: *** [libavfilter/libavfilter.so.6] Error 1


+status fail (honored)


leaving install tree at "/tmp/ext-build-ffmpeg3-trunk-gcc-4.9-glibc-2.20.6KWYXR"

"make" returned non-zero status 2

***************


The full building commands are too big and I just copied something (below) I feel important. Please let me know if I missed anything.


2. This is the compile command for building FFmpeg (which is calling my library):

CFLAGS='-O3 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fno-omit-frame-pointer -momit-leaf-frame-pointer -m64 -mtune=generic -nostdinc -grecord-gcc-switches ... -fPIC'


CXXFLAGS='-O3 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fno-omit-frame-pointer -momit-leaf-frame-pointer -m64 -mtune=generic -nostdinc -grecord-gcc-switches -isystem/tp2/gcc/4.9.x/centos6-native/108cf83/include ...

CXX=g++

...

<some paths ending with "include">


Here, I did not see anything like "Wextra -DDEBUG..."

3. This is the compile command for building my library:

CFLAGS='-O3 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fno-omit-frame-pointer -momit-leaf-frame-pointer -m64 -mtune=generic -nostdinc -grecord-gcc-switches ...

CXXFLAGS='-O3 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fno-omit-frame-pointer -momit-leaf-frame-pointer -m64 -mtune=generic -nostdinc -grecord-gcc-switches ...

CXX=g++

..
some paths ending with "include"

Thanks.

Rich



________________________________
发件人: Libav-user <libav-user-bounces at ffmpeg.org> 代表 Charles <linux2 at orion15.org>
发送时间: 2016年9月4日 0:00
收件人: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.
主题: Re: [Libav-user] 答复: 答复: 答复: 答复: Are there any ways to use a lib (built from C++ OpenCV) in Ffmpeg filter?

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 [...]
or
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

Thanks
cco



_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user
Libav-user Info Page - FFmpeg<http://ffmpeg.org/mailman/listinfo/libav-user>
ffmpeg.org
This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. To see the collection of prior postings to the list, visit the Libav-user ...



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160904/f6e7f4af/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OutlookEmoji-😊.png
Type: image/png
Size: 488 bytes
Desc: OutlookEmoji-😊.png
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160904/f6e7f4af/attachment.png>


More information about the Libav-user mailing list