05-29-2012 11:06 PM
Hey,
I'm trying to compile OpenSceneGraph for the PlayBook. It's a C++ library and the PlayBook already has all the key dependencies available. The project itself uses CMake for its build system, where you can specify paths for dependencies and which compilers to use. I matched up all the necessary paths using the tools available in the NDK. Right now I'm just trying to get a build working for the Simulator, so I used the ntox86-g++ compiler.
Building the library (I built it as a static lib) works fine. Linking an application against the library however gives me the following output:
(.rodata._ZTVN9osgViewer22GraphicsWindowEmbeddedE[
osgViewer::GraphicsWindow::requestRedraw() is a virtual function that's also been implemented (ie not pure virtual). I read online that the "undefined reference to non-virtual thunk" is a compiler/linker bug that happens when you compile the library and your project with different optimization flags. I made sure the same optimization flags are always passed to the compiler.
Here's a sample compiler call for my project (this is using qmake defaults for ndk -- it calls qcc with ntox86):
qcc -Vgcc_ntox86 -lang-c++ -Wl,-rpath-link,/home/preet/bbndk-2.0.1/target/qnx
Here's an example of how CMake from OpenSceneGraph calls the compiler:
/home/preet/bbndk-2.0.1/host/linux/x86/usr/bin/nto
Note that both use the same optimization level. I'm assuming that 'ntox86-g++' is the same thing as 'qcc -Vgcc_notx86 -lang-c++'. I'm at a loss of how to troubleshoot this any further. There are a bunch of open source projects up on the BlackBerry github that use CMake so this should work -- OpenSceneGraph has also been ported to Android and iOS as well. I'd appreciate any advice.
05-30-2012 12:53 PM
Hi,
I noticed the fiollowing in your compiler line:
-L/usr/local/Trolltech/QtLighthouse-4.8.2-i386/lib
Not sure if this has anything to do with your problems, but when cross compiling, it should never be referencing libs in /usr/local
05-30-2012 01:48 PM
Thanks for the reply.
I've simply installed the relevant Qt libs in /usr/local/Trolltech... it shouldn't pose an issue.
05-30-2012 04:27 PM
Yes, but where did you get those QT libs? Were they built for the playbook simulator or were they just general x86 binaries?
05-30-2012 04:47 PM
They were built specifically for the Playbook Simulator. I followed the instructions available on the qt-project website to build the libs (and I've tested / successfully deployed other sample applications to both the simulator and device so I think the Qt libs are in working order)
05-31-2012 02:31 PM
Small follow up. While I'm still unable to get OpenSceneGraph to run on the PlayBook, I was able to compile/link successfully by modifying OpenSceneGraph's source. I think the issue might be with the tool chain's compiler (I'm using the 2.0.1 NDK which includes GCC 4.4.2) with respect to a specific situation in C++ where you have multiple inheritance and virtual functions. GCC 4.7 was able to link without any modifications to the source which further suggests its compiler related.