Re: pg_scanner - patch no.1 - Mailing list pgadmin-hackers

From Dave Page
Subject Re: pg_scanner - patch no.1
Date
Msg-id CA+OCxoxopZQh8tfzWkodF5GoB-1eqLNWRNFy_15DwBbMjiUAiQ@mail.gmail.com
Whole thread Raw
In response to Re: pg_scanner - patch no.1  (Vladimir Kokovic <vladimir.kokovic@gmail.com>)
Responses Re: pg_scanner - patch no.1  (Vladimir Kokovic <vladimir.kokovic@gmail.com>)
List pgadmin-hackers
Hi

On Fri, Nov 9, 2012 at 5:23 AM, Vladimir Kokovic
<vladimir.kokovic@gmail.com> wrote:
> Hi,
>
> 1. pg_scanner is PostgreSQL 9.2 version, but I've made some changes to
> build with earlier versions(I hope).
> 2. PgadminScannerCommon.c renamed to pgadminScannerCommon.c
>     PgadminScanner.c renamed to pgadminScanner.c
>     PgadminScanner.h renamed to pgadminScanner.h

OK, we're getting there. I'm seeing an issue now that you probably
won't see unless you have a Mac to hand. Essentially, the scanner is
being built in the wrong architecture, so linking fails:

...
...
-lxml2 -lz -lpthread -liconv -lm ../xtra/pg_scanners/keywords.o
../xtra/pg_scanners/kwlookup.o ../xtra/pg_scanners/pgstrcasecmp.o
../xtra/pg_scanners/chklocale.o ../xtra/pg_scanners/wchar.o
../xtra/pg_scanners/mbutils.o ../xtra/pg_scanners/encnames.o
../xtra/pg_scanners/scansup.o
../xtra/pg_scanners/pgadminScannerCommon.o
../xtra/pg_scanners/libpgscanner92.a -L/usr/local/pgsql/lib -lpq
ld: warning: ignoring file ../xtra/pg_scanners/keywords.o, file was
built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0
0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/keywords.o
ld: warning: ignoring file ../xtra/pg_scanners/kwlookup.o, file was
built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0
0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/kwlookup.o
ld: warning: ignoring file ../xtra/pg_scanners/pgstrcasecmp.o, file
was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0
0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/pgstrcasecmp.o
ld: warning: ignoring file ../xtra/pg_scanners/chklocale.o, file was
built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0
0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/chklocale.o
ld: warning: ignoring file ../xtra/pg_scanners/wchar.o, file was built
for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1
0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/wchar.o
ld: warning: ignoring file ../xtra/pg_scanners/mbutils.o, file was
built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0
0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/mbutils.o
ld: warning: ignoring file ../xtra/pg_scanners/encnames.o, file was
built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0
0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/encnames.o
ld: warning: ignoring file ../xtra/pg_scanners/scansup.o, file was
built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0
0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not the
architecture being linked (i386): ../xtra/pg_scanners/scansup.o
ld: warning: ignoring file ../xtra/pg_scanners/pgadminScannerCommon.o,
file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7
0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 1 0x 0 0x 0 0x 0 ) which is not
the architecture being linked (i386):
../xtra/pg_scanners/pgadminScannerCommon.o
ld: warning: ignoring file ../xtra/pg_scanners/libpgscanner92.a, file
was built for archive which is not the architecture being linked
(i386): ../xtra/pg_scanners/libpgscanner92.a

I've spotted what I think are a few issues with the build system
changes, which will contribute to this, and possibly other problems we
may see in the future:

- I believe the above issue is caused by not adding $OSX_ARCH to the
LDADD variable for pg_scanners. See /acinclude.m4, which sets this
sort of thing up and ensures we get the right flags passed to every
individual build in the code.

- You shouldn't use ../xtra/pg_scanners in Makefiles, but
$(top_srcdir)/xtra/pg_scanners. You can use the png2c as a roughly
equivalent guide.

- Do you need to define the rules for each source file explicitly in
the Makefile? At minimum this should be a generic rule automatically
picking up all source files in the SOURCES list - ideally there should
be no explicit rules there at all.

Some other questions:

- At some point we're going to need to go through all this on Windows
as well :-/. Do you have a Windows system to work on that when we get
to it?

- Currently the code builds scanners with "92" in the name. Is this
intended to allow us to have multiple versions of the same scanner in
the future? If so, then it will also need to allow for Postgres Plus
Advanced Server and Greenplum DB scanners, which may have the same
versions but do support different syntax. If not, we should probably
just remove the "92" and make it as generic as possible.

- Can you please add a README file to xtra/pg_scanners that describes
the various files in there, and explains what needs to be updated to
move us to a new scanner from a different version of PostgreSQL?

Thanks!

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgadmin-hackers by date:

Previous
From: Vladimir Kokovic
Date:
Subject: Re: pg_scanner - patch no.1
Next
From: Heikki Linnakangas
Date:
Subject: SQL Editor hangs on COPY TO STDOUT