Bug 235996

Summary: graphics/mupdf upgrade to 1.14 build error
Product: Ports & Packages Reporter: Marco Beishuizen <mbeis>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Only Me CC: nick.rozhkov, rigoletto, tcberner, uzsolt, w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (uzsolt)
Version: Latest   
Hardware: Any   
OS: Any   

Description Marco Beishuizen 2019-02-24 13:35:24 UTC
Upgrading graphics/mupdf from 1.13 to 1.14 fails after too much errors:

[...]
mkdir -p build/release/source/fitz/ ; cc -O2 -pipe -march=nocona  -fstack-protector -fno-strict-aliasing  -ffunction-sections -fdata-sections -DNDEBUG -fomit-frame-pointer -I/usr/ports/graphics/mupdf/work/mupdf-1.14.0-source/include/mupdf -fPIC -Iinclude -MMD -MP -o build/release/source/fitz/load-png.o -c source/fitz/load-png.c -Wall -Wdeclaration-after-statement -I/usr/local/include/freetype2  -I/usr/local/include/harfbuzz -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include  -I/usr/local/include  -DSHARE_JPEG -Ithirdparty/lcms2/include -Ithirdparty/mujs   -I/usr/local/include/openjpeg-2.3 
source/fitz/load-jpx.c:491:2: error: unknown type name 'OPJ_SIZE_T'
        OPJ_SIZE_T size;
        ^
source/fitz/load-jpx.c:492:2: error: unknown type name 'OPJ_SIZE_T'
        OPJ_SIZE_T pos;
        ^
source/fitz/load-jpx.c:641:8: error: unknown type name 'OPJ_SIZE_T'
static OPJ_SIZE_T fz_opj_stream_read(void * p_buffer, OPJ_SIZE_T p_nb_by...
       ^
source/fitz/load-jpx.c:641:55: error: unknown type name 'OPJ_SIZE_T'
static OPJ_SIZE_T fz_opj_stream_read(void * p_buffer, OPJ_SIZE_T p_nb_by...
                                                      ^
source/fitz/load-jpx.c:644:2: error: use of undeclared identifier 'OPJ_SIZE_T'
        OPJ_SIZE_T len;
        ^
source/fitz/load-jpx.c:646:2: error: use of undeclared identifier 'len'
        len = sb->size - sb->pos;
        ^
source/fitz/load-jpx.c:647:6: error: use of undeclared identifier 'len'
        if (len == 0)
            ^
source/fitz/load-jpx.c:648:11: error: use of undeclared identifier 'OPJ_SIZE_T'
                return (OPJ_SIZE_T)-1; /* End of file! */
                        ^
source/fitz/load-jpx.c:649:6: error: use of undeclared identifier 'len'
        if (len > p_nb_bytes)
            ^
source/fitz/load-jpx.c:650:3: error: use of undeclared identifier 'len'
                len = p_nb_bytes;
                ^
source/fitz/load-jpx.c:651:39: error: use of undeclared identifier 'len'
        memcpy(p_buffer, sb->data + sb->pos, len);
                                             ^
source/fitz/load-jpx.c:652:13: error: use of undeclared identifier 'len'
        sb->pos += len;
                   ^
source/fitz/load-jpx.c:653:9: error: use of undeclared identifier 'len'
        return len;
               ^
source/fitz/load-jpx.c:656:8: error: unknown type name 'OPJ_OFF_T'
static OPJ_OFF_T fz_opj_stream_skip(OPJ_OFF_T skip, void * p_user_data)
       ^
source/fitz/load-jpx.c:656:37: error: unknown type name 'OPJ_OFF_T'
static OPJ_OFF_T fz_opj_stream_skip(OPJ_OFF_T skip, void * p_user_data)
                       source/fitz/load-jpx.c:660:14: error: use of undeclared identifier 'OPJ_OFF_T'
        if (skip > (OPJ_OFF_T)(sb->size - sb->pos))
                    ^
source/fitz/load-jpx.c:661:11: error: use of undeclared identifier 'OPJ_OFF_T'
                skip = (OPJ_OFF_T)(sb->size - sb->pos);
                        ^
source/fitz/load-jpx.c:666:8: error: unknown type name 'OPJ_BOOL'
static OPJ_BOOL fz_opj_stream_seek(OPJ_OFF_T seek_pos, void * p_user_data)
       ^
source/fitz/load-jpx.c:666:36: error: unknown type name 'OPJ_OFF_T'
static OPJ_BOOL fz_opj_stream_seek(OPJ_OFF_T seek_pos, void * p_user_data)
                                   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
gmake[2]: *** [Makefile:101: build/release/source/fitz/load-jpx.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Leaving directory '/usr/ports/graphics/mupdf/work/mupdf-1.14.0-source'
===> Compilation failed unexpectedly.
[...]

My uname -a: FreeBSD yokozuna 12.0-STABLE FreeBSD 12.0-STABLE r343805 YOKOZUNA  amd64
Comment 1 nick.rozhkov 2019-02-24 15:29:24 UTC
The same and for me
FreeBSD daemon.sanitarium.com.ua 12.0-RELEASE-p3 FreeBSD 12.0-RELEASE-p3 #1 r343954M: Sun Feb 10 13:43:21 UTC 2019
Comment 2 Alexandre C. Guimarães freebsd_committer freebsd_triage 2019-02-24 15:58:56 UTC
I can't reproduce in here: https://termbin.com/5pvk
Comment 3 Walter Schwarzenfeld freebsd_triage 2019-02-24 16:38:55 UTC
The error appears if option us JS=on.
Comment 4 Marco Beishuizen 2019-02-24 16:50:47 UTC
I have default options set, so with JS=off.
Comment 5 Walter Schwarzenfeld freebsd_triage 2019-02-24 16:55:22 UTC
You're right also happens with default.
Comment 6 Alexandre C. Guimarães freebsd_committer freebsd_triage 2019-02-24 17:03:52 UTC
Still can reproduce with JS=on: https://termbin.com/5jto

Are you using portmaster (or eventually portupgrade)? Try building with "-R" (or -r I don't remember) on portmaster to force rebuild all dependencies.
Comment 7 Walter Schwarzenfeld freebsd_triage 2019-02-24 17:07:09 UTC
see here:
https://svnweb.freebsd.org/ports/head/graphics/mupdf/Makefile?r1=474665&r2=474664&pathrev=474665

If you pui the lines

CFLAGS+=        `pkg-config --cflags libopenjp2` -I${WRKSRC}/include/mupdf -fPIC # pkg-config to avoid the conflict with openjpeg15
LIBS+=          -L${LOCALBASE}/lib

back in the Makefile it builds.
Comment 8 Walter Schwarzenfeld freebsd_triage 2019-02-24 17:27:20 UTC
It is only needed to add
`pkg-config --cflags libopenjp2` to XCFLAGS.
Comment 9 commit-hook freebsd_committer freebsd_triage 2019-02-24 17:49:12 UTC
A commit references this bug:

Author: rigoletto
Date: Sun Feb 24 17:48:15 UTC 2019
New revision: 493777
URL: https://svnweb.freebsd.org/changeset/ports/493777

Log:
  graphics/mupdf: fix build when graphics/openjpeg15 is present.

  PR:		235996
  Submitted by:	Walter Schwarzenfeld <w.schwarzenfeld@utanet.at>
  Reported by:	Marco Beishuizen <mbeis@xs4all.nl>
  Approved by:	tcberner (mentor)

Changes:
  head/graphics/mupdf/Makefile
Comment 10 Alexandre C. Guimarães freebsd_committer freebsd_triage 2019-02-24 17:51:20 UTC
Thank you. :-)