Re: compiling C library under mingw - Mailing list pgsql-hackers

From Marios Vodas
Subject Re: compiling C library under mingw
Date
Msg-id AANLkTikhj9xU1Tv9ds_mABEs093pukX5tGe2qkRzAQ+c@mail.gmail.com
Whole thread Raw
In response to compiling C library under mingw  (Marios Vodas <mvodas@gmail.com>)
Responses Re: compiling C library under mingw
List pgsql-hackers
I did a little search and I found that probably there is a library (dll or lib ???) that contains all these references.
Icould specify it by using -L/C/path/to/libraries -libraryname as an option to the second gcc command, but I have no
ideawhat the library is and where to find it (I used -L/C/PostgreSQL/9.0/lib -lpostgres -lpq, but it didn't work).<br
/>Allthose references are declared as extern in postgres source code.<br />Does anyone know what the library is?<br
/><br/><div class="gmail_quote">On Fri, Oct 8, 2010 at 12:27 PM, Marios Vodas <span dir="ltr"><<a
href="mailto:mvodas@gmail.com">mvodas@gmail.com</a>></span>wrote:<br /><blockquote class="gmail_quote"
style="margin:00 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I have a library that compiles fine under
linux.<br/>But when I try to compile it under mingw on windows 7 I get the following errors.<br /><br /><blockquote
class="gmail_quote"style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><font
size="2"style="font-family:courier new,monospace">gcc.exe -c -O2 -I/C/PostgreSQL/9.0/include/server
-I/C/PostgreSQL/9.0/include/server/utils-I/C/PostgreSQL/9.0/include/server/access
-I/C/PostgreSQL/9.0/include/server/port/win32-I/C/PostgreSQL/9.0/include  -MMD -MP -MF
build/Release/MinGW-Windows/mylib.o.d-o build/Release/MinGW-Windows/mylib.o mylib.c</font><br /></blockquote><br />The
previouscommand is successful and produces .o files (only some warnings here like: <span style="font-family:courier
new,monospace">warning:'pg_finfo_mytype_in' redeclared without dllimport attribute: previous dllimport
ignored</span>).<br/> The following though gives errors.<br /><br /><blockquote class="gmail_quote" style="margin:0pt
0pt0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex"><span style="font-family:courier
new,monospace">gcc.exe-shared -o dist/Release/MinGW-Windows/libMyLib.dll build/Release/MinGW-Windows/mylib.o</span><br
/></blockquote><br/>Here is the log:<br /><br /><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
0.8ex;border-left:1pxsolid rgb(204, 204, 204);padding-left:1ex"><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x128):undefined reference to `errstart'</span><br
style="font-family:couriernew,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x13d):undefined reference to
`_imp__CurrentMemoryContext'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x147):undefined reference to
`MemoryContextAlloc'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x17b):undefined reference to
`timestamp_in'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x180):undefined reference to
`DirectFunctionCall3'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x1be):undefined reference to
`timestamp_in'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x1c3):undefined reference to
`DirectFunctionCall3'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x1f4):undefined reference to `errmsg'</span><br
style="font-family:couriernew,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x202):undefined reference to `errcode'</span><br
style="font-family:couriernew,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x20e):undefined reference to `errfinish'</span><br
style="font-family:couriernew,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x230):undefined reference to
`_imp__CurrentMemoryContext'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x23a):undefined reference to
`MemoryContextAlloc'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x251):undefined reference to
`Int64GetDatum'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x25c):undefined reference to
`timestamp_out'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x261):undefined reference to
`DirectFunctionCall1'</span><brstyle="font-family:courier new,monospace" /><span style="font-family:courier
new,monospace">build/Release/MinGW-Windows/mylib.o:mylib.c:(.text+0x284):undefined reference to
`Int64GetDatum'</span><br/></blockquote><br /></blockquote></div><br /> 

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Sync Replication with transaction-controlled durability
Next
From: Magnus Hagander
Date:
Subject: Re: compiling C library under mingw