Re: The incompaitiblity of libpq and non-GCC compilers - Mailing list pgsql-hackers
From | Andrew Dunstan |
---|---|
Subject | Re: The incompaitiblity of libpq and non-GCC compilers |
Date | |
Msg-id | 406B5D54.2040300@dunslane.net Whole thread Raw |
In response to | The incompaitiblity of libpq and non-GCC compilers ("Dann Corbit" <DCorbit@connx.com>) |
List | pgsql-hackers |
Some of this looks at first glance like it doesn't belong in an interface library - maybe we should be wrapping more in #ifdef FRONTEND ? cheers andrew Dann Corbit wrote: >After making the following change in port.h: >/* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ >/* open() replacement to allow delete of held files */ >extern int win32_open(const char*,int,...); >#ifdef _MSC_VER >#define open win32_open >#else >#define open(a,b,...) win32_open(a,b,##__VA_ARGS__) >#endif >/* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ > >I can get a little further towards a build of libpq... > >U:\postgresql-snapshot\src>nmake /f win32.mak > >Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 >Copyright (C) Microsoft Corp 1988-1998. All rights reserved. > > cd include > if not exist pg_config.h copy pg_config.h.win32 pg_config.h > cd .. > cd interfaces\libpq > nmake /f win32.mak > >Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 >Copyright (C) Microsoft Corp 1988-1998. All rights reserved. > >Building the Win32 static library... > > cl.exe @u:\tmp\nma01920. >getaddrinfo.c > cl.exe @u:\tmp\nmb01920. >thread.c >..\..\include\utils/elog.h(37) : warning C4005: 'ERROR' : macro >redefinition > C:\Program Files\Microsoft SDK\Include\.\wingdi.h(98) : see >previous definition of 'ERROR' > cl.exe @u:\tmp\nmc01920. >inet_aton.c > cl.exe @u:\tmp\nmd01920. >crypt.c > cl.exe @u:\tmp\nme01920. >path.c > cl.exe @u:\tmp\nmf01920. >dllist.c > cl.exe @u:\tmp\nmg01920. >md5.c > cl.exe @u:\tmp\nmh01920. >ip.c > cl.exe @u:\tmp\nmi01920. >wchar.c > cl.exe @u:\tmp\nmj01920. >encnames.c > cl.exe @u:\tmp\nmk01920. >win32.c >fe-auth.c >..\..\include\libpq/libpq-be.h(21) : fatal error C1083: Cannot open >include file: 'sys/time.h': No such file or directory >fe-protocol2.c >fe-protocol3.c >fe-connect.c >fe-exec.c >fe-lobj.c >C:\lang\VC98\include\io.h(176) : error C2375: 'pgrename' : redefinition; >different linkage > ..\..\include\port.h(45) : see declaration of 'pgrename' >C:\lang\VC98\include\io.h(238) : error C2375: 'win32_open' : >redefinition; different linkage > ..\..\include\port.h(55) : see declaration of 'win32_open' >C:\lang\VC98\include\io.h(244) : error C2375: 'pgunlink' : redefinition; >different linkage > ..\..\include\port.h(46) : see declaration of 'pgunlink' >fe-misc.c >fe-print.c >fe-secure.c >pqexpbuffer.c >NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' >Stop. >NMAKE : fatal error U1077: 'C:\lang\VC98\bin\NMAKE.EXE' : return code >'0x2' >Stop. > >Some notions: >1. For the macro ERROR above, we should #undef ERROR > >2. #include <sys/time.h> should have #ifndef _MSC_VER around it. I did >this: >#ifndef _MSC_VER >#include <sys/time.h> >#endif > >3. For the errors in io.h, it appears that there are some macros that >redefine rename and unlink >I did this: >/*---------------------------------------------------------------------- >--- > * > * fe-lobj.c > * Front-end large object interface > * > * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group > * Portions Copyright (c) 1994, Regents of the University of California > * > * > * IDENTIFICATION > * $PostgreSQL: pgsql-server/src/interfaces/libpq/fe-lobj.c,v >1.48 2004/03/05 01:53:59 tgl Exp $ > * > >*----------------------------------------------------------------------- >-- > */ >#include "postgres_fe.h" > >#include <fcntl.h> >#include <sys/stat.h> >#include <errno.h> > >#ifdef WIN32 >#include "win32.h" >#undef rename >#undef open >#undef unlink >#include "io.h" >#else >#include <unistd.h> >#endif > >There remains one problem on the build -- an unresolved symbol: >U:\postgresql-snapshot\src>nmake /f win32.mak > >Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 >Copyright (C) Microsoft Corp 1988-1998. All rights reserved. > > cd include > if not exist pg_config.h copy pg_config.h.win32 pg_config.h > cd .. > cd interfaces\libpq > nmake /f win32.mak > >Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 >Copyright (C) Microsoft Corp 1988-1998. All rights reserved. > >Building the Win32 static library... > > cl.exe @u:\tmp\nma02216. >fe-auth.c > link.exe -lib @u:\tmp\nmb02216. > cl.exe @u:\tmp\nmc02216. >libpqdll.c > rc.exe /l 0x409 /fo".\Release\libpq.res" libpq.rc > link.exe @u:\tmp\nmd02216. > Creating library .\Release\libpqdll.lib and object >.\Release\libpqdll.exp >libpq.lib(fe-connect.obj) : error LNK2001: unresolved external symbol >_set_noblock >.\Release\libpq.dll : fatal error LNK1120: 1 unresolved externals >NMAKE : fatal error U1077: 'link.exe' : return code '0x460' >Stop. >NMAKE : fatal error U1077: 'C:\lang\VC98\bin\NMAKE.EXE' : return code >'0x2' >Stop. > >This stuff really needs to be functional with compilers besides GCC >derivatives. > >---------------------------(end of broadcast)--------------------------- >TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > > >
pgsql-hackers by date: