Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)

Lists: pgsql-hackerspgsql-sql
From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: UPDATE Query problem
Date: 2002-01-18 00:55:43
Message-ID: web-622592@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Folks,

I have a database that contains a chronological journal of activity. For
various reasons, this journal contains both complete and incomplete records,
and while all records are timestamped, the primary key is not strictly ordered
by timestamp.

What I want to do is update each incomplete record with the contents of the
last previous complete record. As a simple-minded test case:

CREATE TABLE history AS (
history_id SERIAL PRIMARY KEY,
period_date TIMESTAMP,
fieldA VARCHAR(30),
fieldB INT4 );

CREATE VIEW complete_history_records AS
SELECT history.*
FROM history WHERE fieldA IS NOT NULL
and fieldB IS NOT NULL

UPDATE history SET fieldA = chr.fieldA
fieldB = chr.fieldB
FROM (SELECT complete_history_records.*
WHERE ??? ) chr
WHERE (history.fieldA IS NULL or
history.fieldB IS NULL);

The problem is that I cannot figure out a subselect that will allow me to
select the last complete history record prior to the one being updated. It
seems like I need to reference a field in the main query in the subselect,
which can't be done.

To further hamper things, for portability reasons, I can use neither SELECT
DISTINCT ON nor custom functions.

I'm stumped. Please offer suggestions!

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: UPDATE Query problem
Date: 2002-01-18 01:20:00
Message-ID: 1979.1011316800@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

"Josh Berkus" <josh(at)agliodbs(dot)com> writes:
> The problem is that I cannot figure out a subselect that will allow me to
> select the last complete history record prior to the one being
> updated.

Sure you can. You can't alias history in the UPDATE, but you can alias
it in the subselect, so:

UPDATE history SET fieldA =
(SELECT fieldA FROM history older
WHERE older.key = history.key AND
older.fieldA IS NOT NULL AND older.fieldB IS NOT NULL AND
older.timestamp =
(SELECT max(timestamp) FROM history oldest
WHERE oldest.key = history.key AND
oldest.fieldA IS NOT NULL AND oldest.fieldB IS NOT NULL)),
fieldB = (SELECT fieldB FROM ... repeat entire subselect above ...)
WHERE (history.fieldA IS NULL or
history.fieldB IS NULL);

This will work and (AFAIK) is fully SQL-compliant, but it will be
slower than the dickens because of all those subselects :-(. Might
be tolerable if the key field is near-unique and is indexed, but
heaven help you if not.

> To further hamper things, for portability reasons, I can use neither SELECT
> DISTINCT ON nor custom functions.

Too bad. SELECT DISTINCT ON would let you get rid of the bottom SELECT
max() and would let you exploit an index on (key,timestamp). By the
time the query above finishes running, very likely you could talk your
boss into accepting a nonstandard solution ;-)

Also, just because PG can handle the above doesn't mean every RDBMS does
(do I need to name names?). What products do you really need it to
be portable to?

regards, tom lane


From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: UPDATE Query problem
Date: 2002-01-18 01:20:59
Message-ID: 20020117171611.H57470-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

On Thu, 17 Jan 2002, Josh Berkus wrote:

> Folks,
>
> I have a database that contains a chronological journal of activity. For
> various reasons, this journal contains both complete and incomplete records,
> and while all records are timestamped, the primary key is not strictly ordered
> by timestamp.
>
> What I want to do is update each incomplete record with the contents of the
> last previous complete record. As a simple-minded test case:
>
> CREATE TABLE history AS (
> history_id SERIAL PRIMARY KEY,
> period_date TIMESTAMP,
> fieldA VARCHAR(30),
> fieldB INT4 );
>
> CREATE VIEW complete_history_records AS
> SELECT history.*
> FROM history WHERE fieldA IS NOT NULL
> and fieldB IS NOT NULL
>
> UPDATE history SET fieldA = chr.fieldA
> fieldB = chr.fieldB
> FROM (SELECT complete_history_records.*
> WHERE ??? ) chr
> WHERE (history.fieldA IS NULL or
> history.fieldB IS NULL);
>
> The problem is that I cannot figure out a subselect that will allow me to
> select the last complete history record prior to the one being updated. It
> seems like I need to reference a field in the main query in the subselect,
> which can't be done.
>
> To further hamper things, for portability reasons, I can use neither SELECT
> DISTINCT ON nor custom functions.

Isn't update...from already an extension?

In any case, is performance really important? I think something like:
update history set fieldA=chr.fieldA, fieldB=chr.fieldB from
complete_history_records chr where (history.fieldA is null or
history.fieldB is null) and chr.period_date=(select max(period_date)
from complete_history_records where period_date<history.period_date);

might work if really slow.


From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: UPDATE Query problem
Date: 2002-01-18 03:59:27
Message-ID: web-622662@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom,

> Sure you can. You can't alias history in the UPDATE, but you can alias
> it in the subselect, so:
>
> UPDATE history SET fieldA =
> (SELECT fieldA FROM history older
> WHERE older.key = history.key AND
> older.fieldA IS NOT NULL AND older.fieldB IS NOT NULL AND
> older.timestamp =
> (SELECT max(timestamp) FROM history oldest
> WHERE oldest.key = history.key AND
> oldest.fieldA IS NOT NULL AND oldest.fieldB IS NOT NULL)),
> fieldB = (SELECT fieldB FROM ... repeat entire subselect above ...)
> WHERE (history.fieldA IS NULL or
> history.fieldB IS NULL);

Interesting. however, it appears to give me the most recent record with
non-NULL values. What I want is the most recent record with non-NULL values
*before* the record I'm trying to update. In other words, if I have the
following data:

history
id timestamp fieldA fieldB
1341 6/30/00 KCKG 1
1345 7/31/00 KC 1
1402 8/31/00 NULL NULL
2799 9/30/00 NULL NULL
1581 10/31/00 KC 2
1673 11/30/00 KC 2

I want records 1402 and 2799 to be updated from record 1345, not from record
1673.

> This will work and (AFAIK) is fully SQL-compliant, but it will be
> slower than the dickens because of all those subselects :-(. Might
> be tolerable if the key field is near-unique and is indexed, but
> heaven help you if not.

The key field is unique. And slow is OK ... the history-correction program
runs overnight. I just can't afford to take a procedural approach and correct
one record at a time ... there are 200,000 records and growing at a rate of
8,000 records per month.

> Also, just because PG can handle the above doesn't mean every RDBMS does
> (do I need to name names?). What products do you really need it to
> be portable to?

Yeah, you guessed it ... MS SQL Server 7. Which kills custom functions or
custom aggregates, something that would make this whole process a lot easier.

Thanks for the help!

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: UPDATE Query problem
Date: 2002-01-18 04:14:18
Message-ID: 3909.1011327258@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

"Josh Berkus" <josh(at)agliodbs(dot)com> writes:
> Interesting. however, it appears to give me the most recent record with
> non-NULL values. What I want is the most recent record with non-NULL values
> *before* the record I'm trying to update.

Oh, I'm sorry: forgot the extra qualification on the innermost SELECT:

AND oldest.timestamp < history.timestamp

> Yeah, you guessed it ... MS SQL Server 7.

I dunno, how good is SQL Server on subselects?

regards, tom lane


From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Josh Berkus" <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: UPDATE Query problem
Date: 2002-01-18 05:18:27
Message-ID: web-622700@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom,

> Oh, I'm sorry: forgot the extra qualification on the innermost SELECT:
>
> AND oldest.timestamp < history.timestamp

Hmmm ... I'll try both solutions tommorrow. That is, I'll see if they port
across databases ...

> > Yeah, you guessed it ... MS SQL Server 7.
>
> I dunno, how good is SQL Server on subselects?

Not very good. A lot of stuff, like subselects in the SELECT line, is not
supported. And MS has gotten further from the SQL standard with each update
since SQL Server 7.0 ...

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To:
Cc: pgsql-sql(at)postgresql(dot)org
Subject: pltlc and pltlcu problems
Date: 2002-01-18 13:37:59
Message-ID: 3C482537.9040005@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


I try this code

CREATE FUNCTION pltclu_call_handler() RETURNS OPAQUE AS
'/usr/lib/postgresql/pltcl.so' LANGUAGE 'C';

and get this error

ERROR: Load of file /usr/lib/postgresql/pltcl.so failed:
/usr/lib/postgresql/pltcl.so: undefined symbol: pg_get_enconv_by_encoding

anyone help me with this?

murray hobbs

ps here's my .configure command

./configure --enable-multibyte=UNICODE --enable-unicode-conversion --enable-locale --bindir=/usr/local/bin --libdir=/usr/lib --includedir=/usr/include --mandir=/usr/local/man --with-tcl --enable-odbc --with-unixodbc --enable-syslog


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-18 15:04:41
Message-ID: 6420.1011366281@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Murray Prior Hobbs <murray(at)efone(dot)com> writes:
> ERROR: Load of file /usr/lib/postgresql/pltcl.so failed:
> /usr/lib/postgresql/pltcl.so: undefined symbol: pg_get_enconv_by_encoding

Looks like a multibyte-enabled pltcl and a non-multibyte-enabled
backend. Given that they were clearly built at different times and
with different configurations, one might also wonder if they're even
the same Postgres version.

regards, tom lane


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-18 20:17:31
Message-ID: 3C4882DB.7090306@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


you are so right

bugga, and i thought i was being both so clever and so careful

m

Tom Lane wrote:

>Murray Prior Hobbs <murray(at)efone(dot)com> writes:
>
>>ERROR: Load of file /usr/lib/postgresql/pltcl.so failed:
>>/usr/lib/postgresql/pltcl.so: undefined symbol: pg_get_enconv_by_encoding
>>
>
>Looks like a multibyte-enabled pltcl and a non-multibyte-enabled
>backend. Given that they were clearly built at different times and
>with different configurations, one might also wonder if they're even
>the same Postgres version.
>
> regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>


From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: UPDATE Query problem
Date: 2002-01-18 23:02:23
Message-ID: web-670610@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom, Stephan,

Well, you'll be interested to know that Stephan's solution worked for both
PostgreSQL and MS SQL Server ... as far as parsing goes. On PostgreSQL, the
query took 14 minutes to complete.

On MS SQL Server, it never completed at all. Looks like I will have to take a
semi-procedural approach with MS SQL Server after all. Just another evidence
of the superiority of Postgres ...

-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-19 04:09:22
Message-ID: 3C48F172.60302@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


after i have succesfully used createlan script to load both the trusted and untrusted tlc languages i try some tests

i create a test function (right out of the docs)

CREATE FUNCTION tcl_max (int4, int4) RETURNS int4 AS '
if {$1 > $2} {return $1}
return $2
' LANGUAGE 'pltclu';

and i try to run this stest

select tcl_max(4,6);

but i get

ERROR: fmgr_info: function 17020: cache lookup failed

so i create trusted version

CREATE FUNCTION tcl_max (int4, int4) RETURNS int4 AS '
if {$1 > $2} {return $1}
return $2
' LANGUAGE 'pltcl';

and i again try to run this stest

select tcl_max(4,6);

but i get instead

server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
connection to server was lost

and if i look at the log

postgres: murray kale [local] SELECT: error while loading shared libraries: /usr/lib/postgresql/pltcl.so: undefined symbol: Tcl_CreateInterp
DEBUG: server process (pid 18415) exited with exit code 127
DEBUG: terminating any other active server processes
DEBUG: all server processes terminated; reinitializing shared memory and semaphores
DEBUG: database system was interrupted at 2002-01-19 15:01:29 EST
DEBUG: checkpoint record is at 0/4BAD10
DEBUG: redo record is at 0/4BAD10; undo record is at 0/0; shutdown TRUE
DEBUG: next transaction id: 2120; next oid: 49324
DEBUG: database system was not properly shut down; automatic recovery in progress
DEBUG: redo starts at 0/4BAD50
DEBUG: ReadRecord: record with zero length at 0/4C0FB4
DEBUG: redo done at 0/4C0F90
DEBUG: database system is ready

so what do i do now?

log it as a bug?

murray

so ok i go to the sources looking for test of pl/tlc or pl/tlcu (untrusted)

Tom Lane wrote:

>Murray Prior Hobbs <murray(at)efone(dot)com> writes:
>
>>ERROR: Load of file /usr/lib/postgresql/pltcl.so failed:
>>/usr/lib/postgresql/pltcl.so: undefined symbol: pg_get_enconv_by_encoding
>>
>
>Looks like a multibyte-enabled pltcl and a non-multibyte-enabled
>backend. Given that they were clearly built at different times and
>with different configurations, one might also wonder if they're even
>the same Postgres version.
>
> regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-19 04:12:13
Message-ID: 11962.1011413533@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Murray Prior Hobbs <murray(at)efone(dot)com> writes:
> postgres: murray kale [local] SELECT: error while loading shared libraries: /usr/lib/postgresql/pltcl.so: undefined symbol: Tcl_CreateInterp
> DEBUG: server process (pid 18415) exited with exit code 127

Kinda looks like your dynamic loader doesn't know where to find
libtcl.so (and thinks that the appropriate way to fail is a hard exit(),
which is not my idea of friendly).

> so what do i do now?

> log it as a bug?

It's not a Postgres bug; you need to twiddle your shlib configuration.
But since you didn't mention your platform, I can't offer any pointers
beyond
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/install-post.html#AEN11747
(note that this is talking about finding Postgres' libraries; alter
to suit wherever libtcl lives).

regards, tom lane


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-19 07:58:54
Message-ID: 3C49273E.8080307@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


Thanks tom but i think there's more to it

error while loading shared libraries: /usr/lib/postgresql/pltcl.so: undefined symbol: Tcl_CreateInterp

as you can see it knows where the library is - what i think it's
complaining about is the undefined symbol

so i do a grep through the sources and find the call - the only call -
but there's no function declaration in the sources

i did follow your link and i had read the page before - i'm on RedHat
7.2 so should not have needed to do that - but i did anyway - it made no
difference

is there meant to be Tcl_CreateInterp anywhere in the sources?

murray

Tom Lane wrote:

>Murray Prior Hobbs <murray(at)efone(dot)com> writes:
>
>>postgres: murray kale [local] SELECT: error while loading shared libraries: /usr/lib/postgresql/pltcl.so: undefined symbol: Tcl_CreateInterp
>>DEBUG: server process (pid 18415) exited with exit code 127
>>
>
>Kinda looks like your dynamic loader doesn't know where to find
>libtcl.so (and thinks that the appropriate way to fail is a hard exit(),
>which is not my idea of friendly).
>
>>so what do i do now?
>>
>
>>log it as a bug?
>>
>
>It's not a Postgres bug; you need to twiddle your shlib configuration.
>But since you didn't mention your platform, I can't offer any pointers
>beyond
>http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/install-post.html#AEN11747
>(note that this is talking about finding Postgres' libraries; alter
>to suit wherever libtcl lives).
>
> regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 6: Have you searched our list archives?
>
>http://archives.postgresql.org
>


From: Brent Verner <brent(at)rcfile(dot)org>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-19 08:19:17
Message-ID: 20020119031917.A83905@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-19 18:58] Murray Prior Hobbs said:
|
| Thanks tom but i think there's more to it
|
| error while loading shared libraries: /usr/lib/postgresql/pltcl.so:
| undefined symbol: Tcl_CreateInterp
|
| as you can see it knows where the library is - what i think it's
| complaining about is the undefined symbol
|
| so i do a grep through the sources and find the call - the only call -
| but there's no function declaration in the sources
|
| i did follow your link and i had read the page before - i'm on RedHat
| 7.2 so should not have needed to do that - but i did anyway - it made no
| difference
|
| is there meant to be Tcl_CreateInterp anywhere in the sources?

No. This is provided by the tcl library:

bash$ grep Tcl_CreateInter /usr/include/tcl8.3/tclDecls.h
EXTERN Tcl_Interp * Tcl_CreateInterp _ANSI_ARGS_((void));

The problem is, as Tom said, that your tcl library is not being
found by the system's linker. Try this:

bash$ ldd /usr/lib/postgresql/pltcl.so

I suspect you'll see a line containing "not found".

brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-19 08:40:32
Message-ID: 3C493100.2070905@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


i have had no trouble loading and using the pgpgsql language - and it
lives in exactly the same place

i've done as you suggested though - here is the output

[murray(at)localhost dbSources]$ ldd /usr/lib/postgresql/pltcl.so
libdl.so.2 => /lib/libdl.so.2 (0x40020000)
libm.so.6 => /lib/i686/libm.so.6 (0x40024000)
libc.so.6 => /lib/i686/libc.so.6 (0x40047000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)

murray

Brent Verner wrote:

>
>No. This is provided by the tcl library:
>
> bash$ grep Tcl_CreateInter /usr/include/tcl8.3/tclDecls.h
> EXTERN Tcl_Interp * Tcl_CreateInterp _ANSI_ARGS_((void));
>
>The problem is, as Tom said, that your tcl library is not being
>found by the system's linker. Try this:
>
> bash$ ldd /usr/lib/postgresql/pltcl.so
>
>I suspect you'll see a line containing "not found".
>
> brent
>

[2002-01-19 18:58] Murray Prior Hobbs said:
|
| Thanks tom but i think there's more to it
|
| error while loading shared libraries: /usr/lib/postgresql/pltcl.so:
| undefined symbol: Tcl_CreateInterp
|
| as you can see it knows where the library is - what i think it's
| complaining about is the undefined symbol
|
| so i do a grep through the sources and find the call - the only call -
| but there's no function declaration in the sources
|
| i did follow your link and i had read the page before - i'm on RedHat
| 7.2 so should not have needed to do that - but i did anyway - it made no
| difference
|
| is there meant to be Tcl_CreateInterp anywhere in the sources?


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-19 09:09:21
Message-ID: 3C4937C1.9090905@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


maybe this is a dumb question

but are not all the tcl sources part of the source distribution?

like - am i to assume then that there are binaries in the distribution
for which there is no code?

like - if i go looking for somethng in the code should not i find it?

murray

Brent Verner wrote:

>
>No. This is provided by the tcl library:
>
> bash$ grep Tcl_CreateInter /usr/include/tcl8.3/tclDecls.h
> EXTERN Tcl_Interp * Tcl_CreateInterp _ANSI_ARGS_((void));
>
>The problem is, as Tom said, that your tcl library is not being
>found by the system's linker. Try this:
>
> bash$ ldd /usr/lib/postgresql/pltcl.so
>
>I suspect you'll see a line containing "not found".
>
> brent
>

[2002-01-19 18:58] Murray Prior Hobbs said:
|
| Thanks tom but i think there's more to it
|
| error while loading shared libraries: /usr/lib/postgresql/pltcl.so:
| undefined symbol: Tcl_CreateInterp
|
| as you can see it knows where the library is - what i think it's
| complaining about is the undefined symbol
|
| so i do a grep through the sources and find the call - the only call -
| but there's no function declaration in the sources
|
| i did follow your link and i had read the page before - i'm on RedHat
| 7.2 so should not have needed to do that - but i did anyway - it made no
| difference
|
| is there meant to be Tcl_CreateInterp anywhere in the sources?


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: Brent Verner <brent(at)rcfile(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-19 17:36:31
Message-ID: 14131.1011461791@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Murray Prior Hobbs <murray(at)efone(dot)com> writes:
> maybe this is a dumb question
> but are not all the tcl sources part of the source distribution?

I'm only going to say this one more time: Tcl is not part of Postgres.

pltcl depends on libtcl (note difference), and the loader is evidently
not finding libtcl.so. Which will absolutely NOT be in
/usr/lib/postgresql. The question for you is where it actually lives
(if it's installed at all), and next why the dynamic loader search path
isn't finding it.

regards, tom lane


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 07:57:37
Message-ID: 3C4A7871.7050600@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


ok ok - so i went off and read a LOT about Tcl - cool what a nice tool

and then i downloaded the tcl/tk sources and built with appropriate
configure options and installed it - in approprate places (in /usr/bin -
over the old copies that were already there) and ran the tests and
dowloaded some TCl samples and played with the apps

as i had been using the postgres 7.2 beta i reinstalled 7.13 over the
top - right from the start, reconfigured, recompiled, reinstalled,
reinitialised

and tried to call a tcl function yet again - but now i get this error

ERROR: pltcl: internal error - cannot create 'normal' interpreter

but hmm, that's further than i got before and at least the database does
not restart itself in the process

and in the code i have got one step further

any clues?

murray

if ((pltcl_hold_interp = Tcl_CreateInterp()) == NULL)
{
elog(ERROR, "pltcl: internal error - cannot create 'hold' "
"interpreter");
}

/************************************************************
* Create the two interpreters
************************************************************/
if ((pltcl_norm_interp =
Tcl_CreateSlave(pltcl_hold_interp, "norm", 0)) == NULL)
{
elog(ERROR,
"*pltcl: internal error - cannot create 'normal' interpreter*");
}

murray

Tom Lane wrote:

>Murray Prior Hobbs <murray(at)efone(dot)com> writes:
>
>>maybe this is a dumb question
>>but are not all the tcl sources part of the source distribution?
>>
>
>I'm only going to say this one more time: Tcl is not part of Postgres.
>
>pltcl depends on libtcl (note difference), and the loader is evidently
>not finding libtcl.so. Which will absolutely NOT be in
>/usr/lib/postgresql. The question for you is where it actually lives
>(if it's installed at all), and next why the dynamic loader search path
>isn't finding it.
>
> regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>


From: Brent Verner <brent(at)rcfile(dot)org>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 11:59:29
Message-ID: 20020120065929.A9940@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-19 19:40] Murray Prior Hobbs said:
|
| i have had no trouble loading and using the pgpgsql language - and it
| lives in exactly the same place
|
| i've done as you suggested though - here is the output

Indeed. I just got finished installing a chroot image of
redhat-7.2 to test this. I am seeing the same Tcl_CreateInterp
problem you mentioned earlier. The pltcl language does not work
even from the 7.2b3 rpms. Can someone verify that pltcl works on
their stock redhat 7.2 system?

Are there a known bugs in the stock 7.2 binutils or any other part
of the toolchain that might be causing this problem? Most notably
is the absence of pltcl.so being linked to libtcl.so. Could this
be a problem with redhat's tcl package?

Monty, are you by chance running in a chroot?

confounded,
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Brent Verner <brent(at)rcfile(dot)org>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 12:36:37
Message-ID: 20020120073637.A10068@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-20 23:24] Murray Prior Hobbs said:
| Brent Verner wrote:
|
| >[2002-01-19 19:40] Murray Prior Hobbs said:
| >|
| >| i have had no trouble loading and using the pgpgsql language - and it
| >| lives in exactly the same place
| >|
| >| i've done as you suggested though - here is the output
| >
| >Indeed. I just got finished installing a chroot image of
| >redhat-7.2 to test this. I am seeing the same Tcl_CreateInterp
| >problem you mentioned earlier. The pltcl language does not work
| >even from the 7.2b3 rpms. Can someone verify that pltcl works on
| >their stock redhat 7.2 system?
| >
| >Are there a known bugs in the stock 7.2 binutils or any other part
| >of the toolchain that might be causing this problem? Most notably
| >is the absence of pltcl.so being linked to libtcl.so. Could this
| >be a problem with redhat's tcl package?
| >
| >Monty, are you by chance running in a chroot?
| >
| if you mean me (Murray) nope - it's a bog standard RedHat 7.2 install

sorry! I know a guy named "Monty Hobbs"... I'm really too tired ;-)

| but i have installed Tcl from the sources from scratch - 8.3.4

Indeed I've tracked the problem down to the line that links
the pltcl.so library:

make[3]: Entering directory `/usr/local/cvs/pgsql/src/pl/tcl'
/bin/sh mkMakefile.tcldefs.sh '/usr/lib/tclConfig.sh' 'Makefile.tcldefs'
make[3]: Leaving directory `/usr/local/cvs/pgsql/src/pl/tcl'
make[3]: Entering directory `/usr/local/cvs/pgsql/src/pl/tcl'
gcc -pipe -O -D__NO_STRING_INLINES -D__NO_MATH_INLINES -fPIC -I../../../src/include -DHAVE_UNISTD_H=1 -DHAVE_LIMITS_H=1 -DHAVE_GETCWD=1 -DHAVE_OPENDIR=1 -DHAVE_STRSTR=1 -DHAVE_STRTOL=1 -DHAVE_TMPNAM=1 -DHAVE_WAITPID=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_TERMIOS=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_TM_ZONE=1 -DHAVE_TM_GMTOFF=1 -DHAVE_TIMEZONE_VAR=1 -DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DNEED_MATHERR=1 -DHAVE_SIGNED_CHAR=1 -DHAVE_SYS_IOCTL_H=1 -c -o pltcl.o pltcl.c
gcc -pipe -shared -Wl,-soname,libtcl.so.0 -o pltcl.so pltcl.o -L/usr/lib -ltcl -ldl -lieee -lm -lc
^^^^^^^^^^^

IIRC, this was changed to workaround another problem with the
tcl client library having name conflicts. This value (TCL_SHLIB_LD)
comes directly from the /usr/lib/tclConfig.sh file supplied by the
rpm. You can add the following line to src/pl/tcl/Makefile
below "-include Makefile.tcldefs"

TCL_SHLIB_LD = gcc -shared

to override the erronious value supplied by the system's tclConfig.sh.

| but just because i'm ignorant of many things - how would i check if i
| was running in chroot environment?

not sure. I always know when I am, because I setup the chroot.
Some web hosts will give you a chroot as well, but if you are
developing on your own workstation, there is little chance of
you being in a chroot and not knowing it.

hth.
b

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 17:35:35
Message-ID: 4417.1011548135@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Brent Verner <brent(at)rcfile(dot)org> writes:
> I am seeing the same Tcl_CreateInterp
> problem you mentioned earlier. The pltcl language does not work
> even from the 7.2b3 rpms. Can someone verify that pltcl works on
> their stock redhat 7.2 system?

Hmm, what Tcl version are you using? pltcl does not appear broken
on my system, but I think what I've got installed is Tcl 8.0.5.

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-20 18:40:17
Message-ID: 4640.1011552017@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Brent Verner <brent(at)rcfile(dot)org> writes:
> Can someone verify that pltcl works on
> their stock redhat 7.2 system?

Indeed it does not. On a straight-from-the-CD RH 7.2 install and
CVS-tip Postgres, I see both of the behaviors Murray complained of.

What I think is particularly nasty is that we get an exit(127) when
the symbol resolution fails, leading to database restart. This will
probably happen on *most* systems not only Linux, because we are
specifying RTLD_LAZY in our dlopen() calls, meaning that missing
symbols should be flagged when they are referenced at runtime --- and
if we call a function that should be there and isn't, there's not much
the dynamic loader can do except throw a signal or exit().

What we should be doing is specifying RTLD_NOW to dlopen(), so that
any unresolved symbol failure occurs during dlopen(), when we are
prepared to deal with it in a clean fashion.

I ran into this same behavior years ago on HPUX and fixed it by using
what they call BIND_IMMEDIATE mode; but I now see that most of the
other ports are specifying RTLD_LAZY, and thus have this problem.

Unless I hear a credible counter-argument, I am going to change
RTLD_LAZY to RTLD_NOW in src/backend/port/dynloader/linux.h. I have
tested that and it produces a clean error with no backend crash.

What I would *like* to do is make the same change in all the
port/dynloader files that reference RTLD_LAZY:
src/backend/port/dynloader/aix.h
src/backend/port/dynloader/bsdi.h
src/backend/port/dynloader/dgux.h
src/backend/port/dynloader/freebsd.h
src/backend/port/dynloader/irix5.h
src/backend/port/dynloader/linux.h
src/backend/port/dynloader/netbsd.h
src/backend/port/dynloader/openbsd.h
src/backend/port/dynloader/osf.h
src/backend/port/dynloader/sco.h
src/backend/port/dynloader/solaris.h
src/backend/port/dynloader/svr4.h
src/backend/port/dynloader/univel.h
src/backend/port/dynloader/unixware.h
src/backend/port/dynloader/win.h
However I'm a bit scared to do that at this late stage of the release
cycle, because perhaps some of these platforms don't support the full
dlopen() API. Comments? Can anyone test whether RTLD_NOW works on
any of the above-mentioned ports?

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-20 19:10:53
Message-ID: 200201201910.g0KJArH15682@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

> However I'm a bit scared to do that at this late stage of the release
> cycle, because perhaps some of these platforms don't support the full
> dlopen() API. Comments? Can anyone test whether RTLD_NOW works on
> any of the above-mentioned ports?

I can confirm that RTLD_NOW exists on BSD/OS. Can we do:

#ifdef RTLD_NOW
use RTLD_NOW
#else
whatever_is_there_now
#endif

in those ports at least for 7.2 so we can be sure we don't get failures.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 19:14:16
Message-ID: 4791.1011554056@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Brent Verner <brent(at)rcfile(dot)org> writes:
> Indeed I've tracked the problem down to the line that links
> the pltcl.so library:

> gcc -pipe -shared -Wl,-soname,libtcl.so.0 -o pltcl.so pltcl.o -L/usr/lib -ltcl -ldl -lieee -lm -lc
> ^^^^^^^^^^^

Yeah, removing the "-Wl,-soname,libtcl.so.0" switch produces a correctly
functioning pltcl.

> IIRC, this was changed to workaround another problem with the
> tcl client library having name conflicts. This value (TCL_SHLIB_LD)
> comes directly from the /usr/lib/tclConfig.sh file supplied by the
> rpm.

I seem to recall that this same problem was being debated a few weeks
back, but apparently we didn't actually do anything about it. Looks
like we have to.

Peter, didn't you have a proposal on the table to fix this?

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 20:58:14
Message-ID: 5263.1011560294@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Murray Prior Hobbs <murray(at)efone(dot)com> writes:
> Brent sent me a fix

> ----start Bent's fix ----

> rpm. You can add the following line to src/pl/tcl/Makefile
> below "-include Makefile.tcldefs"

> TCL_SHLIB_LD = gcc -shared

> ---- end Brent's fix -----

> which i tried but did not work

Works for me. Did you remove the pltcl.so file so it would be rebuilt?

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-01-20 21:11:01
Message-ID: Pine.LNX.4.30.0201201604510.712-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane writes:

> Unless I hear a credible counter-argument, I am going to change
> RTLD_LAZY to RTLD_NOW in src/backend/port/dynloader/linux.h. I have
> tested that and it produces a clean error with no backend crash.
>
> What I would *like* to do is make the same change in all the
> port/dynloader files that reference RTLD_LAZY:

RTLD_LAZY allows you to load shared library modules that contain circular
references. I don't know if that's useful or just stupid, but on some
systems the shared library models are pretty, um, different so that the
need for this might arise from time to time.

> However I'm a bit scared to do that at this late stage of the release
> cycle, because perhaps some of these platforms don't support the full
> dlopen() API. Comments? Can anyone test whether RTLD_NOW works on
> any of the above-mentioned ports?

I really don't think this is a good change to make now, as we don't know
how well all of this is supported, and the failure scenario is annoying
but not really that harmful.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 21:12:45
Message-ID: Pine.LNX.4.30.0201201611190.712-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane writes:

> Peter, didn't you have a proposal on the table to fix this?

Yeah, complain loudly to whoever dared to package a broken Tcl like
that... Or we'll work with Andreas Zeugwetter's patches and eliminate the
use of tclConfig.sh mostly.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 21:33:30
Message-ID: 5516.1011562410@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> Peter, didn't you have a proposal on the table to fix this?

> Yeah, complain loudly to whoever dared to package a broken Tcl like
> that... Or we'll work with Andreas Zeugwetter's patches and eliminate the
> use of tclConfig.sh mostly.

Yeah, I was taking a second look at Andreas' patch myself. At the time,
the report was that we were only seeing a failure in RPM-packaged
Postgres and so I thought that the root problem was somewhere in our RPM
script. However, I have now tried it for myself and can confirm that
we fail in a Postgres source build too. The bogus soname switch might
be blamable on the Tcl RPM package and not on Tcl sources, but that
doesn't make a lot of difference to us either way.

I'm still quite nervous about making these changes so late in the cycle.
OTOH I suspect Andreas was right: we haven't been getting any pltcl
portability testing from our beta testers. If it's broken now, we
can hardly make it worse.

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-20 21:43:45
Message-ID: 5611.1011563025@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Tom Lane writes:
>> Unless I hear a credible counter-argument, I am going to change
>> RTLD_LAZY to RTLD_NOW in src/backend/port/dynloader/linux.h. I have
>> tested that and it produces a clean error with no backend crash.

> RTLD_LAZY allows you to load shared library modules that contain circular
> references.

Does that not work with RTLD_NOW? I should think it would. In any
case, I'm doubtful that we care.

> I really don't think this is a good change to make now, as we don't know
> how well all of this is supported, and the failure scenario is annoying
> but not really that harmful.

A database restart is always very bad news in my mind. You might be
right that it's too risky to make such a change now for 7.2, but I still
absolutely want to do it for 7.3.

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 22:17:57
Message-ID: Pine.LNX.4.30.0201201709400.712-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane writes:

> I'm still quite nervous about making these changes so late in the cycle.
> OTOH I suspect Andreas was right: we haven't been getting any pltcl
> portability testing from our beta testers.

This logic can also be reversed: We haven't been getting any beta testing
from users of Red Hat 7.1.

> If it's broken now, we can hardly make it worse.

You can surely make things a lot worse for those that are using other
operating systems. I certainly don't agree with making changes just
because Red Hat blew it.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-20 22:52:07
Message-ID: 6532.1011567127@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> You can surely make things a lot worse for those that are using other
> operating systems. I certainly don't agree with making changes just
> because Red Hat blew it.

It does appear that the problem can be blamed entirely on the RPM
packaging of Tcl. I tried configuring from source on RHL 7.2, and
neither tcl 8.3.2 nor 8.3.4 produce a "soname" switch in TCL_SHLIB_LD.
In fact, grep can't find any occurrence of "soname" anywhere in the
Tcl source distribution.

Nonetheless, I'm not sure that "do nothing" is an acceptable response
on our part.

I tried setting up pltcl's makefile to dike out the offending switch:

override TCL_SHLIB_LD := $(patsubst %soname%, , $(TCL_SHLIB_LD))

but could not get it to work --- gmake's pattern matching logic seems
to be too brain-dead to cope with more than one % in a pattern. And

override TCL_SHLIB_LD := $(patsubst -Wl,-soname%, , $(TCL_SHLIB_LD))

doesn't work either; apparently there's no way to escape the comma.
Anyone know a cute hack to get gmake to do this?

regards, tom lane


From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 00:02:57
Message-ID: 20020120190256.A12325@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-20 17:52] Tom Lane said:
| Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
| > You can surely make things a lot worse for those that are using other
| > operating systems. I certainly don't agree with making changes just
| > because Red Hat blew it.
|
| It does appear that the problem can be blamed entirely on the RPM
| packaging of Tcl. I tried configuring from source on RHL 7.2, and
| neither tcl 8.3.2 nor 8.3.4 produce a "soname" switch in TCL_SHLIB_LD.
| In fact, grep can't find any occurrence of "soname" anywhere in the
| Tcl source distribution.
|
| Nonetheless, I'm not sure that "do nothing" is an acceptable response
| on our part.

Agreed. I think working around this borkenness in the Makefile is
the best solution; I don't think switching from RTLD_LAZY is good
right now.

| I tried setting up pltcl's makefile to dike out the offending switch:
|
| override TCL_SHLIB_LD := $(patsubst %soname%, , $(TCL_SHLIB_LD))
|
| but could not get it to work --- gmake's pattern matching logic seems
| to be too brain-dead to cope with more than one % in a pattern. And
|
| override TCL_SHLIB_LD := $(patsubst -Wl,-soname%, , $(TCL_SHLIB_LD))
|
| doesn't work either; apparently there's no way to escape the comma.
| Anyone know a cute hack to get gmake to do this?

It seems that substvar operates on each " " separated token in the
string. The following works for me.

override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname.*//')

cheers.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 00:16:50
Message-ID: 7032.1011572210@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Brent Verner <brent(at)rcfile(dot)org> writes:
> It seems that substvar operates on each " " separated token in the
> string. The following works for me.

> override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname.*//')

I suspect that the above works only because -Wl,-soname is the last
switch in TCL_SHLIB_LD; any following switches would be removed too.
Perhaps better

override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname[^ ]*//'

regards, tom lane


From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 00:31:21
Message-ID: 20020120193121.A12590@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-20 19:16] Tom Lane said:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| > It seems that substvar operates on each " " separated token in the
| > string. The following works for me.
|
| > override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname.*//')
|
| I suspect that the above works only because -Wl,-soname is the last
| switch in TCL_SHLIB_LD; any following switches would be removed too.
| Perhaps better
|
| override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname[^ ]*//'

Yes, much better.

cheers.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Brent Verner <brent(at)rcfile(dot)org>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 03:03:54
Message-ID: 2712.1011582234@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Murray Prior Hobbs <murray(at)efone(dot)com> writes:
> tell me oh mighty guru's
> what linux distribution could i use to make me a happy happy man

Just apply this patch and RHL should work.

*** src/pl/tcl/Makefile.orig Sat Oct 13 00:23:50 2001
--- src/pl/tcl/Makefile Sun Jan 20 21:57:45 2002
***************
*** 49,54 ****
--- 49,58 ----
endif
endif

+ # Suppress bogus soname switch that RedHat RPMs put into tclConfig.sh
+ override TCL_SHLIB_LD := $(shell echo "$(TCL_SHLIB_LD)" | sed 's/-Wl,-soname[^ ]*//')
+
+
%$(TCL_SHLIB_SUFFIX): %.o
$(TCL_SHLIB_LD) -o $@ $< $(TCL_LIB_SPEC) $(SHLIB_EXTRA_LIBS)

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Murray Prior Hobbs <murray(at)efone(dot)com>, Brent Verner <brent(at)rcfile(dot)org>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 03:27:21
Message-ID: Pine.LNX.4.30.0201202226110.712-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane writes:

> Just apply this patch and RHL should work.

I'm OK with this patch. (Although you don't need the override.)

We should file a bug report with Red Hat, methinks.

> *** src/pl/tcl/Makefile.orig Sat Oct 13 00:23:50 2001
> --- src/pl/tcl/Makefile Sun Jan 20 21:57:45 2002
> ***************
> *** 49,54 ****
> --- 49,58 ----
> endif
> endif
>
> + # Suppress bogus soname switch that RedHat RPMs put into tclConfig.sh
> + override TCL_SHLIB_LD := $(shell echo "$(TCL_SHLIB_LD)" | sed 's/-Wl,-soname[^ ]*//')
> +
> +
> %$(TCL_SHLIB_SUFFIX): %.o
> $(TCL_SHLIB_LD) -o $@ $< $(TCL_LIB_SPEC) $(SHLIB_EXTRA_LIBS)

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Murray Prior Hobbs <murray(at)efone(dot)com>, Brent Verner <brent(at)rcfile(dot)org>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org, teg(at)redhat(dot)com (Trond Eivind Glomsrd)
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 03:29:58
Message-ID: 2946.1011583798@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> I'm OK with this patch. (Although you don't need the override.)

Okay, committed. (I left in the override; it can't hurt can it?)

> We should file a bug report with Red Hat, methinks.

Trond, I think this is your turf ... is it a bug?

regards, tom lane

>> *** src/pl/tcl/Makefile.orig Sat Oct 13 00:23:50 2001
>> --- src/pl/tcl/Makefile Sun Jan 20 21:57:45 2002
>> ***************
>> *** 49,54 ****
>> --- 49,58 ----
>> endif
>> endif
>>
>> + # Suppress bogus soname switch that RedHat RPMs put into tclConfig.sh
>> + override TCL_SHLIB_LD := $(shell echo "$(TCL_SHLIB_LD)" | sed 's/-Wl,-soname[^ ]*//')
>> +
>> +
>> %$(TCL_SHLIB_SUFFIX): %.o
>> $(TCL_SHLIB_LD) -o $@ $< $(TCL_LIB_SPEC) $(SHLIB_EXTRA_LIBS)

> --
> Peter Eisentraut peter_e(at)gmx(dot)net


From: David Terrell <dbt(at)meat(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-21 08:12:47
Message-ID: 20020121001246.B24558@pianosa.catch22.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

On Sun, Jan 20, 2002 at 01:40:17PM -0500, Tom Lane wrote:
> What I would *like* to do is make the same change in all the
> port/dynloader files that reference RTLD_LAZY:
> src/backend/port/dynloader/openbsd.h

I can't speak for other platforms but openbsd only has RTLD_LAZY.

--
David Terrell | "... a grandiose, wasteful drug war that will never
dbt(at)meat(dot)net | be won as long as so many Americans need to
Nebcorp Prime Minister | anesthetize themselves to get through the day."
http://wwn.nebcorp.com/ | -Camille Paglia


From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "David Terrell" <dbt(at)meat(dot)net>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Brent Verner" <brent(at)rcfile(dot)org>, "Murray Prior Hobbs" <murray(at)efone(dot)com>, "Lamar Owen" <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-21 08:21:26
Message-ID: GNELIHDDFBOCMGBFGEFOGEBPCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

> On Sun, Jan 20, 2002 at 01:40:17PM -0500, Tom Lane wrote:
> > What I would *like* to do is make the same change in all the
> > port/dynloader files that reference RTLD_LAZY:
> > src/backend/port/dynloader/openbsd.h
>
> I can't speak for other platforms but openbsd only has RTLD_LAZY.

FreeBSD supports both:

RTLD_LAZY Each external function reference is resolved when the func-
tion is first called.

RTLD_NOW All external function references are bound immediately by
dlopen().

RTLD_LAZY is normally preferred, for reasons of efficiency. However,
RTLD_NOW is useful to ensure that any undefined symbols are discovered

Chris


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: David Terrell <dbt(at)meat(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-21 13:09:36
Message-ID: 200201211309.g0LD9a421146@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Christopher Kings-Lynne wrote:
> > On Sun, Jan 20, 2002 at 01:40:17PM -0500, Tom Lane wrote:
> > > What I would *like* to do is make the same change in all the
> > > port/dynloader files that reference RTLD_LAZY:
> > > src/backend/port/dynloader/openbsd.h
> >
> > I can't speak for other platforms but openbsd only has RTLD_LAZY.
>
> FreeBSD supports both:
>
> RTLD_LAZY Each external function reference is resolved when the func-
> tion is first called.
>
> RTLD_NOW All external function references are bound immediately by
> dlopen().
>
> RTLD_LAZY is normally preferred, for reasons of efficiency. However,
> RTLD_NOW is useful to ensure that any undefined symbols are discovered
>

Interesting LAZY has better efficiency. Seems we should just keep LAZY
as our default for future releases and tell people if they link to bad
object files, they should expect trouble.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, David Terrell <dbt(at)meat(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-01-21 16:50:26
Message-ID: Pine.LNX.4.30.0201211148030.687-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Bruce Momjian writes:

> Interesting LAZY has better efficiency. Seems we should just keep LAZY
> as our default for future releases and tell people if they link to bad
> object files, they should expect trouble.

In practice, we load object files only if we call the function, so symbol
resolution happens either way briefly after loading. RTLD_NOW includes
some overhead because it checks symbols that we might not end up needing,
but for the typical PostgreSQL extension module, that should really not
matter.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, David Terrell <dbt(at)meat(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-21 16:54:44
Message-ID: 200201211654.g0LGsiZ16622@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut wrote:
> Bruce Momjian writes:
>
> > Interesting LAZY has better efficiency. Seems we should just keep LAZY
> > as our default for future releases and tell people if they link to bad
> > object files, they should expect trouble.
>
> In practice, we load object files only if we call the function, so symbol
> resolution happens either way briefly after loading. RTLD_NOW includes
> some overhead because it checks symbols that we might not end up needing,
> but for the typical PostgreSQL extension module, that should really not
> matter.

OK, I was just throwing out the point in case it was significant.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, David Terrell <dbt(at)meat(dot)net>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-21 17:03:24
Message-ID: 9784.1011632604@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Interesting LAZY has better efficiency.

"Efficiency" by what measure? I would think that batch resolution of
symbols would be faster than taking a trap for each one.

> Seems we should just keep LAZY
> as our default for future releases and tell people if they link to bad
> object files, they should expect trouble.

(a) How are they going to find out if the object files are bad, other
than by crashing their database? I *really* don't like the attitude
that a backend crash is okay. Under any circumstances, development
or not.

(b) Badness may depend on context, eg LD_LIBRARY_PATH. So it's not
really safe to assume that if it worked before then you don't have to
worry about it crashing you in production.

regards, tom lane


From: teg(at)redhat(dot)com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=)
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 17:28:27
Message-ID: xuyzo378vgk.fsf@halden.devel.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:

> Tom Lane writes:
>
> > I'm still quite nervous about making these changes so late in the cycle.
> > OTOH I suspect Andreas was right: we haven't been getting any pltcl
> > portability testing from our beta testers.
>
> This logic can also be reversed: We haven't been getting any beta testing
> from users of Red Hat 7.1.

I don't think the tcl there had a proper so-name (from memory, I don't
use tcl)

--
Trond Eivind Glomsrød
Red Hat, Inc.


From: teg(at)redhat(dot)com (Trond Eivind =?iso-8859-1?q?Glomsr=F8d?=)
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Murray Prior Hobbs <murray(at)efone(dot)com>, Brent Verner <brent(at)rcfile(dot)org>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org, havill(at)redhat(dot)com
Subject: Re: pltlc and pltlcu problems
Date: 2002-01-21 17:36:59
Message-ID: xuyr8oj8v2c.fsf@halden.devel.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > I'm OK with this patch. (Although you don't need the override.)
>
> Okay, committed. (I left in the override; it can't hurt can it?)
>
> > We should file a bug report with Red Hat, methinks.
>
> Trond, I think this is your turf ... is it a bug?

(Note, I don't do tcl.)

At least part of it is intentional - adding the so name to the tcl
library. That said, it looks like a bug to me too... at the minimum,
the soname should be removed from the tclConfig.sh script after use in
generating the tcl libraries. Adrian?

--
Trond Eivind Glomsrød
Red Hat, Inc.


From: Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu problems)
Date: 2002-01-21 19:04:50
Message-ID: 20020121190450.G4048@quartz.newn.cam.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

On Sun, Jan 20, 2002 at 01:40:17PM -0500, Tom Lane wrote:
> cycle, because perhaps some of these platforms don't support the full
> dlopen() API. Comments? Can anyone test whether RTLD_NOW works on
> any of the above-mentioned ports?

Didn't check it *works*, but from $NetBSD: dlfcn.h,v 1.13 2000/06/13 01:21:53

/* Values for dlopen `mode'. */
#define RTLD_LAZY 1
#define RTLD_NOW 2
#define RTLD_GLOBAL 0x100 /* Allow global searches in object */
#define RTLD_LOCAL 0x200
#if !defined(_XOPEN_SOURCE)
#define DL_LAZY RTLD_LAZY /* Compat */
#endif

Cheers,

Patrick


From: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 09:11:16
Message-ID: 20020123111115.A7382@piglet.ipnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

On Sun, Jan 20, 2002 at 07:16:50PM -0500, Tom Lane wrote:
> Brent Verner <brent(at)rcfile(dot)org> writes:
> > It seems that substvar operates on each " " separated token in the
> > string. The following works for me.
>
> > override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname.*//')
>
> I suspect that the above works only because -Wl,-soname is the last
> switch in TCL_SHLIB_LD; any following switches would be removed too.
> Perhaps better
>
> override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname[^ ]*//'

Sorry, but by this you broke freebsd build which has:

TCL_SHLIB_LD = ld -shared -x -soname $@

and $@ gets substituted too early

can you restrict this hack by putting something like

ifeq ($(PORTNAME), linux)
override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname[^ ]*//'
endif

instead?


From: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Red Hat 7.2 Regression failures (Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems))
Date: 2002-01-23 12:49:36
Message-ID: 200201231249.HAA17010@www.wgcr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[I trimmed the CC list. It was getting out of hand. Boy, how I despise having
to use reply-all.... :-)]

On Wednesday 23 January 2002 04:44 am, Murray Prior Hobbs wrote:
> and ran the check (make check) - 79 tests passed

> then i ran the make installcheck

> and get precisely the same failures as i got on my 686 over the last 3 days

> could somebody else confirm these findings please or suggest what's going
> on

This probably has nothing to do with the TCL issue. It is the locale setting
biting you. The first regression run using make check is using the C locale
-- which passes all tests. The second run isn't using the C locale,
apparently. And those tests fail when the locale is not 'C'.
--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Murray Prior Hobbs <murray(at)efone(dot)com>
Cc: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Brent Verner <brent(at)rcfile(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org, programmers(at)efone(dot)com
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 14:56:45
Message-ID: 2455.1011797805@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Murray Prior Hobbs <murray(at)efone(dot)com> writes:
> i made and installed

> and ran the check (make check) - 79 tests passed

> then i ran the make installcheck

> and get precisely the same failures as i got on my 686 over the last 3 days

PATH pointing at the wrong thing, or other conflicting environment
variables (eg PGPORT), I'd guess.

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 16:08:36
Message-ID: 2852.1011802116@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua> writes:
>> Perhaps better
>>
>> override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname[^ ]*//'

> Sorry, but by this you broke freebsd build which has:

> TCL_SHLIB_LD = ld -shared -x -soname $@

> and $@ gets substituted too early

How annoying. I was debating whether to use single or double quotes
around the echo parameter --- looks like I made the wrong choice.
Will fix.

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and
Date: 2002-01-23 16:48:40
Message-ID: Pine.LNX.4.30.0201231129220.686-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Vsevolod Lobko writes:

> > override TCL_SHLIB_LD := $(shell echo $(TCL_SHLIB_LD) | sed 's/-Wl,-soname[^ ]*//'
>
> Sorry, but by this you broke freebsd build which has:
>
> TCL_SHLIB_LD = ld -shared -x -soname $@
>
> and $@ gets substituted too early

I've submitted a bug report to FreeBSD about this. Let's hope they fix it
soon.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 16:54:09
Message-ID: 3257.1011804849@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> I've submitted a bug report to FreeBSD about this. Let's hope they fix it
> soon.

Will it not work to do

$(shell echo '$(TCL_SHLIB_LD)' | sed ...

?

regards, tom lane


From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 17:01:50
Message-ID: 20020123120150.A8035@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-23 11:54] Tom Lane said:
| Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
| > I've submitted a bug report to FreeBSD about this. Let's hope they fix it
| > soon.
|
| Will it not work to do
|
| $(shell echo '$(TCL_SHLIB_LD)' | sed ...

No. I just tested this, and the $@ still got expanded too early.
We'll need to use the suggested ifeq($(PORTNAME),linux) test.

brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 17:06:25
Message-ID: 3380.1011805585@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Brent Verner <brent(at)rcfile(dot)org> writes:
> | Will it not work to do
> |
> | $(shell echo '$(TCL_SHLIB_LD)' | sed ...

> No. I just tested this, and the $@ still got expanded too early.

[ scratches head ... ] Where is the expansion happening, then? Seems
weird.

> We'll need to use the suggested ifeq($(PORTNAME),linux) test.

I don't much like that since it makes an inappropriate assumption,
viz that if you're on Linux you must have a TCL_SHLIB_LD value that
hasn't got any $variables in it. I'd prefer to figure out *why* we
are getting a premature evaluation.

regards, tom lane


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu
Date: 2002-01-23 17:19:49
Message-ID: 200201231719.g0NHJnf20674@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane wrote:
> Brent Verner <brent(at)rcfile(dot)org> writes:
> > | Will it not work to do
> > |
> > | $(shell echo '$(TCL_SHLIB_LD)' | sed ...
>
> > No. I just tested this, and the $@ still got expanded too early.
>
> [ scratches head ... ] Where is the expansion happening, then? Seems
> weird.
>
> > We'll need to use the suggested ifeq($(PORTNAME),linux) test.
>
> I don't much like that since it makes an inappropriate assumption,
> viz that if you're on Linux you must have a TCL_SHLIB_LD value that
> hasn't got any $variables in it. I'd prefer to figure out *why* we
> are getting a premature evaluation.

As a data point, now that FreeBSD is showing problems too, I see this on
BSD/OS with TCL 8.3 in tclConfig.sh:

TCL_SHLIB_LD='cc -shared'

Does this mean I don't have the problem here?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026


From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 17:29:50
Message-ID: 20020123122950.A14509@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-23 12:06] Tom Lane said:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| > | Will it not work to do
| > |
| > | $(shell echo '$(TCL_SHLIB_LD)' | sed ...
|
| > No. I just tested this, and the $@ still got expanded too early.
|
| [ scratches head ... ] Where is the expansion happening, then? Seems
| weird.

apparently the $(shell ...) construct expands any shell-like
vars.

from make's info file:

The `shell' function performs the same function that backquotes
(``') perform in most shells: it does "command expansion".

| > We'll need to use the suggested ifeq($(PORTNAME),linux) test.
|
| I don't much like that since it makes an inappropriate assumption,
| viz that if you're on Linux you must have a TCL_SHLIB_LD value that
| hasn't got any $variables in it. I'd prefer to figure out *why* we
| are getting a premature evaluation.

maybe check for a '$' in the TCL_SHLIB_LD ? I've been trying
$(findstring ...) but have not gotten that to work right yet.

brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and
Date: 2002-01-23 17:59:00
Message-ID: Pine.LNX.4.30.0201231257100.686-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane writes:

> [ scratches head ... ] Where is the expansion happening, then? Seems
> weird.

The $@ is expanded as a make variable. Make does care whether you're
executing a $(shell) thing around it. However, it seems that $@ should
expand to nothing in that assignment, so where's the problem?

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 17:59:16
Message-ID: 20020123125916.A16692@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-01-23 12:29] Brent Verner said:
| [2002-01-23 12:06] Tom Lane said:
| | Brent Verner <brent(at)rcfile(dot)org> writes:
| | > | Will it not work to do
| | > |
| | > | $(shell echo '$(TCL_SHLIB_LD)' | sed ...
| |
| | > No. I just tested this, and the $@ still got expanded too early.
| |
| | [ scratches head ... ] Where is the expansion happening, then? Seems
| | weird.
|
| apparently the $(shell ...) construct expands any shell-like
| vars.
|
| from make's info file:
|
| The `shell' function performs the same function that backquotes
| (``') perform in most shells: it does "command expansion".
|
| | > We'll need to use the suggested ifeq($(PORTNAME),linux) test.
| |
| | I don't much like that since it makes an inappropriate assumption,
| | viz that if you're on Linux you must have a TCL_SHLIB_LD value that
| | hasn't got any $variables in it. I'd prefer to figure out *why* we
| | are getting a premature evaluation.
|
| maybe check for a '$' in the TCL_SHLIB_LD ? I've been trying
| $(findstring ...) but have not gotten that to work right yet.

The best I can come up with is checking for the offending string
'libtcl.so.0' in the TCL_SHLIB_LD.

ifneq (,$(findstring libtcl.so.0,$(TCL_SHLIB_LD)))
TCL_SHLIB_LD := $(shell echo '$(TCL_SHLIB_LD)' | sed 's/-Wl,-soname[^ ]*//')
endif

any better ideas out there? I've exhausted my PG time for today ;-)

brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Bernhard Herzog <bh(at)intevation(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 18:02:14
Message-ID: 6qk7u90wux.fsf@abnoba.intevation.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Brent Verner <brent(at)rcfile(dot)org> writes:
> > | Will it not work to do
> > |
> > | $(shell echo '$(TCL_SHLIB_LD)' | sed ...
>
> > No. I just tested this, and the $@ still got expanded too early.
>
> [ scratches head ... ] Where is the expansion happening, then? Seems
> weird.

The expansion is done by make. It does expand variables recursively,
even for :=. Using $$@ instead of $@ should help in this particular
case, I think.

Bernhard

--
Intevation GmbH http://intevation.de/
Sketch http://sketch.sourceforge.net/
MapIt! http://mapit.de/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 18:05:27
Message-ID: 3759.1011809127@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Tom Lane writes:
>> [ scratches head ... ] Where is the expansion happening, then? Seems
>> weird.

> The $@ is expanded as a make variable. Make does care whether you're
> executing a $(shell) thing around it. However, it seems that $@ should
> expand to nothing in that assignment, so where's the problem?

I think the complaint is that we need it to still look like $@ when
TCL_SHLIB_LD is used in the shlib-building rule. If Make recursively
expands the variable before executing the $shell construct then we
got trouble.

Ugly as it is, the check on portname may be the best solution available.
I'm gonna think a little more, but I haven't got a better idea now.

regards, tom lane


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bernhard Herzog <bh(at)intevation(dot)de>
Cc: Brent Verner <brent(at)rcfile(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 18:07:51
Message-ID: 3787.1011809271@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Bernhard Herzog <bh(at)intevation(dot)de> writes:
> Using $$@ instead of $@ should help in this particular
> case, I think.

But we haven't got control of what the initial value of TCL_SHLIB_LD is.

Hmm. Wait a minute; we're going about this all wrong. Instead of
hacking the Makefile, let's hack mkMakefile.tcldefs.sh. We can
definitely fix the TCL_SHLIB_LD value there, before Make sees it.

regards, tom lane


From: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems)
Date: 2002-01-23 19:34:31
Message-ID: 20020123213431.A10741@piglet.ipnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

On Wed, Jan 23, 2002 at 12:59:00PM -0500, Peter Eisentraut wrote:
> Tom Lane writes:
>
> > [ scratches head ... ] Where is the expansion happening, then? Seems
> > weird.
>
> The $@ is expanded as a make variable. Make does care whether you're
> executing a $(shell) thing around it. However, it seems that $@ should
> expand to nothing in that assignment, so where's the problem?

exactly in that, so make triing to execute
ld -shared -x -soname -o pltcl.so pltcl.o
^ no arguments to -soname


From: Murray Prior Hobbs <murray(at)efone(dot)com>
To: Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Red Hat 7.2 Regression failures (Re: pltcl build problem on FreeBSD (was: Re: pltlc and pltlcu problems))
Date: 2002-01-24 03:13:53
Message-ID: 3C4F7BF1.4040905@efone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql


ok i dropped the locale support and reconfigured, remade, reinstalled
etc etc on two machines

both machines failed - but with different failures

see below Lamar's mail for deatils of the two sets of failures

murray

ps - i'll remove configure options until nothing fails

Lamar Owen wrote:

>[I trimmed the CC list. It was getting out of hand. Boy, how I despise having
>to use reply-all.... :-)]
>
>On Wednesday 23 January 2002 04:44 am, Murray Prior Hobbs wrote:
>
>>and ran the check (make check) - 79 tests passed
>>
>>then i ran the make installcheck
>>
>>and get precisely the same failures as i got on my 686 over the last 3 days
>>
>>could somebody else confirm these findings please or suggest what's going
>>on
>>
>
>This probably has nothing to do with the TCL issue. It is the locale setting
>biting you. The first regression run using make check is using the C locale
>-- which passes all tests. The second run isn't using the C locale,
>apparently. And those tests fail when the locale is not 'C'.
>

these are the make checkinstall failures for the following configuarion

./configure --enable-multibyte=UNICODE --enable-unicode-conversion --enable-locale --with-tcl --without-tk --enable-odbc --with-unixodbc --enable-syslog

/bin/sh ./pg_regress --schedule=./serial_schedule --multibyte=UNICODE
(using postmaster on Unix socket, default port)
============== dropping database "regression" ==============
ERROR: DROP DATABASE: database "regression" does not exist
dropdb: database removal failed
============== creating database "regression" ==============
CREATE DATABASE
============== dropping regression test user accounts ==============
============== installing PL/pgSQL ==============
============== running regression test queries ==============
test boolean ... ok
test char ... FAILED
test name ... ok
test varchar ... FAILED
test text ... ok
test int2 ... ok
test int4 ... ok
test int8 ... FAILED
test oid ... ok
test float4 ... ok
test float8 ... ok
test bit ... ok
test numeric ... FAILED
test strings ... ok
test numerology ... ok
test point ... ok
test lseg ... ok
test box ... ok
test path ... ok
test polygon ... ok
test circle ... ok
test date ... ok
test time ... ok
test timetz ... ok
test timestamp ... ok
test timestamptz ... ok
test interval ... ok
test abstime ... ok
test reltime ... ok
test tinterval ... ok
test inet ... ok
test comments ... ok
test oidjoins ... ok
test type_sanity ... ok
test opr_sanity ... ok
test geometry ... ok
test horology ... ok
test create_function_1 ... ok
test create_type ... ok
test create_table ... ok
test create_function_2 ... ok
test copy ... FAILED
test constraints ... ok
test triggers ... ok
test create_misc ... ok
test create_aggregate ... ok
test create_operator ... ok
test create_index ... ok
test inherit ... ok
test create_view ... ok
test sanity_check ... ok
test errors ... ok
test select ... ok
test select_into ... ok
test select_distinct ... ok
test select_distinct_on ... ok
test select_implicit ... FAILED
test select_having ... FAILED
test subselect ... ok
test union ... ok
test case ... ok
test join ... ok
test aggregates ... ok
test transactions ... ok
test random ... ok
test portals ... ok
test arrays ... ok
test btree_index ... ok
test hash_index ... ok
test privileges ... ok
test misc ... FAILED
test select_views ... FAILED
test alter_table ... ok
test portals_p2 ... ok
test rules ... ok
test foreign_key ... ok
test limit ... ok
test plpgsql ... ok
test temp ... ok

=======================
9 of 79 tests failed.
=======================

these are the make checkinstall failures for the following configuarion - the locale option is dropped

./configure --enable-multibyte=UNICODE --enable-unicode-conversion --with-tcl --without-tk --enable-odbc --with-unixodbc --enable-syslog

/bin/sh ./pg_regress --schedule=./serial_schedule --multibyte=UNICODE
(using postmaster on Unix socket, default port)
============== dropping database "regression" ==============
ERROR: DROP DATABASE: database "regression" does not exist
dropdb: database removal failed
============== creating database "regression" ==============
CREATE DATABASE
============== dropping regression test user accounts ==============
============== installing PL/pgSQL ==============
============== running regression test queries ==============
test boolean ... ok
test char ... ok
test name ... ok
test varchar ... ok
test text ... ok
test int2 ... ok
test int4 ... ok
test int8 ... ok
test oid ... ok
test float4 ... ok
test float8 ... ok
test bit ... ok
test numeric ... ok
test strings ... ok
test numerology ... ok
test point ... ok
test lseg ... ok
test box ... ok
test path ... ok
test polygon ... ok
test circle ... ok
test date ... ok
test time ... ok
test timetz ... ok
test timestamp ... ok
test timestamptz ... ok
test interval ... ok
test abstime ... ok
test reltime ... ok
test tinterval ... ok
test inet ... ok
test comments ... ok
test oidjoins ... ok
test type_sanity ... ok
test opr_sanity ... ok
test geometry ... ok
test horology ... ok
test create_function_1 ... ok
test create_type ... ok
test create_table ... ok
test create_function_2 ... ok
test copy ... FAILED
test constraints ... ok
test triggers ... ok
test create_misc ... ok
test create_aggregate ... ok
test create_operator ... ok
test create_index ... ok
test inherit ... ok
test create_view ... ok
test sanity_check ... ok
test errors ... ok
test select ... FAILED
test select_into ... ok
test select_distinct ... FAILED
test select_distinct_on ... FAILED
test select_implicit ... ok
test select_having ... ok
test subselect ... ok
test union ... ok
test case ... ok
test join ... ok
test aggregates ... FAILED
test transactions ... ok
test random ... failed (ignored)
test portals ... ok
test arrays ... ok
test btree_index ... ok
test hash_index ... ok
test privileges ... ok
test misc ... FAILED
test select_views ... ok
test alter_table ... ok
test portals_p2 ... FAILED
test rules ... ok
test foreign_key ... ok
test limit ... FAILED
test plpgsql ... ok
test temp ... ok

====================================================
9 of 79 tests failed, 1 of these failures ignored.
====================================================


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Vsevolod Lobko <seva(at)sevasoft(dot)kiev(dot)ua>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Brent Verner <brent(at)rcfile(dot)org>, Murray Prior Hobbs <murray(at)efone(dot)com>, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and
Date: 2002-01-27 16:02:33
Message-ID: Pine.LNX.4.30.0201271101560.687-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Vsevolod Lobko writes:

> Sorry, but by this you broke freebsd build which has:
>
> TCL_SHLIB_LD = ld -shared -x -soname $@
>
> and $@ gets substituted too early

FreeBSD has fixed this now.

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-02-11 01:00:42
Message-ID: 25459.1013389242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

I hate to sound like a broken record, but I want to re-open that
discussion about RTLD_LAZY binding that trailed off a week or two
ago. I have just noticed that the 7.0 and 7.1 versions of
src/backend/port/dynloader/linux.h have

#define pg_dlopen(f) dlopen(f, 2)

which in 7.2 has been changed to

#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)

But a quick look in /usr/include/bits/dlfcn.h shows that (at least
on RH Linux 7.2), the old coding was equivalent to RTLD_NOW.

I therefore assert that the current coding is effectively untested
on Linux, which is probably our most popular platform, and therefore
it should *NOT* be accorded the respect normally due to the status
quo. Arguably, 7.2 has introduced breakage here.

A grep through the 7.1 versions of src/backend/port/dynloader/*.h
shows the following rather motley assortment of dlopen flag choices:

aix.h:61:#define pg_dlopen(f) dlopen(f, RTLD_LAZY)
bsdi.h:23:#define pg_dlopen(f) dlopen(f, RTLD_LAZY)
dgux.h:26:#define pg_dlopen(f) dlopen(f,1)
freebsd.h:36:#define pg_dlopen(f) BSD44_derived_dlopen(f, 1)
irix5.h:29:#define pg_dlopen(f) dlopen(f,1)
linux.h:34:#define pg_dlopen(f) dlopen(f, 2)
netbsd.h:36:#define pg_dlopen(f) BSD44_derived_dlopen(f, 1)
openbsd.h:36:#define pg_dlopen(f) BSD44_derived_dlopen(f, 1)
osf.h:31:#define pg_dlopen(f) dlopen(f, RTLD_LAZY)
sco.h:29:#define pg_dlopen(f) dlopen(f,1)
solaris.h:9:#define pg_dlopen(f) dlopen(f,1)
sunos4.h:29:#define pg_dlopen(f) dlopen(f, 1)
svr4.h:29:#define pg_dlopen(f) dlopen(f,RTLD_LAZY)
univel.h:29:#define pg_dlopen(f) dlopen(f,RTLD_LAZY)
unixware.h:29:#define pg_dlopen(f) dlopen(f,RTLD_LAZY)
win.h:29:#define pg_dlopen(f) dlopen(f,1)

In 7.2 these have all been changed to "RTLD_LAZY | RTLD_GLOBAL", but
I am no longer willing to presume that that's equivalent to the
original coding. Could people who have these platforms look to see
what the numeric values mentioned above actually equate to on their
platforms?

regards, tom lane


From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-02-11 01:42:59
Message-ID: 20020211014259.GA48360@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-02-10 20:00] Tom Lane said:

| freebsd.h:36:#define pg_dlopen(f) BSD44_derived_dlopen(f, 1)
| netbsd.h:36:#define pg_dlopen(f) BSD44_derived_dlopen(f, 1)

freebsd 4.5
netbsd 1.5.2

#define RTLD_LAZY 1
#define RTLD_GLOBAL 0x100

cheers.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-02-11 02:24:16
Message-ID: 25787.1013394256@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

Brent Verner <brent(at)rcfile(dot)org> writes:
> freebsd 4.5
> netbsd 1.5.2

> #define RTLD_LAZY 1
> #define RTLD_GLOBAL 0x100

Thanks. Is there an RTLD_NOW symbol on those platforms?

regards, tom lane


From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-02-11 03:49:23
Message-ID: 20020211034923.GA49329@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

[2002-02-10 21:24] Tom Lane said:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| > freebsd 4.5
| > netbsd 1.5.2
|
| > #define RTLD_LAZY 1
| > #define RTLD_GLOBAL 0x100
|
| Thanks. Is there an RTLD_NOW symbol on those platforms?

yes. I've attached the dlfcn.h files from each incase there is
anything else in there that might be of interest.

cheers.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman

Attachment Content-Type Size
freebsd-dlfcn.h text/plain 3.2 KB
netbsd-dlfcn.h text/plain 3.1 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-02-12 00:49:57
Message-ID: 18523.1013474997@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

I wrote:
> I hate to sound like a broken record, but I want to re-open that
> discussion about RTLD_LAZY binding that trailed off a week or two
> ago.
> ... I therefore assert that the current coding is effectively untested
> on Linux, which is probably our most popular platform, and therefore
> it should *NOT* be accorded the respect normally due to the status
> quo. Arguably, 7.2 has introduced breakage here.

After some further digging around on the net, I believe that coding in
the following style is safe and will work on all systems supporting
dlopen():

/*
* In older systems, like SunOS 4.1.3, the RTLD_NOW flag isn't defined
* and the mode argument to dlopen must always be 1. The RTLD_GLOBAL
* flag is wanted if available, but it doesn't exist everywhere.
* If it doesn't exist, set it to 0 so it has no effect.
*/
#ifndef RTLD_NOW
# define RTLD_NOW 1
#endif

#ifndef RTLD_GLOBAL
# define RTLD_GLOBAL 0
#endif

#define pg_dlopen(f) dlopen((f), RTLD_NOW | RTLD_GLOBAL)

I also believe that this will produce more consistent cross-platform
behavior: so far as I could learn from googling, systems that do not
define RTLD_NOW/RTLD_LAZY all act as though the mode were RTLD_NOW,
ie, immediate binding.

Any objections to modifying all the port/dynloader files this way?

regards, tom lane


From: David Terrell <dbt(at)meat(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: RTLD_LAZY considered harmful (Re: pltlc and pltlcu
Date: 2002-02-15 02:08:42
Message-ID: 20020214180842.B23916@pianosa.catch22.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers pgsql-sql

On Mon, Feb 11, 2002 at 07:49:57PM -0500, Tom Lane wrote:
> I also believe that this will produce more consistent cross-platform
> behavior: so far as I could learn from googling, systems that do not
> define RTLD_NOW/RTLD_LAZY all act as though the mode were RTLD_NOW,
> ie, immediate binding.
>
> Any objections to modifying all the port/dynloader files this way?

OpenBSD:
The dlopen() function takes a name of a shared object as its first argu-
ment. The shared object is mapped into the address space, relocated, and
its external references are resolved in the same way as is done with the
implicitly loaded shared libraries at program startup.

The path argument can either be an absolute pathname or it can be of the
form ``lib<name>.so[.xx[.yy]]'' in which case the same library search
rules apply that are used for ``intrinsic'' shared library searches. The
second argument currently has no effect, but should be set to DL_LAZY for
future compatibility.

That last sentence being key....

--
David Terrell | "War is peace,
Prime Minister, Nebcorp | freedom is slavery,
dbt(at)meat(dot)net | ignorance is strength
http://wwn.nebcorp.com/ | Dishes are clean." - Chris Fester