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
Contributor
Jaime_Barrachina
Posts: 21
Registered: ‎10-25-2012
My Device: Blackberry Playbook 2.0

Error: Library is not compiled for the correct architecture

Hi,

I'm trying to add a C++ library, but when selecting it from:

Configure / Add Library / External 

 

I get the error:  Library is not compiled for the correct architecture: "Library path".

 

This obviously means that the library is not in the correct architecture. As the library is one made by my company, I can modify it, so I would like to know what is the correct architecture, to be able to port the library to it.

 

Thanks,

Jaime

Contributor
Jaime_Barrachina
Posts: 21
Registered: ‎10-25-2012
My Device: Blackberry Playbook 2.0

Re: Error: Library is not compiled for the correct architecture

Aparently this is not common knoledge. I'll limit myself to more particular questions then. For compiling the library I need to import:

 

What compilers are supported? Is it fine if I compile with the visual studio default compiler (CL I think it's called)? Or do I need to use a specific one? If so, wich one?

 

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

Re: Error: Library is not compiled for the correct architecture

I'd go with RIM's NDK (http://developer.blackberry.com/native/ for Playbook)

Note that libraries for Simulator have to be compiled with x86 platfrom, for real PlayBook - with arm.

Contributor
sanshah90
Posts: 36
Registered: ‎06-28-2012
My Device: BB10

Re: Error: Library is not compiled for the correct architecture

Hi,

 

I am getting same kind of error. Please anyone tell me what should be the solution. 

And also which library file supported in Blackbery 10. I mean whether it should be .lib extension (windows based) or .a extension (unix based). I have added both files but getting same kind of error.

 

Please reply.

 

Thanks

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

Re: Error: Library is not compiled for the correct architecture

either .a or .so (depends whether you link statically or dynamically)

Contributor
sanshah90
Posts: 36
Registered: ‎06-28-2012
My Device: BB10

Re: Error: Library is not compiled for the correct architecture

Hi,

 

Thanks for the reply.

But if i try to link the .so file, i am getting following error : Library is not compiled for the correct architecture: "Library path"

 

I followed this link for linking : http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/How-to-use-a-third-party-share...

 

What should be the solution???

 

Thanks

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

Re: Error: Library is not compiled for the correct architecture

I can only repeat: that libraries for Simulator have to be compiled for x86 platfrom, for real PlayBook - for arm. Do you compile your library or use .so file compiled by somebody?

Contributor
sanshah90
Posts: 36
Registered: ‎06-28-2012
My Device: BB10

Re: Error: Library is not compiled for the correct architecture

hi,

 

Thanks for your reply.

 

But I am still not able to run it. Can you please provide me sample application. So that i can understand it.

 

Thanks

Developer
jalue
Posts: 196
Registered: ‎03-04-2013
My Device: BB Z10

Re: Error: Library is not compiled for the correct architecture

[ Edited ]

Hey there sanshah,

 

I'll see if I can explain it clearly, even though BGmot explained it already. Basically, whatever library you are using you should try to get the source code yourself and compile it yourself.  If you're using the NDK for BB10 then that would be great. Just load the source code for the library into NDK and see if you can compile it.

 

If you cannot get the source code of the library, as BGmot mentioned, you could possibly get the library as a dynamically linked library with the *.so extension from a friend or someone else.  The person would have to specify the architecture that you want when compiling. Dynamically linked just basically means the library is separete from the executable and is used when you run the program, not when you compile it. Statically linked (*.a) is combined/linked into the executable when it is compiled.

 

Running the program in a Simulator would be the same architecture as the platform you are using. Such as x86... If you wanna distribute the program for BB, it would have to be the Arm architecture.

 

You wanted an example to work with, you can try Box2D, since it is readily available. BGmot is the one that supplied the link in this thread: http://supportforums.blackberry.com/t5/Native-Development/Having-trouble-getting-the-Belligerent-Blo...

 

Box2D is a library needed for the Belligerent Blocks game available here: https://github.com/blackberry/NDK-Samples/tree/master/BelligerentBlocks

 

Hope that helps you.