473,404 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

undefined reference to 'pg_detoast_datum'

In PostgreSQL 7.2 (Redhat 7.3 version, so it is patched), I'm trying to
create a Version-1 C server extension. The Version-0 format works, the
Version-1 version fails with:
undefined reference to 'pg_detoast_datum'

According to docs at:
http://www.postgresql.org/docs/7.2/i...e/xfunc-c.html

....by using Version-1 the pg_detoast_datum is no longer needed. FYI, the
function being created takes and returns a text argument. Are the docs
there wrong, or is there a bug in the library build, that causes
Version-1 to require linking to a lib with pg_detoast_datum?

A google search shows very little concerning the pg_detoast_datum
undefined reference link error. It is looking more like the V1 has to be
skipped and I'll have to go back to V0 if I can't get this to work. [and
unless someone can magically make the default PostgreSQL version on RH
7.3 change to a newer version of PostgreSQL, then a newer version can't
be used]

D. Stimits
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #1
2 2801
D. Stimits wrote:
A google search shows very little concerning the pg_detoast_datum
undefined reference link error. It is looking more like the V1 has to be
skipped and I'll have to go back to V0 if I can't get this to work.
You haven't shown us your function, so it's a bit difficult to help, but
in any case you do *not* want to use the V0 calling conventions -- they
are deprecated and subject to removal in the future. V1 certainly works
-- I've done many V1 C functions that accept text arguments. Take a look
at some of the contrib folder extensions if you need examples.
unless someone can magically make the default PostgreSQL version on RH
7.3 change to a newer version of PostgreSQL, then a newer version can't
be used]


Why not? I have Postgres 7.3.4 running on my RH 7.3 server. Here are RH
7.3 RPMs:
ftp://ftp8.us.postgresql.org/pub/pgs...MS/redhat-7.3/

Joe

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #2
Joe Conway wrote:
D. Stimits wrote:
A google search shows very little concerning the pg_detoast_datum
undefined reference link error. It is looking more like the V1 has to
be skipped and I'll have to go back to V0 if I can't get this to work.

You haven't shown us your function, so it's a bit difficult to help, but
in any case you do *not* want to use the V0 calling conventions -- they
are deprecated and subject to removal in the future. V1 certainly works
-- I've done many V1 C functions that accept text arguments. Take a look
at some of the contrib folder extensions if you need examples.
unless someone can magically make the default PostgreSQL version on RH
7.3 change to a newer version of PostgreSQL, then a newer version
can't be used]

Why not? I have Postgres 7.3.4 running on my RH 7.3 server. Here are RH
7.3 RPMs:
ftp://ftp8.us.postgresql.org/pub/pgs...MS/redhat-7.3/


I'll consider this, but it greatly complicates things to require users
add the non-redhat version. I understand the benefits of doing so, but
convincing people to do this just to try out a package is not so easy.

Joe

Here is a simple echo function that is being used:

#include <pgsql/server/postgres.h>
#include <string.h>
#include <pgsql/server/fmgr.h>

PG_FUNCTION_INFO_V1(reverse_path);
Datum my_echo(PG_FUNCTION_ARGS)
{
text* arg = PG_GETARG_TEXT_P(0);
text* echo_arg = (text *)palloc(sizeof(arg));

memcpy(
(void *)(echo_arg),
(void *)(arg),
sizeof(arg)
);

PG_RETURN_TEXT_P(echo_arg);
}
Keep in mind that this isn't being run yet, it fails at link stage. As
another test, I have simplified the above just to test link time (not
intended to run, just as a test of link/compile):

#include <pgsql/server/postgres.h>
#include <pgsql/server/fmgr.h>

PG_FUNCTION_INFO_V1(reverse_path);
Datum my_echo(PG_FUNCTION_ARGS)
{
text* arg = PG_GETARG_TEXT_P(0);

PG_RETURN_TEXT_P(arg);
}
The first function complains at link time of missing link function
pg_detoast_datum, CurrentMemoryContext, and MemoryContextAlloc, while
the latter complains only of missing pg_detoast_datum.

In both cases, link libraries are:
-lkrb5 -lk5crypto -lcom_err -lpq -ldl

Now I am still scratching my head, wondering how it is that
pg_detoast_datum is a V0 function, and I can compile V0 libraries just
fine, but can't even compile a V1, which supposedly does not use
pg_detoast_data? The additional link failures when using palloc make me
feel there is some mysterious unnamed library that is missing when using
V1, aside from -lpq. When I go in to compile the src/test/regress/
directory of the source from the rpm used in Redhat 7.3, I see no signs
that anything else is required. Something simple must be missing under
the PostgreSQL 7.2 version. Is there a separate library that needs
linking under a V1 interface, in addition to those named above?

D. Stimits
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This application has been working properly on...
13
by: david | last post by:
Hi, I have some problems to link a simple hello world program using g++ (version 3.2.3 or 3.3) and dinkumware 402. //hallo world... #include <iostream> main () { std::cout << "bla" <<...
1
by: Codemutant | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** I just cannot find what is undefined in this code.
1
by: Foolster41 | last post by:
I'm rather new to C++ programing. I'm using the dev-C++ program on a windows XP OS. I'm trying to compile the code for a multi user dungeon (MUD) called circle-mud. When I compile I get the...
1
by: Dom | last post by:
I'm new to c++. Just started learning it 24 hours ago. Am running into a compile problem. Please, no one waste the effort telling me to google it. I've been researching it for quite a while with no...
3
by: Michael Sgier | last post by:
Hi i get thousands of messages like below. How shall i resolve that? Thanks Mcihael Release/src/Utility/RawImage.o: In function `CMaskImage::CMaskImage(int, int, char const*)':...
45
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to...
3
by: prakash.mirji | last post by:
Hello, I am getting below mention linker error when I tried to link my class test.C I use below command to compile test.C /usr/bin/g++ -g -fpic -fvisibility=default -D_POSIX_SOURCE...
2
by: zqiang320 | last post by:
Hello: I execute make ,then get error: $ make Making all in libsbml/src make: Entering directory `/home/internet/mydoc/test_pj/libsbml/src' ........ /bin/sh ./libtool --tag=CC --mode=link...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.