How to compile shared core/plugin libraries

Asked by dmr

I want to try to use the synapse backend in a separate program. Eventually, I'm thinking synapse, but looking like dmenu. To do this, I wanted to try to load the synapse libraries into ruby with the ruby ffi. To do this, I'd need to generate libsynapsecore.so and libplugins.so. The problem is that I know next to nothing about vala, automake, and libtool. I tried using the following sets of directions:

http://stackoverflow.com/questions/8916425/how-to-create-a-shared-library-so-in-an-automake-script

http://www.gnu.org/software/automake/manual/html_node/A-Shared-Library.html#A-Shared-Library

but have been unable to generate a .so (I checked .libs). I've tried passing --enable-shared and --with-pic (which seems redundant), but to no avail. I note that libsynapsecore.la always has dlname='', which seems like a sign that something is wrong.

I know I could build the .so's the hacky way (ignore the automake stuff and just gcc -shared), but I suspect I'm going to end up messing around with the source a bit, and I'd prefer not to go down this road if possible. If somebody could help me build some .so files the "right" way, it'd be a big help.

Question information

Language:
English Edit question
Status:
Solved
For:
Synapse Edit question
Assignee:
No assignee Edit question
Solved by:
Michal Hruby
Solved:
Last query:
Last reply:
Revision history for this message
Jeremy Munsch (jeremy-munsch) said :
#1

I don't know how to do this but maybe you could find some info on this branch
https://code.launchpad.net/~elementary-apps/synapse-project/indicator-search
which is using synapse as backend.

Revision history for this message
Jeremy Munsch (jeremy-munsch) said :
#2

So according this https://plus.google.com/104908072417273204416/posts/CoTv8AEzcDg
the branch on above comment can build libsynapse, but synapse itself can't.
So you may look on the other project.
Please tell me if you succeed to have build of last synapse version.

Revision history for this message
Jeremy Munsch (jeremy-munsch) said :
#3

Here are the changes i talked about made by Rico.
http://bazaar.launchpad.net/~tombeckmann/+junk/test-indicator/revision/509

Revision history for this message
Jeremy Munsch (jeremy-munsch) said :
#4

I just got the mentioned branch
In indicator-search/src/indicator/ are the files you are looking for
libsynapse.h
libsynapse.la
Makefile.am

So they contain instructions to build c lib.

Maybe you could make a PR to add these to the main synapse branch so other people could have t easily.
I just can't make it myself as i'm still a noob and you seems to know the things more than me.

Revision history for this message
Best Michal Hruby (mhr3) said :
#5

If I recall correctly, the automake setup is done in a way where it builds libraries for core and plugins, but they are explicitely marked as "noinst" which ultimately means that a .so won't be build out of them and instead the synapse binary (built in the ui subdir) just links statically with them.

What I'd suggest is to create another src directory which will be pretty much the same thing as the automake in ui subdirectory but instead of building a binary, it will build an actual .so from the two libraries (because .so based plugin loading isn't implemented, so you'll save yourself some headache by having all the plugins compiled in there). Basically you need a _LTLIBRARIES target there without the noinst definition.

Hope that helps.

Revision history for this message
Rico Tzschichholz (ricotz) said :
#6

It is pretty straight forward to enable this.

I would object proposals to enable it since imo it is *not* wanted for synapse trunk branch (yet).

Revision history for this message
dmr (dradetsky) said :
#7

Thanks Michal Hruby, that solved my question.

Revision history for this message
dmr (dradetsky) said :
#8

Was also necessary to define the variable dir and set it to some absolute path (I set dir=/). No idea what this is. The install target? Anyway, managed to build some .so's, although who knows if they work or not.