List:MySQL++« Previous MessageNext Message »
From:Peter Thorson Date:December 14 2010 9:53pm
Subject:Re: static library
View as plain text  
Hi Kemin,

Regarding Licensing:

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>
ranlib libmysqlpp.a

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
-lmysqlclient_r   -L/usr/local/mysql/lib

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>
$ make
<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.

Peter T

> 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!
> -dk
> 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.
> >>
> >
static libraryKemin Zhou14 Dec
  • Re: static libraryWarren Young14 Dec
    • Re: static libraryKemin Zhou14 Dec
      • Re: static libraryDino Korah14 Dec
      • Re: static libraryWarren Young15 Dec
        • Re: static librarySebastian Salazar15 Dec
          • Re: static libraryKemin Zhou16 Dec
            • Re: static libraryJonathan Wakely16 Dec
            • Re: static libraryChris Morgan16 Dec
            • Re: static libraryunrouted)16 Dec
          • Re: static libraryWarren Young16 Dec
            • Re: static libraryChris Frey16 Dec
              • Re: static libraryWarren Young16 Dec
                • Re: static libraryChris Frey17 Dec
                  • Re: static libraryWarren Young17 Dec
                    • Re: static libraryChris Frey17 Dec
Re: static libraryPeter Thorson14 Dec