Bug 259262 - databases/postgresql-plv8js: update to 3.0.0 and unbreak
Summary: databases/postgresql-plv8js: update to 3.0.0 and unbreak
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Michael Zhilin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-19 07:32 UTC by Felix Palmen
Modified: 2021-11-01 06:18 UTC (History)
4 users (show)

See Also:


Attachments
0001-databases-postgresql-plv8js-update-to-3.0.0 (10.22 KB, patch)
2021-10-19 07:32 UTC, Felix Palmen
no flags Details | Diff
0001-databases-postgresql-plv8js-remove-pgsql-version (897 bytes, patch)
2021-10-19 10:51 UTC, Felix Palmen
no flags Details | Diff
0001-databases-postgresql-plv8js-remove-pgsql-version (1.04 KB, patch)
2021-10-19 11:08 UTC, Felix Palmen
no flags Details | Diff
0001-databases-postgresql-plv8js-disable-C-RTTI (1.03 KB, patch)
2021-10-19 16:04 UTC, Felix Palmen
no flags Details | Diff
0001-databases-postgresql-plv8js-disable-C-RTTI (1.25 KB, patch)
2021-10-19 16:26 UTC, Felix Palmen
no flags Details | Diff
0001-databases-postgresql-plv8js-disable-C-RTTI (1.44 KB, patch)
2021-10-19 16:41 UTC, Felix Palmen
zirias: maintainer-approval? (mizhka)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Palmen freebsd_committer freebsd_triage 2021-10-19 07:32:30 UTC
Created attachment 228826 [details]
0001-databases-postgresql-plv8js-update-to-3.0.0

Needs C++14 and a custom way to pass CXXFLAGS, see attached patch (can be applied with 'git am')
Comment 1 Li-Wen Hsu freebsd_committer freebsd_triage 2021-10-19 08:24:23 UTC
Do you also want to take the maintainership?
Comment 2 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 08:35:51 UTC
(In reply to Li-Wen Hsu from comment #1)
As I don't use this software, I don't think I could maintain it well :(

I just attempted to fix the port because there was someone needing it on FreeBSD forums…
Comment 3 commit-hook freebsd_committer freebsd_triage 2021-10-19 08:58:58 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9013d2fa7dc122d48f1f3060c2fa80195f8d32cd

commit 9013d2fa7dc122d48f1f3060c2fa80195f8d32cd
Author:     Felix Palmen <felix@palmen-it.de>
AuthorDate: 2021-10-19 07:27:06 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-10-19 08:58:34 +0000

    databases/postgresql-plv8js: Update to 3.0.0

    Unbreak the build, needs C++14 and CXXFLAGS passed to the build in a
    non-standard way.

    PR:             259262

 databases/postgresql-plv8js/Makefile               | 12 +++---
 databases/postgresql-plv8js/distinfo               |  6 +--
 .../postgresql-plv8js/files/patch-Makefile (gone)  | 11 -----
 .../postgresql-plv8js/files/patch-plv8.cc (gone)   | 27 -------------
 .../files/patch-plv8__type.cc (new)                | 47 ++++++++++++++++++++++
 .../files/patch-plv8_func.cc (gone)                | 26 ------------
 .../files/patch-plv8_type.cc (gone)                | 26 ------------
 databases/postgresql-plv8js/pkg-plist              | 26 +++++++++++-
 8 files changed, 82 insertions(+), 99 deletions(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2021-10-19 08:59:59 UTC
A commit in branch 2021Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=acf8b1c393fb8eefdea414050206432d2681b4b5

commit acf8b1c393fb8eefdea414050206432d2681b4b5
Author:     Felix Palmen <felix@palmen-it.de>
AuthorDate: 2021-10-19 07:27:06 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-10-19 08:59:04 +0000

    databases/postgresql-plv8js: Update to 3.0.0

    Unbreak the build, needs C++14 and CXXFLAGS passed to the build in a
    non-standard way.

    PR:             259262
    (cherry picked from commit 9013d2fa7dc122d48f1f3060c2fa80195f8d32cd)

 databases/postgresql-plv8js/Makefile               | 12 +++---
 databases/postgresql-plv8js/distinfo               |  6 +--
 .../postgresql-plv8js/files/patch-Makefile (gone)  | 11 -----
 .../postgresql-plv8js/files/patch-plv8.cc (gone)   | 27 -------------
 .../files/patch-plv8__type.cc (new)                | 47 ++++++++++++++++++++++
 .../files/patch-plv8_func.cc (gone)                | 26 ------------
 .../files/patch-plv8_type.cc (gone)                | 26 ------------
 databases/postgresql-plv8js/pkg-plist              | 26 +++++++++++-
 8 files changed, 82 insertions(+), 99 deletions(-)
Comment 5 Li-Wen Hsu freebsd_committer freebsd_triage 2021-10-19 09:00:32 UTC
(In reply to Felix Palmen from comment #2)
That's fine and thanks again for your patch. If possible, please consider also submitting the patch to the upstream.
Comment 6 Michael Zhilin freebsd_committer freebsd_triage 2021-10-19 09:05:15 UTC
Hi Li-Wen!

I can take maintainership. I don't use this software too, but at least my employer have expertise in plv8 and one of customer use it (on Linux).

Thanks!
Comment 7 Li-Wen Hsu freebsd_committer freebsd_triage 2021-10-19 09:16:14 UTC
(In reply to Michael Zhilin from comment #6)
That's great, thanks!  Please go ahead to update the MAINTAINER line (and cherry-pick to quarterly branch) with my approval.
Comment 8 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 10:05:52 UTC
(In reply to Li-Wen Hsu from comment #5)
About the new patch in files, it just follows a breaking change in the v8 API. We have v8 9.4.146.21 in ports.

Upstream's default Makefile does a static build and has hardcoded
AUTOV8_VERSION = 8.8.278.14

So, I'm not sure they would accept it right now… maybe open an issue asking whether they want to move to v8 9.x?
Comment 9 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 10:51:08 UTC
Created attachment 228830 [details]
0001-databases-postgresql-plv8js-remove-pgsql-version

I'm sorry, a little thing slipped me through the cracks :o

It seems 3.0.0 now builds fine with any pgsql version (did a poudriere testport with 9.6, 12 and 14), so I suggest to remove the restriction in the USES.
Comment 10 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 11:08:43 UTC
Created attachment 228833 [details]
0001-databases-postgresql-plv8js-remove-pgsql-version

And I forgot to bump PORTREVISION to trigger a rebuild for everyone *not* using 9.6 as the default pgsql version. Shame on me…
Comment 11 commit-hook freebsd_committer freebsd_triage 2021-10-19 14:33:56 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fb3f11e5db16d91932828a877a2238f0e482ece3

commit fb3f11e5db16d91932828a877a2238f0e482ece3
Author:     Felix Palmen <felix@palmen-it.de>
AuthorDate: 2021-10-19 14:31:00 +0000
Commit:     Michael Zhilin <mizhka@FreeBSD.org>
CommitDate: 2021-10-19 14:33:21 +0000

    databases/postgresql-plv8js: remove pgsql version

    Remove version restriction for pgsql, as 3.0.0 builds fine with any
    version.

    Reported by: Felix Palmen <felix@palmen-it.de>
    PR: 259262
    Sponsored by: Postgres Professional

 databases/postgresql-plv8js/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 12 commit-hook freebsd_committer freebsd_triage 2021-10-19 14:36:57 UTC
A commit in branch 2021Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f8db0660e0cf8e258bbdb7109f4d23dbafc6a3a1

commit f8db0660e0cf8e258bbdb7109f4d23dbafc6a3a1
Author:     Felix Palmen <felix@palmen-it.de>
AuthorDate: 2021-10-19 14:31:00 +0000
Commit:     Michael Zhilin <mizhka@FreeBSD.org>
CommitDate: 2021-10-19 14:35:50 +0000

    databases/postgresql-plv8js: remove pgsql version

    Remove version restriction for pgsql, as 3.0.0 builds fine with any
    version.

    Reported by: Felix Palmen <felix@palmen-it.de>
    PR: 259262
    Sponsored by: Postgres Professional

    (cherry picked from commit fb3f11e5db16d91932828a877a2238f0e482ece3)

 databases/postgresql-plv8js/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 13 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 15:30:21 UTC
Somehow, these latest commits miss the actual removal of the pgsql version restriction :o
Comment 14 Li-Wen Hsu freebsd_committer freebsd_triage 2021-10-19 15:33:08 UTC
Reopen, for pgsql version restriction removal wip.
Comment 15 Ryan D 2021-10-19 15:45:07 UTC
Not sure if this is the correct place and apologize if it is not but I have been testing this build this morning as I was the one in the forums with the issues. The build finishes successfully but when testing on the server I get the following error when attempting to create the plv8 extension:

# psql -U postgres -c 'CREATE EXTENSION plv8'

ERROR:  could not load library "/usr/local/lib/postgresql/plv8-3.0.0.so": dlopen (/usr/local/lib/postgresql/plv8-3.0.0.so) failed: /usr/local/lib/postgresql/plv8-3.0.0.so: Undefined symbol "_ZTIN2v811ArrayBuffer9AllocatorE"

I am currently using PostgreSQL version 10.
Comment 16 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 15:46:52 UTC
That's related to v8, not to pgsql. In wonder why this doesn't lead to a compile error :-( gotta investigate…
Comment 17 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 16:04:28 UTC
Created attachment 228841 [details]
0001-databases-postgresql-plv8js-disable-C-RTTI

(In reply to Ryan D from comment #15)
Could you try whether this patch (or just manually adding -fno-rtti to the CXXFLAGS) solves the problem?
Comment 18 Ryan D 2021-10-19 16:19:13 UTC
Felix, 

I get the following output after adding the patch and rebuilding:


# psql -U postgres -c 'CREATE EXTENSION plv8'


#
# Fatal error in ../../src/api/api.cc, line 5865
# Embedder-vs-V8 build configuration mismatch. On embedder side pointer compression is DISABLED while on V8 side it's ENABLED.
#
#
#
#FailureMessage Object: 0x7fffffffc6a0
==== C stack trace ===============================

    0x80cf8b6e3 <v8::base::debug::StackTrace::StackTrace(void)+0x13> at /usr/local/lib/libv8_libbase.so
    0x80cf454cb <v8::platform::DefaultPlatform::GetStackTracePrinter(void)+0x3b> at /usr/local/lib/libv8_libplatform.so
    0x80cf720d8 <V8_Fatal(char const*, int, char const*, ...)+0x148> at /usr/local/lib/libv8_libbase.so
    0x80bcf06f7 <v8::V8::Initialize(int)+0x47> at /usr/local/lib/libv8.so
    0x80adeb5da <_PG_init+0x32a> at /usr/local/lib/postgresql/plv8-3.0.0.so
    0x850baf <load_external_function+0x30f> at /usr/local/bin/postgres
    0x8508c4 <load_external_function+0x24> at /usr/local/bin/postgres
    0x54e4e9 <fmgr_c_validator+0xb9> at /usr/local/bin/postgres
    0x852e6a <OidFunctionCall1Coll+0x7a> at /usr/local/bin/postgres
    0x54de57 <ProcedureCreate+0x10b7> at /usr/local/bin/postgres
    0x5be4b1 <CreateFunction+0xad1> at /usr/local/bin/postgres
    0x742176 <standard_ProcessUtility+0x10b6> at /usr/local/bin/postgres
    0x741609 <standard_ProcessUtility+0x549> at /usr/local/bin/postgres
    0x7410b8 <ProcessUtility+0x28> at /usr/local/bin/postgres
    0x5ba3fd <ExecAlterExtensionContentsStmt+0x11cd> at /usr/local/bin/postgres
    0x5b6389 <CreateExtension+0x989> at /usr/local/bin/postgres
    0x5b5c02 <CreateExtension+0x202> at /usr/local/bin/postgres
    0x742143 <standard_ProcessUtility+0x1083> at /usr/local/bin/postgres
    0x741609 <standard_ProcessUtility+0x549> at /usr/local/bin/postgres
    0x7410b8 <ProcessUtility+0x28> at /usr/local/bin/postgres
    0x740d06 <PortalRunFetch+0x786> at /usr/local/bin/postgres
    0x740407 <PortalRun+0x767> at /usr/local/bin/postgres
    0x73fe2e <PortalRun+0x18e> at /usr/local/bin/postgres
    0x73ee73 <PostgresMain+0x29d3> at /usr/local/bin/postgres
    0x73d047 <PostgresMain+0xba7> at /usr/local/bin/postgres
    0x6cb0c8 <PostmasterMarkPIDForWorkerNotify+0x6a8> at /usr/local/bin/postgres
    0x6ca7ac <PostmasterMain+0x391c> at /usr/local/bin/postgres
    0x6c7f20 <PostmasterMain+0x1090> at /usr/local/bin/postgres
    0x64f138 <main+0x3b8> at /usr/local/bin/postgres
Comment 19 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 16:26:59 UTC
Created attachment 228842 [details]
0001-databases-postgresql-plv8js-disable-C-RTTI

(In reply to Ryan D from comment #18)

Ok, updated the patch to also enable V8 pointer compression.

I start to understand why upstream defaults to a static build…

Could you please try again with this patch?
Comment 20 Ryan D 2021-10-19 16:35:33 UTC
(In reply to Felix Palmen from comment #19)

This works. Really appreciate the assistance!

root@vbsd80pg:/ # psql -U postgres -c 'CREATE EXTENSION plv8'
CREATE EXTENSION
Comment 21 Felix Palmen freebsd_committer freebsd_triage 2021-10-19 16:41:36 UTC
Created attachment 228843 [details]
0001-databases-postgresql-plv8js-disable-C-RTTI

@Michael for your convenience, I rebased the patch with the runtime fixes onto current main and also included the removal of the pgsql version restriction again.

Sorry for the chaos.
Comment 22 commit-hook freebsd_committer freebsd_triage 2021-11-01 06:17:31 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ca9de5d4536e09be93db2e3dd610412bd781d689

commit ca9de5d4536e09be93db2e3dd610412bd781d689
Author:     Felix Palmen <felix@palmen-it.de>
AuthorDate: 2021-10-19 15:59:13 +0000
Commit:     Michael Zhilin <mizhka@FreeBSD.org>
CommitDate: 2021-11-01 06:14:41 +0000

    databases/postgresql-plv8js: disable C++ RTTI

    Fixes
    /usr/local/lib/postgresql/plv8-3.0.0.so: Undefined symbol
    "_ZTIN2v811ArrayBuffer9AllocatorE"

    Also enable V8 pointer compression, fixes
    Embedder-vs-V8 build configuration mismatch. On embedder side pointer
    compression is DISABLED while on V8 side it's ENABLED.

    PR: 259262
    Reported by: ryan@cybership.net
    Submitted by: felix@palmen-it.de

    Sponsored by: Postgres Professional

 databases/postgresql-plv8js/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Comment 23 Michael Zhilin freebsd_committer freebsd_triage 2021-11-01 06:18:06 UTC
Committed. Thanks!