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
New Developer
ahsan_iqbal
Posts: 26
Registered: ‎04-11-2012
My Carrier: BlackBerry

Problem compiling and adding static library

Hi

 

I am very new to blackberry ndk development. I have a project already developed in c/c++. which depends on one or more static librarries developed in c/c++ by me. now when i compile static libraries IDE (QNX momentics) report no errors and creates .a files but when i want to compile main project then it recompile static libraries and report errors in those static libraries. can any body guide me where might be the problem!

 

Regards

Ahsan 

Please use plain text.
New Contributor
weidongxu
Posts: 7
Registered: ‎04-06-2012
My Carrier: AT&T

Re: Problem compiling and adding static library

I think it would be easier for us to help if you could let us know what kind of error you got, better to list some (maybe the first).

 

If I get what you mean, you are able to build .a if do it along, but if you need to make an app which depends on these static libs, the IDE will at that time rebuild these libs, and this time it failed the compile and cannot build the .a, right?

 

If so, this is indeed strange.

One possible issue occurs to me is whether the Target type (Device-Debug / Device-Release / or even Simulator) is the same of the static lib you built and app you want to build.  I think if the type is same IDE will not rebuild the lib.  And if type is incorrect, it might happens that the code could pass the build for Simulator target but fail for Device-Release target.

This is only a guess.

 

Or if the app failed in link phase, there will be a lot of possibilities...

Please use plain text.
New Developer
ahsan_iqbal
Posts: 26
Registered: ‎04-11-2012
My Carrier: BlackBerry

Re: Problem compiling and adding static library

It seems that those are linking errors as most of the errors are like

"undefined reference to `eglBindAPI'", actually i am C#.net programmer there u only need to add a reference to assembly(dll) and u are done. I do it that way here but nothing seems to work

 

Regards

Ahsan

Please use plain text.
New Developer
Tuddrussel
Posts: 13
Registered: ‎04-15-2012
My Carrier: non-blackberry

Re: Problem compiling and adding static library

Have u include the header file?

Have you point to the .so library?

Please use plain text.
New Contributor
weidongxu
Posts: 7
Registered: ‎04-06-2012
My Carrier: AT&T

Re: Problem compiling and adding static library

Then it is much simpler.  I guess you need to add more shared library to your project.  For example the error you got means you need to add EGL to lib (possibly also GLESv1_CM or GLESv2).

Please use plain text.
New Developer
ahsan_iqbal
Posts: 26
Registered: ‎04-11-2012
My Carrier: BlackBerry

Re: Problem compiling and adding static library

Hi Guys!

 

Thankyou very much for helping me out, now i have successfully compiled the application there are no compilation/linking errors but bar file is not generated, what could be the reason. 

 

please help.

 

Regards

Ahsan

Please use plain text.
New Contributor
weidongxu
Posts: 7
Registered: ‎04-06-2012
My Carrier: AT&T

Re: Problem compiling and adding static library

For me, the QNX IDE generate the bar file when I am deploying the app to device.

 

There are command line tool to generate bar file (should be in bbndk-2.0.0/host/[host]/x86/usr/bin), but I haven't tried them.

Please use plain text.
New Developer
ahsan_iqbal
Posts: 26
Registered: ‎04-11-2012
My Carrier: BlackBerry

Re: Problem compiling and adding static library

Hi

 

I am experiencing this "cannot find -lfreetype2" even i have added freetype2 to my project,

 

Regards

Ahsan

Please use plain text.
New Contributor
weidongxu
Posts: 7
Registered: ‎04-06-2012
My Carrier: AT&T

Re: Problem compiling and adding static library

There is no freetype2, just freetype (yes, it is the 2).  Use -lfreetype instead.

 

You could see (almost) all libs in bbndk-2.0.0/target/qnx6/armle-v7/lib and bbndk-2.0.0/target/qnx6/armle-v7/usr/lib.

Please use plain text.
New Contributor
Amoyian
Posts: 5
Registered: ‎11-19-2012
My Carrier: Blackberry

Re: Problem compiling and adding static library

I got the same problem(cannot find lfreetype2), but how to link against lfreetype ? 

waiting!

Regards!

Please use plain text.