Debugging shared library on ARM

Hi,

I’m attempting to get my plugin running on the Raspberry Pi with ElkOS (ARM) for the first time. This is a plugin which is not built with JUCE. It does link with other programming libraries.

The error I’m seeing when loading the plugin is:
[vst2] Could not open library, XXXX.so: unexpected reloc type 0x03.

My understanding is that this typically means there is a problem between static and shared library code.

I built our plugin source files using the -fPIC compiler switch, and also built the programming libraries with the -fPIC compiler switch. I was able to run an x86_64 version of this plugin using Sushi on my Linux VM.

Do you have any suggestions on how to narrow down the cause of the problem?

Thanks very much,

  • Rick Cohen

Hi Rick,
could you please type the output of

$ ldd your-plugin-binary.so

from the Elk Pi itself?

Hello @Stefano,

I figured out this particular issue (more issues coming in a separate thread).

By the way, I was able to debug this problem on my Raspberry Pi with the following command:
readelf -r MyLibrary.so | grep R_ARM_REL32

This showed relocatable functions that would display “unexpected reloc type 0x03”.

In case somebody else runs into it, the problem turned out to be with a programming framework that we are using: “POCO”.

The instructions for building POCO from CMake are detailed on their website. On that site, they say that you can add option flags to the C and C++ compiler from the CMake command line. And that works fine with the native x86 Linux Build. HOWEVER, when building with the ARM tools, the source script used has defined CFLAGS and CXXFLAGS. The CMakeLists.txt supplied with POCO does not handle this well, and when I thought I had added the correct option “-fPIC” (position independent code) it turns out that the new option was NOT being used. I modified the POCO CMakeLists.txt file to add the option, and now it was correctly built.

While I’m speaking about the ARM tools, I will also say that the lines of my CMakeLists.txt script with find_library() to find the POCO libraries were not working correctly. This is because of CMAKE_FIND_ROOT_PATH_MODE_LIBRARY being set to ONLY. I was able to solve this issue by adding NO_CMAKE_FIND_ROOT_PATH within my find_library call.

Details here:
https://gist.github.com/davisford/3789287

Take care and thanks for listening,

  • Rick Cohen