The love and hate for shared libraries

Reading Time: 2 minutes

Introduction

Since yesterday I have been playing around on the WII controller integration on my PATRIA 3D engine.

This is required in order to have a fully working accelerometer support for our games testing since it is quite an effort to perform real testings on the smartphones especially when you are still in the middle of the caos of code development.

I have been trying the libwiimote on my ubuntu 64 bit but unfortunately, for some reasons, it does not look like the best solution for me (thought the library is well done). In fact it has a lot of sleep/wait time in the implementation which cause the frame reate of the game Fantasy Racing to drop to 15/18 FPS on my laptop. It looks like that, if no input is made on the device, the wiimote_update function freezes my process.

I have then decided to go for libwiiuse and I find it fantastic though I have not yet completed the integration.

 

How to compile

To cut a long story short, I have compiled the library, using the well done documentation, I have done all the required configuration steps in my eclipse environment but every time I have run a compiled program using the shared object library libwiiuse.so  I used to get this error message:

error while loading shared libraries: libwiiuse.so: cannot open shared object file: No such file or directory

This problem has kiled me since I spent a lot of time looking for an explanation to the root causes of it.

After I while I thought…..holy crap Maurizio, can you be such a stupid? The new library is a shared library which links other shared libraries, let’s try to refresh the dynamic linker cache by running the command ldconfig

.

And….it actually solved it.

Lesson learnt, whenever you have problems linking shared libraries, always remember to update the linker cache!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.