Understanding this, making a static version of the is relatively simple, as a static
library is simply a container of .o files.
ar rcu libmysqlpp.a <list of .o files>
to get the list of object files I would suggest building mysqlpp normally (whatever
produces working .dylibs) for you and watching make output for a line of the following
g++ -dynamiclib -single_module -headerpad_max_install_names -o libmysqlpp.3.1.0.dylib
<list of .o files> -install_name /usr/local/lib/libmysqlpp.3.dylib
Example list of commands for the build I recently did against 3.1.0 configured with
thread-check (not necessary to make a static lib):
<download and tar/zip mysqlpp archive>
$ cd ~/mysql++-3.1.0/
$ ./configure --enable-thread-check
<lots of output>
<lots of output> (note this is making the .o files that you need to run the create
library command yet)
$ ar rcu libmysqlpp.a mysqlpp_beemutex.o mysqlpp_cmdline.o mysqlpp_connection.o
mysqlpp_cpool.o mysqlpp_datetime.o mysqlpp_dbdriver.o mysqlpp_field_names.o
mysqlpp_field_types.o mysqlpp_manip.o mysqlpp_myset.o mysqlpp_mysql++.o mysqlpp_mystring.o
mysqlpp_null.o mysqlpp_options.o mysqlpp_qparms.o mysqlpp_query.o mysqlpp_result.o
mysqlpp_row.o mysqlpp_scopedconnection.o mysqlpp_sql_buffer.o mysqlpp_sqlstream.o
mysqlpp_ssqls2.o mysqlpp_stadapter.o mysqlpp_tcp_connection.o mysqlpp_transaction.o
mysqlpp_type_info.o mysqlpp_uds_connection.o mysqlpp_utility.o mysqlpp_vallist.o
$ ranlib libmysqlpp.a
<you will be responsible for putting libmysqlpp.a somewhere your compiler can find it,
make install wont move it for you>
- This wont include the C MySQL client library, so you will have to statically link that
into your program as well (libmysqlclient.a / libmysqlclient_r.a)
- These steps were done on Mac OS X 10.6.5, they should apply to other UNIX-like OSes, I
have no idea how this might be done on Windows.
> I am pretty sure there is some licensing issues (LGPL) that made static
> compilation disabled by default (?!?)
> Thats the answer I got when I asked the same question last time.
> But it is not absolutely impossible; you can get it to work if you try.
> I did manage to do it but was never seen as a need. So I do not have the
> formula handy. Sorry!
> On 14/12/10 20:10, Kemin Zhou wrote:
> > Thanks Warren,
> > I tried --enalbe-static
> > --disable-shared
> > and
> > --enable-static --disable-shared in both order (one after the other)
> > None of be above produces static libraries.
> > I am using the most recent download: last night.
> > Is this config option added very recently?
> > My donwload was 3.1.0
> > Our IT is not cooperating, they are "busy" with other
> > things.
> > Warren Young wrote:
> >> On 12/13/2010 11:58 PM, Kemin Zhou wrote:
> >>> ./configure --enable-static
> >> Try --disable-shared.