Bug 699960 - fails to build on ppc64: thirdparty/lcms2/src/cmsmd5.c:36:51: Fehler: »ContextID« nicht deklariert
Summary: fails to build on ppc64: thirdparty/lcms2/src/cmsmd5.c:36:51: Fehler: »Contex...
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: master
Hardware: PC Linux
: P4 major
Assignee: MuPDF bugs
URL: https://bugs.gentoo.org/668190
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-12 18:22 UTC by ernsteiswuerfel
Modified: 2018-10-16 16:42 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: 64


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ernsteiswuerfel 2018-10-12 18:22:49 UTC
mupdf-1.13.0 and mupdf-1.14.0 fail to build on ppc64 (big endian). Machine is a Talos II running Gentoo Linux 2.4.1. Please find the original downstream bug-report here: https://bugs.gentoo.org/668190

Tried building from git-master, but get the same build error:

[...]
    CC build/release/thirdparty/lcms2/src/cmsalpha.o
    CC build/release/thirdparty/lcms2/src/cmscam02.o
    CC build/release/thirdparty/lcms2/src/cmscgats.o
    CC build/release/thirdparty/lcms2/src/cmscnvrt.o
    CC build/release/thirdparty/lcms2/src/cmserr.o
    CC build/release/thirdparty/lcms2/src/cmsgamma.o
    CC build/release/thirdparty/lcms2/src/cmsgmt.o
    CC build/release/thirdparty/lcms2/src/cmshalf.o
    CC build/release/thirdparty/lcms2/src/cmsintrp.o
    CC build/release/thirdparty/lcms2/src/cmsio0.o
    CC build/release/thirdparty/lcms2/src/cmsio1.o
    CC build/release/thirdparty/lcms2/src/cmslut.o
    CC build/release/thirdparty/lcms2/src/cmsmd5.o
    CC build/release/thirdparty/lcms2/src/cmsmtrx.o
    CC build/release/thirdparty/lcms2/src/cmsnamed.o
    CC build/release/thirdparty/lcms2/src/cmsopt.o
    CC build/release/thirdparty/lcms2/src/cmspack.o
    CC build/release/thirdparty/lcms2/src/cmspcs.o
thirdparty/lcms2/src/cmsmd5.c: In Funktion »byteReverse«:
thirdparty/lcms2/src/cmsmd5.c:36:51: Fehler: »ContextID« nicht deklariert (erste Verwendung in dieser Funktion)
         cmsUInt32Number t = _cmsAdjustEndianess32(ContextID, *(cmsUInt32Number *) buf);
                                                   ^~~~~~~~~
thirdparty/lcms2/src/cmsmd5.c:36:51: Anmerkung: jeder nicht deklarierte Bezeichner wird nur einmal für jede Funktion, in der er vorkommt, gemeldet
    CC build/release/thirdparty/lcms2/src/cmsplugin.o
make: *** [Makethird:218: build/release/thirdparty/lcms2/src/cmsmd5.o] Fehler 1
Comment 1 Robin Watts 2018-10-12 18:54:20 UTC
I don't speak German, but I'd guess the problem is that you are building with the system version of lcms2, rather than our own forked version of lcms2.

As such, I suspect it's a packaging problem for your distro.

If you download a release version from us (which comes with all the thirdparty libs), does it build OK?
Comment 2 ernsteiswuerfel 2018-10-12 19:01:41 UTC
For this bug-report I tried building from git master:

# git clone git://git.ghostscript.com/mupdf.git
# cd mupdf/
# git submodule init
# git submodule update
# make -j28

Sorry if I did not make myself clear enough. I guess this should correctly pull and use the thirdparty libs and your forekt version of lcms2?
Comment 3 Robin Watts 2018-10-12 19:16:07 UTC
(In reply to ernsteiswuerfel from comment #2)
> Sorry if I did not make myself clear enough. I guess this should correctly
> pull and use the thirdparty libs and your forekt version of lcms2?

No need to apologise, the fault was mine for not reading properly.

Yes, that looks right.

In cmsmd5.c, line 36, replace ContextID with 0.

Do this for any other similar instances you find. Please let me know how you get on. I don't have access to a PowerPC to try this on.
Comment 4 ernsteiswuerfel 2018-10-12 19:24:17 UTC
Now it's:

thirdparty/lcms2/src/cmsmd5.c:54:16: Fehler: expected identifier or »(« before numeric constant
     cmsContext 0;
                ^
thirdparty/lcms2/src/cmsmd5.c:56:1: Warnung: kein Semikolon am Ende von »struct« oder »union«
 } _cmsMD5;
 ^
    CC build/release/thirdparty/jbig2dec/jbig2_segment.o
thirdparty/lcms2/src/cmsmd5.c:155:32: Fehler: expected »;«, »,« or »)« before numeric constant
 cmsHANDLE  MD5alloc(cmsContext 0)
                                ^
thirdparty/lcms2/src/cmsmd5.c: In Funktion »MD5finish«:
thirdparty/lcms2/src/cmsmd5.c:252:20: Fehler: expected identifier before numeric constant
     _cmsFree(ctx ->0, ctx);
                    ^
thirdparty/lcms2/src/cmsmd5.c:252:5: Fehler: Zu wenige Argumente für Funktion »_cmsFree«
     _cmsFree(ctx ->0, ctx);
     ^~~~~~~~
In file included from thirdparty/lcms2/src/lcms2_internal.h:31:0,
                 from thirdparty/lcms2/src/cmsmd5.c:27:
thirdparty/lcms2/include/lcms2art_plugin.h:107:37: Anmerkung: hier deklariert
 CMSAPI void               CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr);
                                     ^~~~~~~~
thirdparty/lcms2/src/cmsmd5.c: Auf höchster Ebene:
thirdparty/lcms2/src/cmsmd5.c:261:46: Fehler: expected »;«, »,« or »)« before numeric constant
 cmsBool CMSEXPORT cmsMD5computeID(cmsContext 0, cmsHPROFILE hProfile)
Comment 5 Robin Watts 2018-10-12 19:33:16 UTC
(In reply to Robin Watts from comment #3)
> Do this for any other similar instances you find. Please let me know how you
> get on. I don't have access to a PowerPC to try this on.

I meant "similar instances you find in calls to _cmsAdjustEndianess32", sorry.
Comment 6 Robin Watts 2018-10-12 19:42:32 UTC
So, the issue here is that we fixed this bug in our fork of lcms2 within gs, and forgot to update the MuPDF one. I'll get that done next week.

Sorry.
Comment 7 ernsteiswuerfel 2018-10-12 19:59:15 UTC
Ok, I can confirm the build finishes when replacing with ContextID 0 in _cmsAdjustEndianess32 (only one instance).

Ah, you were faster than me. Thanks for the good news and the proposed update next week!
Comment 8 Robin Watts 2018-10-15 23:04:20 UTC
Fixed with:

commit 90b8faa80a4746f7f1e0966d6c56a687d2f8d333
Author: Robin Watts <robin.watts@artifex.com>
Date:   Sun Oct 14 00:06:46 2018 +0100

    Pull in newly merged and updated LCMS2MT from MuPDF thirdparty repo.

    The MuPDF repo should be considered canonical, as that is
    the one that can pull in updates from upstream lcms2 easily.
Comment 9 Robin Watts 2018-10-15 23:04:45 UTC
Thanks for the report. Please let us know if this solves it for you.
Comment 10 ernsteiswuerfel 2018-10-16 16:42:36 UTC
I can confirm mupdf from git-master builds now again on my Talos. Thanks for the fix!