Thread: Unix build

Unix build

From
Peter Eisentraut
Date:
I managed to find a Libtool version that works, so here's the
independent build infrastructure for ODBC on Unix.

The patch also removes all the non-multibyte code.  This goes together
with the build system change, because there no longer is a way to turn
on multibyte explicitly.  You should make the required changes to the
Windows build files.

The following files need to be checked into CVS: configure.ac and
Makefile.am.  GNUmakefile can be removed.  I recommend that you do not
check in all the files generated by auto* (see below).  It can get
pretty messy to keep track of them.

* Prerequisites

Autoconf 2.52 or higher
Automake 1.6.* (Lower versions are rejected, version 1.7 untested.)
Libtool 1.4.2a (CVS from stable branch, maybe 1.4.2 works as well)
PostgreSQL source tree (7.3 branch)

* Bootstrapping

First, copy libtool.m4 into source directory.  Be sure to pick the one
from the right Libtool version.  Then run

aclocal -I . -I $PGSRC/config
libtoolize --force --copy
autoconf
autoheader
automake --add-missing --copy

You can run 'make maintainer-clean' to remove all the files this generates.

* Building

./configure
make
make install

configure has the same options that the PostgreSQL configure used to
have for ODBC, namely --with-iodbc, --with-unixodbc, and
--with-odbcinst=DIR.

* Version Number

The previous build infrastructure set a shared library version number
of 0.27.  I've used this as a package version number, but it does not
correspond to version.h in any way.  This needs to be thought out.

* Making a Source Distribution

'make dist' makes a file psqlodbc-0.27.tar.gz.  It's even better to
use 'make distcheck', which runs a number of tests to see if the
distribution is internally consistent.

The distribution does not contain any Windows-specific files (*.def,
maybe others).  If it is desired to include them, edit Makefile.am.

--
Peter Eisentraut   peter_e@gmx.net

Attachment

Re: Unix build

From
"Dave Page"
Date:
Thanks for this Peter.

Hiroshi: I'm a little busy right now, is this something you have time to
look at or shall I add it to my todo list?

Regards, Dave.

> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net]
> Sent: 07 October 2002 20:24
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] Unix build
>
>
> I managed to find a Libtool version that works, so here's the
> independent build infrastructure for ODBC on Unix.
>
> The patch also removes all the non-multibyte code.  This goes
> together with the build system change, because there no
> longer is a way to turn on multibyte explicitly.  You should
> make the required changes to the Windows build files.
>
> The following files need to be checked into CVS: configure.ac
> and Makefile.am.  GNUmakefile can be removed.  I recommend
> that you do not check in all the files generated by auto*
> (see below).  It can get pretty messy to keep track of them.
>
> * Prerequisites
>
> Autoconf 2.52 or higher
> Automake 1.6.* (Lower versions are rejected, version 1.7
> untested.) Libtool 1.4.2a (CVS from stable branch, maybe
> 1.4.2 works as well) PostgreSQL source tree (7.3 branch)
>
> * Bootstrapping
>
> First, copy libtool.m4 into source directory.  Be sure to
> pick the one from the right Libtool version.  Then run
>
> aclocal -I . -I $PGSRC/config
> libtoolize --force --copy
> autoconf
> autoheader
> automake --add-missing --copy
>
> You can run 'make maintainer-clean' to remove all the files
> this generates.
>
> * Building
>
> ./configure
> make
> make install
>
> configure has the same options that the PostgreSQL configure
> used to have for ODBC, namely --with-iodbc, --with-unixodbc,
> and --with-odbcinst=DIR.
>
> * Version Number
>
> The previous build infrastructure set a shared library
> version number of 0.27.  I've used this as a package version
> number, but it does not correspond to version.h in any way.
> This needs to be thought out.
>
> * Making a Source Distribution
>
> 'make dist' makes a file psqlodbc-0.27.tar.gz.  It's even
> better to use 'make distcheck', which runs a number of tests
> to see if the distribution is internally consistent.
>
> The distribution does not contain any Windows-specific files
> (*.def, maybe others).  If it is desired to include them,
> edit Makefile.am.
>
> --
> Peter Eisentraut   peter_e@gmx.net
>

Re: Unix build

From
Hiroshi Inoue
Date:
Dave Page wrote:
>
> Thanks for this Peter.
>
> Hiroshi: I'm a little busy right now, is this something you have time to
> look at or shall I add it to my todo list?

I'm also pretty busy now. It would take some time for me to
look at.

regards,
Hiroshi Inoue
    http://w2422.nsk.ne.jp/~inoue/

Re: Unix build

From
"Dave Page"
Date:

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue@tpf.co.jp]
> Sent: 08 October 2002 10:59
> To: Dave Page
> Cc: Peter Eisentraut; pgsql-odbc@postgresql.org
> Subject: Re: [ODBC] Unix build
>
>
> Dave Page wrote:
> >
> > Thanks for this Peter.
> >
> > Hiroshi: I'm a little busy right now, is this something you
> have time
> > to look at or shall I add it to my todo list?
>
> I'm also pretty busy now. It would take some time for me to look at.

OK, I'll add it to my list.

Regards, Dave.

Re: Unix build

From
"Dave Page"
Date:

> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net]
> Sent: 07 October 2002 20:24
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] Unix build
>
>
> I managed to find a Libtool version that works, so here's the
> independent build infrastructure for ODBC on Unix.

<...>

Hi Peter,

I finally got a chance to play with this, and ran into a few potential
issues, though I did end up with a libpsqlodbc.so (I can't easily check
it though as I don't use ODBC on unix).

Software wise, I have:

autoconf 2.53
automake 1.6.3
libtool 1.4.2 (snapshot download link was broken, and I didn't have time
to figure out how to install the cvs version)
PostgreSQL 7.3b2

I moved the current psqlODBC source into $PGSRC/src/interfaces/odbc, ran
the PostgreSQL configure script and then followed your instructions. The
only odd message I got was from libtoolize: 'You should update your
`aclocal.m4' by running aclocal.'. Noting your instructions, I tried the
libtool.m4 from my system, and the PostgreSQL source and found no
difference.

Build logs showing the errors are below. I suspect some of them may be
caused by Windows specific sources being compiled.

Any ideas?

Thanks, Dave.

root@snake:/usr/local/src/postgresql-7.3b2/src/interfaces/odbc# make
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o info.o info.c
info.c: In function `PGAPI_ProcedureColumns':
info.c:4192: warning: int format, long int arg (arg 3)
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o bind.o bind.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o columninfo.o
columninfo.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o connection.o
connection.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o convert.o convert.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o drvconn.o drvconn.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o environ.o environ.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o execute.o execute.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o lobj.o lobj.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o md5.o md5.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o misc.o misc.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o options.o options.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o pgtypes.o pgtypes.c
pgtypes.c: In function `getNumericColumnSize':
pgtypes.c:587: warning: unused variable `max_column_size'
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o psqlodbc.o
psqlodbc.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o qresult.o qresult.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o results.o results.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o socket.o socket.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o parse.o parse.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o statement.o
statement.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o tuple.o tuple.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o tuplelist.o
tuplelist.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o dlg_specific.o
dlg_specific.c
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -I.
-I../../../src/include  -DFRONTEND -DMD5_ODBC  -c -o odbcapi.o odbcapi.c

ar crs libpsqlodbc.a info.o bind.o columninfo.o connection.o convert.o
drvconn.o environ.o execute.o lobj.o md5.o misc.o options.o pgtypes.o
psqlodbc.o qresult.o results.o socket.o parse.o statement.o tuple.o
tuplelist.o dlg_specific.o odbcapi.o

ranlib libpsqlodbc.a

gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -fpic -shared
-Wl,-soname,libpsqlodbc.so.0 -Wl,-Bsymbolic info.o bind.o columninfo.o
connection.o convert.o drvconn.o environ.o execute.o lobj.o md5.o misc.o
options.o pgtypes.o psqlodbc.o qresult.o results.o socket.o parse.o
statement.o tuple.o tuplelist.o dlg_specific.o odbcapi.o  -lnsl -lm
-Wl,-rpath,/usr/local/pgsql/lib -o libpsqlodbc.so.0.27
info.o: In function `reallyEscapeCatalogEscapes':
info.o(.text+0x255f): undefined reference to `encoded_str_constr'
info.o(.text+0x258c): undefined reference to `encoded_nextchar'
connection.o: In function `CC_connect':
connection.o(.text+0xde7): undefined reference to `pg_CS_code'
connection.o(.text+0xded): undefined reference to `pg_CS_name'
connection.o(.text+0xe54): undefined reference to `pg_CS_code'
connection.o(.text+0xe5a): undefined reference to `pg_CS_name'
connection.o(.text+0xeb4): undefined reference to `pg_CS_code'
connection.o(.text+0x1b1d): undefined reference to
`CC_lookup_characterset'
convert.o: In function `QP_initialize':
convert.o(.text+0x1cbc): undefined reference to `encoded_str_constr'
convert.o: In function `inner_process_tokens':
convert.o(.text+0x2932): undefined reference to `encoded_byte_check'
convert.o: In function `convert_escape':
convert.o(.text+0x4432): undefined reference to `pg_mbschr'

convert.o: In function `convert_special_chars':
convert.o(.text+0x502c): undefined reference to `encoded_str_constr'
convert.o(.text+0x5059): undefined reference to `encoded_nextchar'
parse.o: In function `getNextToken':
parse.o(.text+0x136): undefined reference to `encoded_str_constr'
parse.o(.text+0x158): undefined reference to `encoded_nextchar'
parse.o(.text+0x242): undefined reference to `encoded_nextchar'
parse.o: In function `parse_statement':
parse.o(.text+0x13bc): undefined reference to `encoded_str_constr'
parse.o(.text+0x13e5): undefined reference to `encoded_nextchar'
dlg_specific.o: In function `getDSNinfo':
dlg_specific.o(.text+0x1c32): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1c77): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1cbc): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1d01): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1d46): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x1d88): more undefined references to
`GetPrivateProfileString' follow
dlg_specific.o: In function `getDSNinfo':
dlg_specific.o(.text+0x227b): undefined reference to `pg_CS_code'
dlg_specific.o(.text+0x2281): undefined reference to `pg_CS_name'
dlg_specific.o(.text+0x2299): undefined reference to `pg_CS_code'
dlg_specific.o(.text+0x229f): undefined reference to `pg_CS_name'

dlg_specific.o: In function `writeDriverCommoninfo':

dlg_specific.o(.text+0x23b6): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x23e9): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x241c): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x244f): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x2482): undefined reference to
`WritePrivateProfileString'
dlg_specific.o(.text+0x24b5): more undefined references to
`WritePrivateProfileString' follow
dlg_specific.o: In function `getCommonDefaults':
dlg_specific.o(.text+0x2a06): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2a72): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2ad3): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2b30): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2ba7): undefined reference to
`GetPrivateProfileString'
dlg_specific.o(.text+0x2c01): more undefined references to
`GetPrivateProfileString' follow
rm -f libpsqlodbc.so.0
ln -s libpsqlodbc.so.0.27 libpsqlodbc.so.0
rm -f libpsqlodbc.so
ln -s libpsqlodbc.so.0.27 libpsqlodbc.so
sed -n '/^CREATE OR REPLACE FUNCTION/s/CREATE OR REPLACE FUNCTION \([^
(][^ (]*([^)]*)\).*/DROP FUNCTION \1;/p' odbc.sql >odbc-drop.sql


Re: Unix build

From
Peter Eisentraut
Date:
Dave Page writes:

> I moved the current psqlODBC source into $PGSRC/src/interfaces/odbc, ran
> the PostgreSQL configure script and then followed your instructions. The
> only odd message I got was from libtoolize: 'You should update your
> `aclocal.m4' by running aclocal.'. Noting your instructions, I tried the
> libtool.m4 from my system, and the PostgreSQL source and found no
> difference.

You should use the one from the libtool installation (under
$PREFIX/share/aclocal).  It's not possibly the same as the one in the
PostgreSQL source tree.  Make sure you run aclocal as specified.  The -I .
should be before -I $PGSRC/config.  Also make sure you use the libtoolize
from the same Libtool version that provided libtool.m4.

> Build logs showing the errors are below. I suspect some of them may be
> caused by Windows specific sources being compiled.

It sure looks like the GNUmakefile is still there and hence all the new
stuff is completely ignored.

--
Peter Eisentraut   peter_e@gmx.net


Re: Unix build

From
"Dave Page"
Date:

> -----Original Message-----
> From: Peter Eisentraut [mailto:peter_e@gmx.net]
> Sent: 15 October 2002 19:55
> To: Dave Page
> Cc: pgsql-odbc@postgresql.org
> Subject: RE: [ODBC] Unix build
>
>
> Dave Page writes:
>
> > I moved the current psqlODBC source into
> $PGSRC/src/interfaces/odbc,
> > ran the PostgreSQL configure script and then followed your
> > instructions. The only odd message I got was from libtoolize: 'You
> > should update your `aclocal.m4' by running aclocal.'. Noting your
> > instructions, I tried the libtool.m4 from my system, and the
> > PostgreSQL source and found no difference.
>
> You should use the one from the libtool installation (under
> $PREFIX/share/aclocal).  It's not possibly the same as the
> one in the PostgreSQL source tree.  Make sure you run aclocal
> as specified.  The -I . should be before -I $PGSRC/config.
> Also make sure you use the libtoolize from the same Libtool
> version that provided libtool.m4.

Yes, I'm currently using /usr/share/aclocal/libtool.m4. Still get the
error|warning but otherwise it seems to work.

> > Build logs showing the errors are below. I suspect some of
> them may be
> > caused by Windows specific sources being compiled.
>
> It sure looks like the GNUmakefile is still there and hence
> all the new stuff is completely ignored.

Yeah, that would be the problem.

Thanks, Dave.