Bug 256741 - databases/rubygem-pg_query: fails to build after update to 2.0.3 - "unknown type name 'PgQueryProtobuf'"
Summary: databases/rubygem-pg_query: fails to build after update to 2.0.3 - "unknown t...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Matthias Fechner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-21 09:03 UTC by Vladimir Druzenko
Modified: 2021-07-06 09:25 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (mfechner)


Attachments
Build log with error (11.79 KB, text/plain)
2021-06-21 09:03 UTC, Vladimir Druzenko
no flags Details
Full list of ports (42.38 KB, text/plain)
2021-06-24 16:58 UTC, Vladimir Druzenko
no flags Details
List of 380 installed ports on server - fails to build too (17.66 KB, text/plain)
2021-07-04 00:21 UTC, Vladimir Druzenko
no flags Details
Merged upstream fix + removed dependency from databases/libpg_query (1.64 KB, patch)
2021-07-04 22:56 UTC, Vladimir Druzenko
vvd: maintainer-approval?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-21 09:03:06 UTC
Created attachment 225960 [details]
Build log with error

After update databases/rubygem-pg_query to 2.0.3 it fails to build:

In file included from /opt/obj/usr/ports/databases/rubygem-pg_query/work/stage/usr/local/lib/ruby/gems/2.7/gems/pg_query-2.0.3/ext/pg_query/pg_query_deparse.c:3:
./pg_query_readfuncs.h:9:35: error: unknown type name 'PgQueryProtobuf'
List * pg_query_protobuf_to_nodes(PgQueryProtobuf protobuf);

Full build log in attach.

P.S. This issue is a blocker for update the www/gitlab-ce to 14.0.0.
Comment 1 Matthias Fechner freebsd_committer freebsd_triage 2021-06-22 10:10:37 UTC
Have you modified your environment?
It builds fine here:
https://pkg.fechner.net/build.html?mastername=130amd64-default&build=2021-06-22_12h09m19s
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-22 10:37:27 UTC
12.2 amd64.
PostgreSQL 12.7 (server, client, contrib), libpg_query-10.1.0.4, rubygem-pg-1.2.3.

What modification I have to check? It's just live system.
Comment 3 Matthias Fechner freebsd_committer freebsd_triage 2021-06-22 15:22:06 UTC
Do you use a clean environment like poudriere or do you build in a wasted environment (like just make or portmaster or portupgrade)?

If it is the second case, I would try to deinstall all deps and try to rebuild.

I suggest really to use poudriere to build the packages, so you can install them with pkg.
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-22 15:33:30 UTC
As I said before it's real live system, isn't "greenhouse conditions".
Build using portmaster.
poudriere require jails and tooooooo much time and space for every build, but it's just small VM.

Your build is on 13.0 with openssl from ports. Maybe something other are different too.
Comment 5 Matthias Fechner freebsd_committer freebsd_triage 2021-06-24 15:57:29 UTC
no the FreeBSD build servers without SSL from base are compiling fine.

There is something with the lib wrong you have installed.
I would try to remove some packages and rebuild them.

Try with pkg delete -f <package_name>

I would start with libpg_query-10.1.0.4.

Then try if it compiles after this, if not, you maybe have to remove more packages related to postgres, till you find the problem package.

This is just a problem that you do not build in a clean environment like poudriere is using.

Sry, but here I cannot really help you much.
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-24 16:58:28 UTC
Created attachment 226039 [details]
Full list of ports

Did you tried on 12.2 on live system with gitlab installed?
Comment 7 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-24 17:43:44 UTC
Open.
Comment 8 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-24 17:44:56 UTC
Maybe I can show "other" build log - where to look?
Comment 9 Matthias Fechner freebsd_committer freebsd_triage 2021-06-25 07:40:12 UTC
If you do not really need to build packages locally (only reason is that you use different options to the default one), I really suggest to use the already prebuild packages from FreeBSD. Make sure you use the correct branch (main or quarterly), see also the installation manual:
https://gitlab.fechner.net/mfechner/Gitlab-docu/-/blob/master/install/13.12-freebsd.md

There the problem does not exist and it also have the advantage that you do not install build dependencies which will free a lot a space.

If this is no option for you, deinstall rubygem-pg_query and all dependencies and then try to compile it again (pkg delete rubygem-pg_query).
You must have depedencies deinstalled before or it will not work.
Comment 10 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-25 08:20:25 UTC
(In reply to Matthias Fechner from comment #9)
> If you do not really need to build packages locally (only reason is that you use different options to the default one)
Of course I need. A lot of ports I build with custom options.

> I really suggest to use the already prebuild packages from FreeBSD.
It's impossible to remember what port was build with custom options and what with default for every small port. It's easier to build all ports self.

> There the problem does not exist and it also have the advantage that you do not install build dependencies which will free a lot a space.
Much less than jails for poudriere.

> If this is no option for you, deinstall rubygem-pg_query and all dependencies and then try to compile it again (pkg delete rubygem-pg_query).
> You must have depedencies deinstalled before or it will not work.
Already did it before "10" times.

> Unable to Reproduce
You didn't tried to reproduce.
But it's so easy - just build gitlab-ce from ports with all dependencies on clean 12.2 amd64 system.
Comment 11 Matthias Fechner freebsd_committer freebsd_triage 2021-06-25 08:43:23 UTC
It is building perfectly fine:
https://pkg.fechner.net/build.html?mastername=122amd64-default&build=2021-06-25_10h26m16s
Comment 12 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-25 08:55:12 UTC
Don't see gitlab in list.
Comment 13 Matthias Fechner freebsd_committer freebsd_triage 2021-06-25 08:56:22 UTC
You have reported that databases/rubygem-pg_query does not build, which builds fine.
Comment 14 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-25 09:08:22 UTC
> You have reported that databases/rubygem-pg_query does not build, which builds fine.
Ignoring facts under the guise of formalism?
"Build of gitlab-ce fails on build databases/rubygem-pg_query".
Is it correct name for this issue?
I can rename if it helps solve the problem.

P.S. Sorry for my "google translate" english.
Comment 15 Matthias Fechner freebsd_committer freebsd_triage 2021-06-25 09:12:41 UTC
Here the build of gitlab-ce:
https://pkg.fechner.net/build.html?mastername=122amd64-default&build=2021-06-25_11h11m50s

It will take some time to finish.
Comment 16 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-25 09:17:29 UTC
Don't see databases/rubygem-pg_query and postgres in list.
Comment 17 Matthias Fechner freebsd_committer freebsd_triage 2021-06-25 09:36:36 UTC
It is already build so poudriere does not build it again.
Comment 18 Matthias Fechner freebsd_committer freebsd_triage 2021-06-26 04:16:18 UTC
So gitlab-ce for 12.2 with SSL=base builds fine you can see with the build I did.

I can only suggest to deinstall everything related to postgresql (pkg delete -f <package>) and to then to recompile databases/rubygem-pg_query.
It should add all required deps automatically.
Make sure you also clean all ports (make clean) before you try another build.

I suggest you to build you packages using poudriere, there you will not have the problem and it only requires additional 1.5GB to have a FreeBSD base environment. You must not build on the same machine, you can also use another machine the build the packages and make them then available via http/https.
So you can always ensure that everything build fine and was tested, before you install it on a production machine.
Comment 19 Vladimir Druzenko freebsd_committer freebsd_triage 2021-06-26 10:35:42 UTC
(In reply to Matthias Fechner from comment #17)
> It is already build so poudriere does not build it again.
Can you build it on this system?

Ports must build on real systems and must not grab silently dependencies.
Create build-farm for every very small broken ruby port - it's …
Comment 20 Vladimir Druzenko freebsd_committer freebsd_triage 2021-07-03 11:01:50 UTC
You updated gotlab-ce without fix databases/rubygem-pg_query = I got broken configuration of gitlab: "You must upgrade first to 13.12", but I have 13.11.4 and can't upgrade - databases/rubygem-pg_query can't build.
:-(
Comment 21 Vladimir Druzenko freebsd_committer freebsd_triage 2021-07-04 00:21:48 UTC
Created attachment 226202 [details]
List of 380 installed ports on server - fails to build too

Fails to build on 2 other hosts with 12.2 and64:
* one is a desktop with 1908 installed ports,
* 2nd is a server is 380 installed ports only.
Comment 22 Vladimir Druzenko freebsd_committer freebsd_triage 2021-07-04 11:33:29 UTC
Build error is because of /usr/local/include/pg_query.h from databases/libpg_query.
And databases/rubygem-pg_query build fine without databases/libpg_query installed, but it is in BUILD_DEPENDS.
This patch allow to build databases/rubygem-pg_query on CLEAN system:
--- databases/rubygem-pg_query/Makefile.orig
+++ databases/rubygem-pg_query/Makefile
@@ -12,9 +12,7 @@
 LICENSE=       BSD3CLAUSE
 LICENSE_FILE=  ${WRKSRC}/LICENSE

-MY_DEPENDS=    ${LOCALBASE}/lib/libpg_query.a:databases/libpg_query
-BUILD_DEPENDS= ${MY_DEPENDS} \
-               rubygem-pathname>0:devel/rubygem-pathname
+BUILD_DEPENDS= rubygem-pathname>0:devel/rubygem-pathname
 # rubygem-google-protobuf 3.17.1 is required to fix a segfault
 # see PR: https://github.com/pganalyze/pg_query/pull/212
 # and https://github.com/pganalyze/pg_query/pull/213

But it need more patches if databases/libpg_query installed as dependency for other ports.
Comment 23 Vladimir Druzenko freebsd_committer freebsd_triage 2021-07-04 22:56:08 UTC
Created attachment 226227 [details]
Merged upstream fix + removed dependency from databases/libpg_query

AFAIU, databases/rubygem-pg_query have bundled libpg_query and doesn't require databases/libpg_query port:
> This ensures any system installed libpg_query gets considered after
the bundled libpg_query, avoiding errors where the wrong header files
are used.
https://github.com/pganalyze/pg_query/pull/216/commits/94e66713816c325551be8140d2724f1330b3da58

Anyway it was fixed by upstream.

Other option is to update databases/rubygem-pg_query to 2.1.0.
Comment 24 commit-hook freebsd_committer freebsd_triage 2021-07-05 06:05:33 UTC
A commit in branch main references this bug:

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

commit 4bbd995b742469b4d3c5a37f761dfaa6c32f3d76
Author:     VVD <vvd@unislabs.com>
AuthorDate: 2021-07-05 06:00:01 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2021-07-05 06:01:52 +0000

    databases/rubygem-pg_query: Fix unknown type name 'PgQueryProtobuf'

    Make sure to use internal pg_query lib.
    Patch is already included upstream in version 2.1.0:
    https://github.com/pganalyze/pg_query/pull/216/files

    This should fix the build outside of poudriere.

    PR:             256741
    Reported by:    VVD <vvd@unislabs.com>

 databases/rubygem-pg_query/Makefile                             | 6 ++----
 databases/rubygem-pg_query/files/patch-ext_pg__query_extconf.rb | 9 +++++----
 2 files changed, 7 insertions(+), 8 deletions(-)
Comment 25 Matthias Fechner freebsd_committer freebsd_triage 2021-07-05 06:06:09 UTC
Thanks, committed.
Comment 26 commit-hook freebsd_committer freebsd_triage 2021-07-05 06:08:35 UTC
A commit in branch 2021Q3 references this bug:

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

commit 6bd317c1fceee41e30770e5e1dd1ba3ae65e8a89
Author:     VVD <vvd@unislabs.com>
AuthorDate: 2021-07-05 06:00:01 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2021-07-05 06:06:56 +0000

    databases/rubygem-pg_query: Fix unknown type name 'PgQueryProtobuf'

    Make sure to use internal pg_query lib.
    Patch is already included upstream in version 2.1.0:
    https://github.com/pganalyze/pg_query/pull/216/files

    This should fix the build outside of poudriere.

    PR:             256741
    Reported by:    VVD <vvd@unislabs.com>

    (cherry picked from commit 4bbd995b742469b4d3c5a37f761dfaa6c32f3d76)

 databases/rubygem-pg_query/Makefile                             | 6 ++----
 databases/rubygem-pg_query/files/patch-ext_pg__query_extconf.rb | 9 +++++----
 2 files changed, 7 insertions(+), 8 deletions(-)
Comment 27 Vladimir Druzenko freebsd_committer freebsd_triage 2021-07-05 21:54:04 UTC
Thanks.

How to update gitlab from 13.11.2 to 14.0.2?
Comment 28 Matthias Fechner freebsd_committer freebsd_triage 2021-07-06 09:25:34 UTC
(In reply to VVD from comment #27)
I would try to read the standard documentation from Gitlab.
If nothing is in there, I suggest to open an issue with Gitlab and ask the question there.

You can link the issue you ask for reference here.