Custom types for a Windows server

Поиск
Список
Период
Сортировка
Искать

Custom types for a Windows server

От:
Armel HERVE <ah.pgsql@laposte.net>
Дата:
Hi there,

we made some custom types (written in C)  for PostgreSQL onto a Linux 
server.
We need to deploy a Windows server...

The documentation does not talk about a shared library for Windows 
(http://www.postgresql.org/docs/8.1/interactive/xfunc-c.html#DFUNC)
I tried to compile its custom types with borland bcc32, with no success:

Does somebody can help me ?


Thanks

Armel (who writes English very bad...)



D:\tmp>bcc32 -I"c:\Program Files\PostgreSQL\8.1\include\server" 
-Ic:\Borland\BCC55\Include -I"c:\Program Files\PostgreSQ
L\8.1\include" country.c
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
country.c:
Warning W8017 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 145: Redefinition of 
'SIGUSR1' is not identi
cal
Warning W8017 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 146: Redefinition of 
'SIGUSR2' is not identi
cal
Error E2147 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 225: 'pid_t' cannot 
start a parameter declarat
ion
Error E2209 c:\Program Files\PostgreSQL\8.1\include\server\c.h 70: 
Unable to open include file 'strings.h'
Error E2238 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 79: Multiple 
declaration for 'shmid_ds'
Error E2344 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 78: Earlier 
declaration of 'shmid_ds'
Error E2238 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 94: Multiple 
declaration for 'semun'
Error E2344 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 93: Earlier 
declaration of 'semun'
Error E2238 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 101: Multiple 
declaration for 'sembuf'
Error E2344 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 100: Earlier 
declaration of 'sembuf'
Error E2238 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 149: Multiple 
declaration for 'timezone'
Error E2344 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 148: Earlier 
declaration of 'timezone'
Error E2238 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 157: Multiple 
declaration for 'itimerval'
Error E2344 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 156: Earlier 
declaration of 'itimerval'
Error E2147 c:\Program 
Files\PostgreSQL\8.1\include\server\pg_config_os.h 225: 'pid_t' cannot 
start a parameter declarat
ion
Error E2209 c:\Program Files\PostgreSQL\8.1\include\server\c.h 98: 
Unable to open include file 'libintl.h'
Error E2176 c:\Program Files\PostgreSQL\8.1\include\server\c.h 291: Too 
many types in declaration
Error E2176 c:\Program Files\PostgreSQL\8.1\include\server\c.h 294: Too 
many types in declaration
Error E2209 c:\Program Files\PostgreSQL\8.1\include\server\port.h 16: 
Unable to open include file 'pwd.h'
Error E2209 c:\Program Files\PostgreSQL\8.1\include\server\port.h 17: 
Unable to open include file 'netdb.h'
Error E2221 c:\Program Files\PostgreSQL\8.1\include\server\port.h 252: 
Macro argument syntax error
Error E2209 c:\Program Files\PostgreSQL\8.1\include\server\port.h 307: 
Unable to open include file 'netinet/in.h'
Error E2209 c:\Program Files\PostgreSQL\8.1\include\server\port.h 308: 
Unable to open include file 'arpa/inet.h'
Error E2040 c:\Program Files\PostgreSQL\8.1\include\server\port.h 318: 
Declaration terminated incorrectly
Error E2451 country.c 267: Undefined symbol '__func__' in function 
country_in
Error E2140 country.c 271: Declaration is not allowed here in function 
country_in
Error E2140 country.c 272: Declaration is not allowed here in function 
country_in
Error E2228 country.c 272: Too many error or warning messages in 
function country_in
*** 26 errors in Compile ***


Re: Custom types for a Windows server

От:
"Magnus Hagander" <mha@sollentuna.net>
Дата:
> we made some custom types (written in C)  for PostgreSQL onto 
> a Linux server.
> We need to deploy a Windows server...
> 
> The documentation does not talk about a shared library for Windows
> (http://www.postgresql.org/docs/8.1/interactive/xfunc-c.html#DFUNC)
> I tried to compile its custom types with borland bcc32, with 
> no success:
> 
> Does somebody can help me ?
> 

You need to compile the functions using MingW GCC.

//Magnus

Re: Custom types for a Windows server

От:
Armel HERVE <ah.pgsql@laposte.net>
Дата:
Magnus Hagander wrote:
we made some custom types (written in C)  for PostgreSQL onto 
a Linux server.
We need to deploy a Windows server...

The documentation does not talk about a shared library for Windows
(http://www.postgresql.org/docs/8.1/interactive/xfunc-c.html#DFUNC)
I tried to compile its custom types with borland bcc32, with 
no success:

Does somebody can help me ?
   
You need to compile the functions using MingW GCC.

//Magnus
 
Thanks again for your answers.
Now, when I try to generate the shared library by the following command:
gcc -shared -o pstypes.dll -Wl,-dy,--library-path,/c/Program\ Files/PostgreSQL/8.1/lib/,-l,libpq.a,--out-implib,pstypes.a country.o

the compiler response is:
c:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -llibpq.a
collect2: ld returned 1 exit status

but the libpq.a is in the lib repository of PostgresSQL...

I tried to link with the libpq.dll located in the bin repository, the response is the same: cannot find -llibpq.dll

Armel

Re: Custom types for a Windows server

От:
Armel HERVE <ah.pgsql@laposte.net>
Дата:
Armel HERVE wrote:
Magnus Hagander wrote:
we made some custom types (written in C)  for PostgreSQL onto 
a Linux server.
We need to deploy a Windows server...

The documentation does not talk about a shared library for Windows
(http://www.postgresql.org/docs/8.1/interactive/xfunc-c.html#DFUNC)
I tried to compile its custom types with borland bcc32, with 
no success:

Does somebody can help me ?
   
You need to compile the functions using MingW GCC.

//Magnus
 
Thanks again for your answers.
Now, when I try to generate the shared library by the following command:
gcc -shared -o pstypes.dll -Wl,-dy,--library-path,/c/Program\ Files/PostgreSQL/8.1/lib/,-l,libpq.a,--out-implib,pstypes.a country.o

the compiler response is:
c:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -llibpq.a
collect2: ld returned 1 exit status

but the libpq.a is in the lib repository of PostgresSQL...

I tried to link with the libpq.dll located in the bin repository, the response is the same: cannot find -llibpq.dll

Armel

In fact, the true command is
gcc -shared -o pstypes.dll -Wl,--library-path=/c/Program\ Files/PostgreSQL/8.1/lib/,-l,pgport,-lpostgres,--out-implib,pstypes.a country.o

and the response is
Creating library file: pstypes.a
country.o(.text+0x2e):country.c: undefined reference to `elog_start'
country.o(.text+0x49):country.c: undefined reference to `elog_finish'
country.o(.text+0xb0):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0xba):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0xf4):country.c: undefined reference to `elog_start'
country.o(.text+0x10f):country.c: undefined reference to `elog_finish'
country.o(.text+0x13d):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x147):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x1b0):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x1ba):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x205):country.c: undefined reference to `pfree'
country.o(.text+0x241):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x24b):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x280):country.c: undefined reference to `pfree'
country.o(.text+0x2eb):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x2f5):country.c: undefined reference to `MemoryContextAlloc'
country.o(.text+0x33f):country.c: undefined reference to `_imp__CurrentMemoryContext'
country.o(.text+0x349):country.c: undefined reference to `MemoryContextAlloc'
collect2: ld returned 1 exit status

I tried to link with all found library with no success...

Armel

FAQ