Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Trusted Contributor
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone
Accepted Solution

Add libraries to new Project

Hello all,

 

I have also been trying to understand how i could use prebuilt ffmpeg files contained within ffbblib kindly provided by mreed.

 

I want to learn how to link to a library like ffmpeg, I know I can use add library for standard Blackberry libraries but ffmpeg is not a standard library, it seems to be many .so files.- how would i use it with momentics?

 

I have opened the sample project which uses libffbb and it adds libffbb/public and libffbb/ffmpeg/incude to its includes folder which I have emulated in my project but the compiler still doesn't like the line of code #include <avformat.h> which where i am trying to get to.

 

Please anyone?

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Add libraries to new Project

Make sure you have proper:

- include paths (-I [it's captial ai not lowercase el] option)

- library paths (-L option)

- libararies (-l option)

All this should be set up here: Project's properties->C/C++ Build->Settings->Tool Settings->QCC Compiler->Preprocessor and Project's properties->C/C++ Build->Settings->Tool Settings->QCC Linker->Libraries

You'll have to list all your .so libraries you want to link with (which is actually always like this).

Trusted Contributor
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: Add libraries to new Project

Hi BGmot,

 

You have helped me understand a bit more, thanks.

 

I have added the folder containing the ffmpeg .so files to (-L) section, I have added the includes folder for ffmpeg to (-I) includes section in preprocessor and added avformat and avcodec in the section for libraries (-l).

 

I get this error which I cant get past on my own.

 

C:\ndk-2.1.0-workspace\libffbb\ffmpeg\lib\gpl\qnx\armle-v7/libavformat.so: file format not recognized; treating as linker script
C:\bbndk-2.1.0-beta1\host\win32\x86\usr\bin\ntoarm-ld:C:\ndk-2.1.0-workspace\libffbb\ffmpeg\lib\gpl\qnx\armle-v7/libavformat.so:1: syntax error
cc: C:/bbndk-2.1.0-beta1/host/win32/x86/usr/bin/ntoarm-ld caught signal 1
Build error occurred, build is stopped
Time consumed: 687 ms.

 

Anyone know why libavformat.so is not accepted in this project?

Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Add libraries to new Project

@cjonesy you need to post your input/output each time you run into an issue. We can't do much without see what the attempted command line looks like.

Trusted Contributor
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: Add libraries to new Project

I don't fully understand what you mean by input/output for each build mreed. What I pasted in the previous message - is that not the output? If I am not doing everything I can to help you help me then please let me know how to correct that.

 

I am not using command line, i am using the momentics. I found in last night attempts I was using a makefile build so today i am trying managed build.

 

I just keep getting that syntax error even though I'm pretty sure i have linked to correctly in Tool Settings as suggested by BGmot.

 

- include paths (-I ffmpeg/include)

- library paths (-L public/)

- libararies (-l ffmpeg/libs/gpl../armle-v7)

 

Thanks.

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Add libraries to new Project

Try:

-L=C:\ndk-2.1.0-workspace\libffbb\ffmpeg\lib\gpl\qnx\armle-v7

-l=avformat
And the output is what you get in console when building your project.

Trusted Contributor
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: Add libraries to new Project

It is pointing to as you suggest  the armle-v7 folder and I have included avformat in the appropriate section but I ge t the output below.. Thank you.

 


**** Build of configuration Device-Debug for project test3 ****

**** Internal Builder is used for build ****
qcc -o src\main.o ..\src\main.c -V4.4.2,gcc_ntoarmv7le -w1 -IC:/bbndk-2.1.0-beta1/target/qnx6/usr/include/freetype2 -IC:\ndk-2.1.0-workspace\test3\ffmpeg\include -IC:/bbndk-2.1.0-beta1/target/qnx6/../target-override/usr/include -D_FORTIFY_SOURCE=2 -DUSING_GL11 -c -O0 -g -fstack-protector-all
qcc -o test3 src\main.o src\bbutil.o -lbps -lavformat -lscreen -lEGL -lGLESv1_CM -lfreetype -lpng -lm -V4.4.2,gcc_ntoarmv7le -w1 -g -Wl,-z,relro -Wl,-z,now -LC:/bbndk-2.1.0-beta1/target/qnx6/../target-override/armle-v7/lib -LC:\ndk-2.1.0-workspace\test3\ffmpeg\lib\gpl\qnx\armle-v7 -LC:/bbndk-2.1.0-beta1/target/qnx6/../target-override/armle-v7/usr/lib
C:\bbndk-2.1.0-beta1\host\win32\x86\usr\bin\ntoarm-ld:C:\ndk-2.1.0-workspace\test3\ffmpeg\lib\gpl\qnx\armle-v7/libavformat.so: file format not recognized; treating as linker script
C:\bbndk-2.1.0-beta1\host\win32\x86\usr\bin\ntoarm-ld:C:\ndk-2.1.0-workspace\test3\ffmpeg\lib\gpl\qnx\armle-v7/libavformat.so:1: syntax error
cc: C:/bbndk-2.1.0-beta1/host/win32/x86/usr/bin/ntoarm-ld caught signal 1
Build error occurred, build is stopped
Time consumed: 7406 ms.

Trusted Contributor
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: Add libraries to new Project

Sorry mreed, i realise in my last post containing output i was linking to ffbblib/ffmpeg but i have removed that as it was just a test.

Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: Add libraries to new Project

looks like libavformat.so indeed has bad format.

Another not I see you use both C:\ndk-... and C:\bbndk, typo?

Trusted Contributor
Posts: 160
Registered: ‎09-13-2012
My Device: 9900
My Carrier: vodafone

Re: Add libraries to new Project

C:\ndk-... is my workspace for projects and C:\bbndk-2.0.1 is just where the ndk is installed to.