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 Contributor
mobile1up
Posts: 6
Registered: ‎12-13-2011
My Device: Playbook

playbook and sample applications - unresolved symbols

avoiding the IDE altogether; i have been working with command line environment to build and deploy applications. downloading the examples and then setting up the environment, enable dev mode, deploy debug token (fun fun fun); i managed to get the applications built and deployed onto the device as follows:

 

# build application
make

 

# create package
blackberry-nativepackager -package playbook-$APP.bar -buildId build.txt bar-descriptor.xml -devMode -debugToken ~/Library/Research\ In\ Motion/debugtoken1.bar -e arm/o.le-v7/$APP $APP *.png

blackberry-deploy -installApp -package playbook-$APP.bar -device $DEVICE -password $PASSWORD

 

all the applications installed without any problems - they started; then immediately exit - so something was going wrong. after ssh'ing into the playbook (another information search to figure that out) to see what was going on; i found the following was the cause of the problem:

 

$ cd /apps/com.example.CubeRotate.testDev__CubeRotate4ab40aa1/
$ ./native/CubeRotate
unknown symbol: navigator_request_events
unknown symbol: navigator_get_domain
unknown symbol: navigator_rotation_lock
unknown symbol: screen_get_domain
ldd:FATAL: Could not resolve all symbols

 

originally; the playbook hardware was using 1.0.7, upgrading to 1.0.8 made no effect to the results of the testing. i checked the documentation; the libraries are correctly linked.. will have a beer to see if i can figure something else out. the only sample application that actually works is 'HelloWorldConsole' - it seems that there is something with binding to the other applications.. 

 

any insight to figuring out why this is a problem would be a great assistance. :smileyhappy: i tend to try to figure these things out on my own; but, i checked the libraries are all linked as per the documentation for the functions, so the symbol link is something simple which i have overlooked.

 

// Aaron Ardiri
Mobile 1UP - mobile games
http://www.mobile1up.com/
BlackBerry Development Advisor
elena_laskavaia
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: playbook and sample applications - unresolved symbols

NDK 1.0 shipped with a library libbps.so in target-override folder which is not the same on device (all libraries in this folder are newer versions or don't exist on device). Because it diffrent on device you have to package it into your bar file. And set the LD_LIBRARY_PATH to pick it up. Normally IDE would do this for you.

New Contributor
mobile1up
Posts: 6
Registered: ‎12-13-2011
My Device: Playbook

Re: playbook and sample applications - unresolved symbols

mm - i figured something like that

 

<!-- Ensure that shared libraries in the package are found at run-time. -->
<env var="LD_LIBRARY_PATH" value="lib"/>

 

is within the 'bar_descriptor.xml' - which is the LD_LIBRARY_PATH i believe you are talking about - i updated my build process to do:

 

export SDK=/opt/PlaybookSDK

 

# create package
blackberry-nativepackager -package playbook-$APP.bar -buildId build.txt bar-descriptor.xml -devMode -debugToken ~/Library/Research\ In\ Motion/debugtoken1.bar -e $SDK/target/qnx6/armle-v7/usr/lib/libbps.so lib/libbps.so -e arm/o.le-v7/$APP $APP *.png

 

so include 'libbps.so' - but i tried various combinations for LD_LIBRARY_PATH - no go. what is the IDE doing specifically? any examples to demonstration how this post-packaging occurs? i think we are getting closer :smileytongue: the libbps.so file exists on the device, deployed under:

 

  /apps/com.example.HelloWorldConsole.testDev_orldConsole7b842986/native/lib/libbps.so

 

the 'HelloWorldConsole' binary exists under:

 

  /apps/com.example.HelloWorldConsole.testDev_orldConsole7b842986/native/HelloWorldConsole

 

not nice when the IDE does things magically especially when there are command line tools - can someone host an example .bar file somewhere? i can then poke around and see what magic the IDE is doing under the hood.. always love poking around.

// Aaron Ardiri
Mobile 1UP - mobile games
http://www.mobile1up.com/
BlackBerry Development Advisor
elena_laskavaia
Posts: 417
Registered: ‎10-27-2010
My Device: PlayBook

Re: playbook and sample applications - unresolved symbols

<env var="LD_LIBRARY_PATH" value="app/native/lib"/>

New Contributor
mobile1up
Posts: 6
Registered: ‎12-13-2011
My Device: Playbook

Re: playbook and sample applications - unresolved symbols

$ find ./
./
./META-INF
./META-INF/MANIFEST.MF
./native
./native/lib
./native/lib/libbps.so
./native/HelloWorldConsole
./native/icon.png
./native/bar-descriptor.xml

 

and..

 

$ cat native/bar-descriptor.xml

...

<!-- Ensure that shared libraries in the package are found at run-time. -->
<env var="LD_LIBRARY_PATH" value="app/native/lib"/>
</qnx>

 

still something fishy going on - trying to start the application many ways; gives the same errors

 

$ pwd
/apps/com.example.HelloWorldConsole.testDev_orldConsole7b842986
$ ./native/HelloWorldConsole
unknown symbol: navigator_request_events
ldd:FATAL: Could not resolve all symbols
$ cd native/
$ ./HelloWorldConsole
unknown symbol: navigator_request_events
ldd:FATAL: Could not resolve all symbols

// Aaron Ardiri
Mobile 1UP - mobile games
http://www.mobile1up.com/
Retired
cdamus
Posts: 45
Registered: ‎10-25-2010
My Device: Bold 9700

Re: playbook and sample applications - unresolved symbols

The LD_LIBRARY_PATH is relative to the current working directory. It is assumed that the application is launched in its sandbox directory, which contains an "app/" symbolic link to the app storage directory.

The OS will launch your app in its sandbox directory. Moreover, it does not support launching apps from a shell session; the windows that it tries to create will not appear.

HTH,

Christian
New Contributor
mobile1up
Posts: 6
Registered: ‎12-13-2011
My Device: Playbook

Re: playbook and sample applications - unresolved symbols

@cdamus - now you got it :smileyhappy: launching from the launcher with these changes (including -e .../libbps.so) makes it work. 

// Aaron Ardiri
Mobile 1UP - mobile games
http://www.mobile1up.com/
New Contributor
mobile1up
Posts: 6
Registered: ‎12-13-2011
My Device: Playbook

Re: playbook and sample applications - unresolved symbols

just to follow up - to get the compile process working from the command line:

 

bar_descriptor.xml

<asset path="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib/libbps.so" type="Qnx/Elf">lib/libbps.so.1</asset>

 

indicates that the file "libbps.so" must be provided in the application bundle (from target-override) and named 'libbps.so.1'

 

-e $SDK/target/target-override/armle-v7/usr/lib/libbps.so lib/libbps.so.1

 

is the process for doing this - i hope this thread helps others who want to avoid using the IDE for development and going old-skool via the command line :smileyhappy: the LD_LI BRARY_PATH needs to be app/native/lib which effectively ends up being {app_space}/native/lib in the binary

 

unzip -l playbook-HelloWorldConsole.bar
Archive: playbook-HelloWorldConsole.bar
Length Date Time Name
-------- ---- ---- ----
1599 12-13-11 20:13 META-INF/MANIFEST.MF
121904 12-13-11 20:13 native/lib/libbps.so.1               <---- here it is :smileyhappy:
8282 12-13-11 20:13 native/HelloWorldConsole
6078 12-13-11 20:13 native/icon.png
4859 12-13-11 20:13 native/bar-descriptor.xml
-------- -------
142722 5 files

 

// Aaron Ardiri
Mobile 1UP - mobile games
http://www.mobile1up.com/
Contributor
madrazoman
Posts: 25
Registered: ‎08-22-2013
My Device: Dev Alpha B

Re: playbook and sample applications - unresolved symbols

[ Edited ]

Hi, I found this very useful.

however, when I use the "-e" flag, I got the following error:

 

 Error: Attribute Entry-Point: file cannot be found in the list of packaged files

 

Any ideas? Thanks

 

Edit: I had to -e all the files.  Now it generates the bar package, but I am still getting Unresolved Symbol. I am trying to link a ".a" file.

 

Edit2: Got it working! Thanks