Bug 269020 - devel/rubygem-oj fails to include header files needed for rubygem-oj-introspect
Summary: devel/rubygem-oj fails to include header files needed for rubygem-oj-introspect
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: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-18 00:17 UTC by lysfjord.daniel
Modified: 2023-01-21 10:22 UTC (History)
3 users (show)

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


Attachments
build log (21.11 KB, text/plain)
2023-01-18 00:17 UTC, lysfjord.daniel
no flags Details
git diff on devel/rubygem-oj/Makefile (934 bytes, patch)
2023-01-18 00:19 UTC, lysfjord.daniel
no flags Details | Diff
poudriere build log (16.25 KB, text/plain)
2023-01-19 18:43 UTC, Marko Cupać
no flags Details
rubygem-oj-3.13.23_2.log (successful) (18.06 KB, text/plain)
2023-01-19 20:02 UTC, Marko Cupać
no flags Details
rubygem-oj-introspect-0.7.1.log (failed at stage - missing header) (16.29 KB, text/plain)
2023-01-19 20:03 UTC, Marko Cupać
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description lysfjord.daniel 2023-01-18 00:17:14 UTC
Created attachment 239547 [details]
build log

header files are not included in the package, due to the directory "/wrkdirs/usr/ports/devel/rubygem-oj/work/stage/usr/local/lib/ruby/gems/3.0/gems/oj-3.13.23/ext/oj/" not existing when trying to do the "hack" in the Makefile, resulting in errors looking like this: install: /wrkdirs/usr/ports/devel/rubygem-oj/work/stage/usr/local/lib/ruby/gems/3.0/gems/oj-3.13.23/ext/oj/val_stack.h: No such file or directory

Changing the Makefile post-install hack to:
cd ${WRKSRC}/ext/oj && ${INSTALL_DATA} -d "${STAGEDIR}${PREFIX}/${GEMS_DIR}/${PORTNAME}-${PORTVERSION}/ext/oj/" && ${FIND} * -name "*.h" -type f -exec ${INSTALL_DATA} {} "${STAGEDIR}${PREFIX}/${GEMS_DIR}/${PORTNAME}-${PORTVERSION}/ext/oj/{}" \;

(even worse hack, I know.. sorry), makes this work as expected again.
Comment 1 lysfjord.daniel 2023-01-18 00:19:11 UTC
Created attachment 239548 [details]
git diff on devel/rubygem-oj/Makefile
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-01-18 15:35:27 UTC
A commit in branch main references this bug:

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

commit 0983bbffe275d18b7b7c576817f3eb57e2504bfe
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-01-18 15:28:49 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-01-18 15:32:49 +0000

    devel/rubygem-oj: Fix build

    Currently the header files are not included although there is a
    post-install step. However there is a missing line where we need to
    create the directories.

    This fixes the builds of gitlab-ce.

    PR:             269020
    Reported by:    lysfjord.daniel@smokepit.net
    Approved by:    portmgr (just-fix-it)
    Sponsored by:   Bounce Experts

 devel/rubygem-oj/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 3 Marko Cupać 2023-01-19 09:08:31 UTC
Guys, are you even testing this before pushing to official main ports tree?

I would say you are too fast on the trigger to close the issue and mark it fixed while this is the third time in two days where it is not.

Latest devel/rubygem-oj builds fine (it did before):

=======================<phase: package        >============================
===>  Building package for rubygem-oj-3.13.23_2
===========================================================================
=>> Cleaning up wrkdir
===>  Cleaning for rubygem-oj-3.13.23_2
build of devel/rubygem-oj | rubygem-oj-3.13.23_2 ended at Thu Jan 19 09:04:38 CET 2023
build time: 00:00:25

But devel/rubygem-oj-introspect still fails at the staging phase:

=======================<phase: stage          >============================
===>  Staging for rubygem-oj-introspect-0.7.1
===>   Generating temporary packing list
(cd /wrkdirs/usr/ports/devel/rubygem-oj-introspect/work/oj-introspect-0.7.1; /usr/bin/env RB_USER_INSTALL=yes LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 /usr/local/bin/gem install -l --no-update-sources --install-dir /wrkdirs/usr/ports/devel/rubygem-oj-introspect/work/stage/usr/local/lib/ruby/gems/3.0 --ignore-dependencies --bindir=/wrkdirs/usr/ports/devel/rubygem-oj-introspect/work/stage/usr/local/bin --no-document oj-introspect-0.7.1.gem -- )
Building native extensions. This could take a while...
ERROR:  Error installing oj-introspect-0.7.1.gem:
	ERROR: Failed to build gem native extension.

    current directory: /wrkdirs/usr/ports/devel/rubygem-oj-introspect/work/stage/usr/local/lib/ruby/gems/3.0/gems/oj-introspect-0.7.1/ext/oj-introspect
/usr/local/bin/ruby30 -I /usr/local/lib/ruby/site_ruby/3.0 extconf.rb
creating Makefile

current directory: /wrkdirs/usr/ports/devel/rubygem-oj-introspect/work/stage/usr/local/lib/ruby/gems/3.0/gems/oj-introspect-0.7.1/ext/oj-introspect
make DESTDIR\= sitearchdir\=./.gem.20230119-50191-1n1rmy sitelibdir\=./.gem.20230119-50191-1n1rmy clean

current directory: /wrkdirs/usr/ports/devel/rubygem-oj-introspect/work/stage/usr/local/lib/ruby/gems/3.0/gems/oj-introspect-0.7.1/ext/oj-introspect
make DESTDIR\= sitearchdir\=./.gem.20230119-50191-1n1rmy sitelibdir\=./.gem.20230119-50191-1n1rmy
compiling introspect.c
introspect.c:2:10: fatal error: 'oj.h' file not found
#include "oj.h"
         ^~~~~~
1 error generated.
*** Error code 1

Which of course causes www/gitlab-ce to be skipped.
Comment 4 Matthias Fechner freebsd_committer freebsd_triage 2023-01-19 10:21:04 UTC
(In reply to Marko Cupać from comment #3)
Do you use poudriere to create the packages (if yes, it is working)?

As you reported it, I think you maybe just do a make in the ports dir?
In this case you must ensure that you do have the updated version of rubygem-oj (3.13.23_2) installed before you try to build rubygem-oj-introspect.

I will add another commit that enforces rubygem-oj-introspect to demand rubygem-oj >= 3.13.23_2
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-01-19 10:26:41 UTC
A commit in branch main references this bug:

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

commit 42c3a1cef857e60b2bd0c6335c4b73a3e167e03e
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2023-01-19 10:23:38 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2023-01-19 10:25:40 +0000

    devel/rubygem-oj-introspect: enforce usage of rubygem-oj>=3.13.23_2

    This version has the required header files included in the package

    PR:             269020
    Reported by:    marko.cupac@mimar.rs

 devel/rubygem-oj-introspect/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 6 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-01-19 13:31:01 UTC
(In reply to Marko Cupać from comment #3)
Yes I did. 
https://pkg.bounce-experts.com/build.html?mastername=131-head-infrastructure&build=2023-01-18_17h05m11s
Comment 7 lysfjord.daniel 2023-01-19 18:16:33 UTC
(In reply to Muhammad Moinur Rahman from comment #6)

That build-log doesn't include devel/rubygem-oj? Only devel/rubygem-oj-introspect seems to be built, and if you already had a working package of devel/rubygem-oj, it doesn't showcase the bug being fixed:)

The fix does indeed fix the issue, at least in combination with the fix to devel/rubygem-oj-introspect, so it requires 3.13.23_2:
[00:00:20] [01] [00:00:00] Building devel/rubygem-oj | rubygem-oj-3.13.23_2
[00:00:30] [01] [00:00:10] Finished devel/rubygem-oj | rubygem-oj-3.13.23_2: Success
[00:00:30] [01] [00:00:00] Building devel/rubygem-oj-introspect | rubygem-oj-introspect-0.7.1
[00:00:34] [01] [00:00:04] Finished devel/rubygem-oj-introspect | rubygem-oj-introspect-0.7.1: Success
Comment 8 Marko Cupać 2023-01-19 18:42:04 UTC
(In reply to Matthias Fechner from comment #4)

Hi,

yes, I am building in poudriere. As always, I sync main ports tree with `poudriere ports -p main -u', then I bulk build ports with `poudriere bulk -j 13_1:x86:64 -p main -z server -f server'.

Host running poudriere is running 13/stable from ~month ago:
FreeBSD 13.1-STABLE #5 stable/13-n253300-0eebb2d30a34: Thu Dec 22 16:34:44 CET 2022     root@warden2.example.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

Poudriere version is poudriere-3.3.7_1.

Poudriere jail is:
13_1:x86:64 13.1-RELEASE-p5     amd64 http         2022-12-23 11:25:11 /usr/local/poudriere/jails/13_1_x86_64

Build still fails. I am attaching log file.
Comment 9 Marko Cupać 2023-01-19 18:43:28 UTC
Created attachment 239599 [details]
poudriere build log
Comment 10 lysfjord.daniel 2023-01-19 19:31:01 UTC
(In reply to Marko Cupać from comment #8)

Try a poudriere bulk -C devel/rubygem-oj devel/rubygem-oj-introspect (specify jail as needed). My devel/rubygem-oj compile at version 3.13.23_2 contains the required .h-files. Try to find your last build log of devel/rubygem-oj and upload that here.
Comment 11 Marko Cupać 2023-01-19 20:02:00 UTC
Created attachment 239600 [details]
rubygem-oj-3.13.23_2.log (successful)
Comment 12 Marko Cupać 2023-01-19 20:03:13 UTC
Created attachment 239601 [details]
rubygem-oj-introspect-0.7.1.log (failed at stage - missing header)
Comment 13 Marko Cupać 2023-01-19 20:05:58 UTC
(In reply to lysfjord.daniel from comment #10)

Hi,

thanx for the instruction and for help. I've attached above poudriere logs which were generated in build started with `sudo poudriere bulk -j 13_1:x86:64 -p main -z server -C devel/rubygem-oj devel/rubygem-oj-introspect'.

rubygem-oj succeeds but has a lot of these 'permission denied' errors, while rubygem-oj-introspect still fails at stage phase because of missing header.
Comment 14 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-01-20 11:33:55 UTC
(In reply to Marko Cupać from comment #13)
Can you check in your poudriere.conf whether if you have the following line:
BUILD_AS_NON_ROOT=no

This is what the pkg building cluster uses and this is what most of us use in our poudriere.conf.
Comment 15 Marko Cupać 2023-01-20 13:54:44 UTC
(In reply to Muhammad Moinur Rahman from comment #14)

Yes, I build as nobody:

BUILD_AS_NON_ROOT=yes
PORTBUILD_USER=nobody

I have been doing it for years, and never had significant problems with other ports because of that (apart from not being able to use memcached and ccache since 13.0 or so).

Any chance to make it buildable as non-root? If all other rubygms needed for gitlab-ce, as well as gitlab-ce, build as nobody, shouldn't be too hard to make this one as well.
Comment 16 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2023-01-21 10:22:56 UTC
(In reply to Marko Cupać from comment #15)
For now we have fixed so many things under the just-fix-it umbrella. And unfortunately these are not my ports.

Please open a new ticket and assign it to the original MAINTAINER of the port.