On Wed, Oct 20, 2010 at 4:29 PM, Igor Filippov [Contr]
<filipp...@mail.nih.gov> wrote:
> Tim,
>
>> I'll take a look since it is an important format to support. This
>> should be the last major issue for static building though.
>>
>
> Great - thank you! Could the static_plugins.o be also compiled into
> libopenbabel.a by default? I think this would make sense...

Yes, but this would require the -u flags again... The plugins are
compiled into libopenbabel.a but the symbols are not taken from the
libopenbabel.a archive when linking your executable since they are not
referenced. There are two solutions:

* Include the plugins inside the executable (or include
static_plugin.o when linking)
* Undefine the symbols explicitly at link time using the -u flag to
ensure the symbols are taken from libopenbabel.a

However, I just pushed the changes to include inchi in the static
builds and you could use this command line to create a
static_plugins.o that contains all plugins: (run this after compiling)

tim...@timvdm-desktop:~/openbabel-gitsvn/build_static$ g++ -Wl,-r -o
static_plugins.o -nostdlib  src/CMakeFiles/openbabel.dir/charges/*.o
src/CMakeFiles/openbabel.dir/descriptors/*.o
src/CMakeFiles/openbabel.dir/fingerprints/*.o
src/CMakeFiles/openbabel.dir/forcefields/*.o
src/CMakeFiles/openbabel.dir/formats/*.o
src/CMakeFiles/openbabel.dir/formats/xml/*.o
src/CMakeFiles/openbabel.dir/ops/*.o

tim...@timvdm-desktop:~/openbabel-gitsvn/build_static$ ls static_plugins.o -lh
-rw-r--r-- 1 timvdm timvdm 65M 2010-10-21 01:16 static_plugins.o

tim...@timvdm-desktop:~/openbabel-gitsvn/build_static$ objdump -t
static_plugins.o | grep _ZTVN9OpenBabel11InChIFormatE
0000000000000000 l    d
.rodata._ZTVN9OpenBabel11InChIFormatE   0000000000000000
.rodata._ZTVN9OpenBabel11InChIFormatE
0000000000000000  w    O
.rodata._ZTVN9OpenBabel11InChIFormatE   00000000000000a8 .hidden
_ZTVN9OpenBabel11InChIFormatE

tim...@timvdm-desktop:~/openbabel-gitsvn/build_static$ g++ -Iinclude
-I../include -static  ../doc/examples/static_executable/myexe.cpp
static_plugins.o -o myexe  src/libopenbabel.a
src/formats/inchi103/libinchi.a -Wl,-Bstatic -lxml2 -lz
...
tim...@timvdm-desktop:~/openbabel-gitsvn/build_static$ ./myexe
... lists all plugins ...

The command first line "merges" all the object files in a single
static_plugins.o. There is probably a better way but at least you
should now be able to make a static executable with all plugins.

Tim

> Igor
>
>

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to