Re: [osg-users] Trouble loading OSG plugins

2013-09-11 Thread Jorge Izquierdo Ciges
No, we are working internally on this one until is completed. It's a major
overhaul to compilation in Android.

The undefined error will be, probably, for the stl library because in
certain versions of the NDK you need to link specifically against the
libgnu_stl not only wait the ndk to do it for you. NDK in some versions do
a lot of weird things in this matter, and there are versions that
completely broke several things.

2013/9/11 Preet prismatic.proj...@gmail.com

 you have a public repo where you are testing this out? I suspect
 you're setting up a build similar to the static one where CMakeLists
 will do most of the magic. My build notes are here (still have to add
 some stuff, but its mostly complete:

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble loading OSG plugins

2013-09-10 Thread Preet
I wasn't able to build the static version of OpenSceneGraph using the
provided guide, so I tried building a shared version directly using CMake
and the Android NDK toolchain which seems to have worked.

The problem I have right now is with osgPlugins-x.y.z being prefixed to the
search path by OSG. As an experiment, I put some osgPlugins in the sdcard
folder (external storage) /sdcardpath/osgPlugins-x.y.z/ and if I explicitly
specify this path (/sdcardpath) to the osgDB::Registry, it loads the
plugins just fine. This isn't okay for general app deployment though.

I was able to pack shared object (plugin) files without a 'lib' prefix in
the APK/lib directory. I'm unable to create any more directories in
APK/lib. Unfortunately I can't load these because (I think) OSG is
prefixing the path with osgPlugins-x.y.z.. I want to disable this
behavior so I can package the app properly.


On Tue, Sep 10, 2013 at 3:32 PM, Jorge Izquierdo Ciges jori...@gmail.comwrote:

 Android has a serie of troubles:

 1rst every library has to begin with lib if has to be included in the APK
 2nd every library has to be loaded at the first try or will never be
 loaded until you close your application
 3rd If your library needs a dependence he will not load it even if its on
 the same directory

 So... 1rst - OSG searches plugins without lib at the begin and they are
 compiled with lib if my memory is well enough.
 2nd  - this is confirmed for versions pre 4.2
 3rd   - this is confirmed for versions pre 4.2

 At least on a Nexus 4 the 2/3 don't happen anymore with the last version.
 I have OSG with shared libraries and plugins in Android but it is far from
 submission because we changed a lot of things and we are checking
 everything thrice, so don't expect it soon.

 But... you can make it work, my phone is proof.


 2013/9/10 Preet prismatic.proj...@gmail.com

 m to create an osgPlugins directory where OSG ends up being deployed in
 the application package so I just want OSG to load plugins from the
 directory where the rest of the shared objects live on Android:

 /data/app-lib/org.some.app/--- where all the *.so libraries live,
 including osgdb_xx.so




 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble loading OSG plugins

2013-09-10 Thread Raphael Grasset
Hi Preet,

For the path prefix, not sure if it works, but look at src/osgDB/Registry.cpp, 
and the function createLibraryNameForExtension, you will see a:
std::string prepend = 
std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/);

so if you create an empty string it may address your path issue.

Yet, it will be preferable that you build everything in static mode: what was 
the reasons your static built didn't work?

C.
Raphael

... 

Thank you!

Cheers,
Raphael

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56237#56237





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble loading OSG plugins

2013-09-10 Thread Jorge Izquierdo Ciges
Android has a serie of troubles:

1rst every library has to begin with lib if has to be included in the APK
2nd every library has to be loaded at the first try or will never be loaded
until you close your application
3rd If your library needs a dependence he will not load it even if its on
the same directory

So... 1rst - OSG searches plugins without lib at the begin and they are
compiled with lib if my memory is well enough.
2nd  - this is confirmed for versions pre 4.2
3rd   - this is confirmed for versions pre 4.2

At least on a Nexus 4 the 2/3 don't happen anymore with the last version. I
have OSG with shared libraries and plugins in Android but it is far from
submission because we changed a lot of things and we are checking
everything thrice, so don't expect it soon.

But... you can make it work, my phone is proof.


2013/9/10 Preet prismatic.proj...@gmail.com

 m to create an osgPlugins directory where OSG ends up being deployed in
 the application package so I just want OSG to load plugins from the
 directory where the rest of the shared objects live on Android:

 /data/app-lib/org.some.app/--- where all the *.so libraries live,
 including osgdb_xx.so

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Trouble loading OSG plugins

2013-09-10 Thread Preet
I'm having issues trying to get OSG to load plugins on Android for a shared
library build... though OSG seems to be working fine on Android as a shared
lib without plugins which is great!

I can't seem to create an osgPlugins directory where OSG ends up being
deployed in the application package so I just want OSG to load plugins from
the directory where the rest of the shared objects live on Android:

/data/app-lib/org.some.app/--- where all the *.so libraries live,
including osgdb_xx.so

So I do this:
osgDB::Registry::instance()-setLibraryFilePathList(/data/app-lib/org.some.app);

But it seems like its prefixing 'osgPlugins-3.3.0' to its search path. This
is the output I get from OSG:

Warning: dynamic library 'osgPlugins-3.3.0/osgdb_png.so' does not exist
(or isn't readable):
Cannot load library: load_library(linker.cpp:745): library
osgPlugins-3.3.0/osgdb_png.so not found
DynamicLibrary::failed loading osgPlugins-3.3.0/osgdb_png.so

Is there something else I need to do to specify the path where it should
search?

Is there a way to avoid creating an osgPlugins folder altogether as a build
option and just have it look for the plugins without prefixing anything to
their path?

I ran across this problem when using OSG for another platform as well and
worked around it using a few tricks but Android is much less tolerant in
this regard.


Preet
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Trouble loading OSG plugins

2013-09-10 Thread Preet
On Tue, Sep 10, 2013 at 3:32 PM, Jorge Izquierdo Ciges
jori...@gmail.com wrote:
 So... 1rst - OSG searches plugins without lib at the begin and they are 
 compiled with lib if my memory  is well enough.

You were right. I was able to build an APK with the plugin files
(named osgdb_xx.so) but after deploying to the device itself all the
plugin shared objects were no longer in /data/app-lib/org.some.app/

 I have OSG with shared libraries and plugins in Android but it is far from 
 submission because we
 changed a lot of things and we are checking everything thrice, so don't 
 expect it soon.

Do you have a public repo where you are testing this out? I suspect
you're setting up a build similar to the static one where CMakeLists
will do most of the magic. My build notes are here (still have to add
some stuff, but its mostly complete:
https://github.com/preet/scratch/wiki/OpenSceneGraph-on-Android)


On Tue, Sep 10, 2013 at 6:10 PM, Raphael Grasset
raphael.gras...@gmail.com wrote:

 Hi Preet,

 For the path prefix, not sure if it works, but look at 
 src/osgDB/Registry.cpp, and the function createLibraryNameForExtension, you 
 will see a:
 std::string prepend = 
 std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/);

 so if you create an empty string it may address your path issue.

This set me on the right path to try an alternative once I realized I
couldn't pack the default osgdb_xx.so plugins in with the APK libs. I
used the osgPlugins CMake and set the TARGET_DEFAULT_PREFIX to
libosgdb_ (and modified createLibraryNameForExtension accordingly).
Prefixing them with lib meant they actually showed up on the device
when I deployed the APK... and I just ended up loading the plugins
directly with the linker (ie i just explicitly linked against them
when I built the app).

Doing all that takes a lot of effort though... it's cleaner (from
OSG's stand point) to save the plugins in internal storage and access
them that way. The cost with that method is the plugins have to be
packed and then extracted/installed during the application's first
run.

 Yet, it will be preferable that you build everything in static mode: what was 
 the reasons your static built didn't work?

I was able to configure the build using CMake successfully, but
calling make in the build directory fails with a bunch of 'undefined
reference to' errors:

I explained it briefly here:
http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2013-September/064587.html


Regards,

Preet
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org