how to create dovecot shared libraries

Asked by Wei Cao

Hello, everyone,

I've got a problem about your dovecot package. I had once built dovecot 1.2.9 following its official documents, i.e. "./configure" then "make", and got separate binaries for each component. For example, I got a "deliver" executable under src/deliver folder. But from your website, I mean, http://packages.ubuntu.com/source/lucid/dovecot, the package only includes a "deliver" shared library, not the "deliver" executable. That is, I got the src from the same website but could not create the same package. I studied "./configure" file under dovecot, and I suspected that "--enable-shared" may solve the problem, but after several tries, I never made it work. So I wonder what is your steps to create that package, is it related to the configure file under dovecot folder?

Thanks for your kind help in advance.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu dovecot Edit question
Assignee:
No assignee Edit question
Solved by:
mycae
Solved:
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :
#1

Unfortunately, if the configure.ac/configure.in & Makefile.am/Makefile.in files are not correctly written (the autoconf system is pretty arcane), then --enable-shared might not have the desired effect.

The whole system comes down to a giant script designed to work out the correct paramaters to pass to gcc/whatever compiler.

You might want to do a bit of background reading on creating some .so s by hand, then this will give you better insight into debugging the configure scripts.

You will likely need to patch the buildsystem -- this is a bit of a black art.

http://www.adp-gmbh.ch/cpp/gcc/create_lib.html

The wikipedia article on autoconf probably approaches the most clear explanation of the buildsystem -- like I said, its arcane, but quite populer (and surprisingly OK considering the alternatives...)

https://secure.wikimedia.org/wikipedia/en/w/index.php?title=Autoconf

Revision history for this message
mycae (mycae) said :
#2

Also, you should read the debian/rules file in the source package for debian

apt-get source dovecot

Revision history for this message
Wei Cao (blueterm-cao16) said :
#3

mycae,

Thanks for your answer. A further little question is: as I studied the dovecot package on ubuntu website, I found most of its components are compiled as shared libraries. Comparing to my manual compiling, I got several executables by running "./configure" and "make". I understand that there is a way to create shared library using "gcc -shared" just like dovecot official document says, but my first thought is as the ubuntu dovecot package involves so many shared libraries, it does not seem to be compiled separately for every shared library. So I had thought there might be an easy setting of configure or something else to do the whole thing. Anyway, if there is not such a bypass, I will study the links you provide and try to compile them myself.

Thanks.

Revision history for this message
mycae (mycae) said :
#4

If you can explain the reason you are recompiling, perhaps it might be clearer how to answer your question. Debian packages are built using an indirect method, rather than manually downloading the code and building it.

The method is outlined in the "Debian New Maintainers Guide", and is quite in depth. The "apt-get source" command retrieves the source package, and can be rebuilt using a script called dpkg-buildpackage
http://www.moosechips.com/2008/09/ubuntu-rebuild-a-source-package/

Revision history for this message
Wei Cao (blueterm-cao16) said :
#5

mycae,

Thanks for the quick reply. I want to replace the "deliver" shared library under /usr/lib/dovecot. I mean, I rewrote the source code about deliver (just for testing, I worked on Windows platform and now trying to learn somehting about Linux), and I think the easiest way to test my new "deliver" is to replace /usr/lib/dovecot/deliver with my own. As "deliver" is the only library that is affected, I would like to know how the compile process is so that I can repeat it and embed my code in it. I just tried to create the shared library manually, but it could not work after placing it to /usr/lib/dovecot folder, my suspect is it is not compatible with the rest of the package. So I'm asking this question.

Thanks.

Revision history for this message
Best mycae (mycae) said :
#6

You will be best off using the dpkg method. If you don't pass the same flags to GCC, then you do not have a guarantee of symbol portability (ABI compatibility) with any programs that use your modified lib.

Programs downstream of your library will need to know the exact layout of any structs and functions that present themselves externally, so your patch, depending upon what it does, can potentially break symbol compatability itself too.

So if you are shipping your own custom .so outside of the package management system you will

1) Need to rebuild every time there is a soname bump in any of your own dependencies. (This occurs relatively frequently between ubuntu releases)
2) Ensure ABi compatability with the version of the .so you are replacing.

Revision history for this message
Wei Cao (blueterm-cao16) said :
#7

Thanks mycae, that solved my question.