Thread: compiling the examples
Hi, How do i make the examples in postgresql-7.3.3/src/test/examples/? It seems that just typing make doesn't link to the libpq library. Where should I start make? Just typing make gives the following output: # make gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations -I../../../src/interfaces/libpq -I../../../src/include -Wl,-rpath,/usr/local/pgsql/lib testlibpq.c -o testlibpq /tmp/ccAN4Szw.o: In function `exit_nicely': /tmp/ccAN4Szw.o(.text+0xd): undefined reference to `PQfinish' /tmp/ccAN4Szw.o: In function `main': /tmp/ccAN4Szw.o(.text+0x3b): undefined reference to `PQsetdbLogin' /tmp/ccAN4Szw.o(.text+0x4a): undefined reference to `PQstatus' /tmp/ccAN4Szw.o(.text+0x75): undefined reference to `PQerrorMessage' /tmp/ccAN4Szw.o(.text+0xa9): undefined reference to `PQexec' /tmp/ccAN4Szw.o(.text+0xb4): undefined reference to `PQresultStatus' /tmp/ccAN4Szw.o(.text+0xd8): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0xf3): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0x104): undefined reference to `PQexec' /tmp/ccAN4Szw.o(.text+0x112): undefined reference to `PQresultStatus' /tmp/ccAN4Szw.o(.text+0x136): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0x151): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0x162): undefined reference to `PQexec' /tmp/ccAN4Szw.o(.text+0x170): undefined reference to `PQresultStatus' /tmp/ccAN4Szw.o(.text+0x194): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0x1af): undefined reference to `PQnfields' /tmp/ccAN4Szw.o(.text+0x1c9): undefined reference to `PQfname' /tmp/ccAN4Szw.o(.text+0x20c): undefined reference to `PQgetvalue' /tmp/ccAN4Szw.o(.text+0x23c): undefined reference to `PQntuples' /tmp/ccAN4Szw.o(.text+0x24c): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0x25d): undefined reference to `PQexec' /tmp/ccAN4Szw.o(.text+0x26b): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0x27c): undefined reference to `PQexec' /tmp/ccAN4Szw.o(.text+0x28a): undefined reference to `PQclear' /tmp/ccAN4Szw.o(.text+0x296): undefined reference to `PQfinish' collect2: ld returned 1 exit status make: *** [testlibpq] Error 1 -- Best regards, Marc.
Marc Cuypers <mozilla@mgvd.be> writes: > How do i make the examples in postgresql-7.3.3/src/test/examples/? "make" works for me, assuming that I'm doing it in a built directory tree. [ looks at 7.3 branch... ] Hm, it looks like there's a mistake in the Makefile in that directory in 7.3: try changing LIBS += $(libpq) to LDFLAGS += $(libpq) regards, tom lane
Tom Lane wrote: > Marc Cuypers <mozilla@mgvd.be> writes: > >>How do i make the examples in postgresql-7.3.3/src/test/examples/? > > > "make" works for me, assuming that I'm doing it in a built directory > tree. > > [ looks at 7.3 branch... ] Hm, it looks like there's a mistake in the > Makefile in that directory in 7.3: try changing > LIBS += $(libpq) > to > LDFLAGS += $(libpq) > This works. Thanks a lot. -- Best regards, Marc.
You forgot the: -L /usr/local/pgsql/lib -lpq Hope this helps, On Mon, Aug 18, 2003 at 02:01:08PM +0200, Marc Cuypers wrote: > Hi, > > How do i make the examples in postgresql-7.3.3/src/test/examples/? > It seems that just typing make doesn't link to the libpq library. Where > should I start make? > > Just typing make gives the following output: > # make > gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations > -I../../../src/interfaces/libpq -I../../../src/include > -Wl,-rpath,/usr/local/pgsql/lib testlibpq.c -o testlibpq > /tmp/ccAN4Szw.o: In function `exit_nicely': > /tmp/ccAN4Szw.o(.text+0xd): undefined reference to `PQfinish' > /tmp/ccAN4Szw.o: In function `main': > /tmp/ccAN4Szw.o(.text+0x3b): undefined reference to `PQsetdbLogin' > /tmp/ccAN4Szw.o(.text+0x4a): undefined reference to `PQstatus' > /tmp/ccAN4Szw.o(.text+0x75): undefined reference to `PQerrorMessage' > /tmp/ccAN4Szw.o(.text+0xa9): undefined reference to `PQexec' > /tmp/ccAN4Szw.o(.text+0xb4): undefined reference to `PQresultStatus' > /tmp/ccAN4Szw.o(.text+0xd8): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0xf3): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0x104): undefined reference to `PQexec' > /tmp/ccAN4Szw.o(.text+0x112): undefined reference to `PQresultStatus' > /tmp/ccAN4Szw.o(.text+0x136): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0x151): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0x162): undefined reference to `PQexec' > /tmp/ccAN4Szw.o(.text+0x170): undefined reference to `PQresultStatus' > /tmp/ccAN4Szw.o(.text+0x194): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0x1af): undefined reference to `PQnfields' > /tmp/ccAN4Szw.o(.text+0x1c9): undefined reference to `PQfname' > /tmp/ccAN4Szw.o(.text+0x20c): undefined reference to `PQgetvalue' > /tmp/ccAN4Szw.o(.text+0x23c): undefined reference to `PQntuples' > /tmp/ccAN4Szw.o(.text+0x24c): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0x25d): undefined reference to `PQexec' > /tmp/ccAN4Szw.o(.text+0x26b): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0x27c): undefined reference to `PQexec' > /tmp/ccAN4Szw.o(.text+0x28a): undefined reference to `PQclear' > /tmp/ccAN4Szw.o(.text+0x296): undefined reference to `PQfinish' > collect2: ld returned 1 exit status > make: *** [testlibpq] Error 1 > > -- > Best regards, > > Marc. > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > "All that is needed for the forces of evil to triumph is for enough good > men to do nothing." - Edmond Burke > "The penalty good people pay for not being interested in politics is to be > governed by people worse than themselves." - Plato