NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.67k stars 13.81k forks source link

MuPDF thinks it wasn't built with a new-enough FreeGLUT, yet there doesn't appear to exist a new-enough FreeGLUT for it #104017

Open 8573 opened 3 years ago

8573 commented 3 years ago

Describe the bug Although the Nix expression for MuPDF does provide FreeGLUT to its build— https://github.com/NixOS/nixpkgs/blob/3bf2464a68ee3f9c258cd503078c7e6c0f5349b4/pkgs/applications/misc/mupdf/default.nix#L53mupdf-gl issues the following warning when run—

warning: This version of MuPDF has been built WITHOUT clipboard or unicode input support! warning: Please file a complaint with your friendly local distribution manager.

—which, grepping the source code, I see is issued if a macro FREEGLUT is not defined or GLUT_API_VERSION is less than 6. Grepping the source of the FreeGLUT version that nixpkgs provides, 3.2.1, the only mention I see of GLUT_API_VERSION is the following at line 123 of its file include/GL/freeglut_std.h:

#define  GLUT_API_VERSION     4

3.2.1 seems to be the most recent version of FreeGLUT, so I'm afraid I don't know what MuPDF is thinking to expect a GLUT_API_VERSION of 6 or higher.

Expected behavior mupdf-gl should run without issuing warnings about its packaging.

Notify maintainers @vrthra and @fpletz as package maintainers for MuPDF, @wamserma who recently updated the MuPDF expression, and @bjornfor as package maintainer for FreeGLUT

Metadata

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: [mupdf] # and freeglut?
# a list of nixos modules affected by the problem
module: []
xaverdh commented 3 years ago

According to https://git.ghostscript.com/?p=mupdf.git;a=commit;h=06c999fec01863a90824ba2f9f3ce98ea1a967d3, they bundle a modified version of FreeGLUT. They probably bumped the GLUT_API_VERSION in that bundled version..

8573 commented 3 years ago

@xaverdh wrote—

According to https://git.ghostscript.com/?p=mupdf.git;a=commit;h=06c999fec01863a90824ba2f9f3ce98ea1a967d3, they bundle a modified version of FreeGLUT. They probably bumped the GLUT_API_VERSION in that bundled version..

Ah, that explains it. Their FreeGLUT looks to be here and to be ten patches atop a 2015 version of FreeGLUT, 3.0.0, with the following years' worth of upstream development not merged in, except for a single patch to make it build under GCC 10.

Tor Andersson wrote—

Linux distribution maintainers build MuPDF without linking to our modified FreeGLUT, so miss out on important features. I'm tired of educating users that the bug is with the distribution shipped mupdf, not on our end.

Perhaps more than one of us on the distro side find this dependency bundling and insistence on it tiresome too.... I wouldn't mind if this issue were resolved simply by patching out the warning. (We're not big enough that they might find out and add some code just to take revenge on us, riiight...?)

8573 commented 3 years ago

(Accidentally closed)

xaverdh commented 3 years ago

Well I think a more polite approach might be to ask them, if they plan to upstream these patches. If they have no interest in doing so, we can still patch out the warning.

wamserma commented 3 years ago

I looked a bit into this. There seems to be an attempt at upstreaming here, which got stuck in discussions on API changes (not a trivial decision as freeGLUT already tries to replace a given API). The patches used for MuPDF basically add Unicode input and Clipboard access and only a subset is required for *nix/X11: https://git.ghostscript.com/?p=thirdparty-freeglut.git;a=commitdiff;h=21c0cc45140637c7fa558a040c7360837b22fa1f https://git.ghostscript.com/?p=thirdparty-freeglut.git;a=commitdiff;h=850d2102eb302bdd03fd81af6b6becdb1f3ae2e0 https://git.ghostscript.com/?p=thirdparty-freeglut.git;a=commitdiff;h=2ba99eb5264fcc0c3c817dc515aef4b630b419b1 https://git.ghostscript.com/?p=thirdparty-freeglut.git;a=commitdiff;h=0167cb31430c9de8e0beca41ffec6fea17d987e5 https://git.ghostscript.com/?p=thirdparty-freeglut.git;a=commitdiff;h=036b32e52c59b968ce639e94740e684b3cf6cba9 https://git.ghostscript.com/?p=thirdparty-freeglut.git;a=commitdiff;h=21f059e4b1489d3fab3f94a65ebebc0f80886237 These include the API version change to 6, compared to upstream. It should be possible to rebase this patchset from freeGLUT 3.0.0 to the current 3.2.1 (we can drop the Windows-related parts). Maybe @ccxvii is also interested in rebasing the patchset. That said, for those that prefer browsing code on GitHub, the patchset is also mirrored here.

stale[bot] commented 3 years ago

I marked this as stale due to inactivity. → More info

phiadaarr commented 1 year ago

Is there any way to advance this? I really would like to use mupdf with clipboard support? If the above referenced merge request is not merged, shall we go ahead and include the patches by hand in nixpkgs?

wamserma commented 1 year ago

i don't expect https://github.com/dcnieho/FreeGLUT/pull/62 to be merged. I quickly tried to rebase the mupdf patch series on the latest FreeGLUT, but somewhere made a mistake (mupdf launches, but crashes at first keypress). I probably won't get things fixed before 22.11 branch-off, but backports should be possible at any time.

bjce commented 4 months ago

Hello

First of all many thanks to the maintainer of mupdf which is a wonderful pdf reader. It is definitely my favorite one and most used pdf reader as it is super light weight and super fast. I could not successfully copy paste some text from a pdf using mupdf. May I ask you if this feature is now available? Many thanks in advance! Best regards

ccxvii commented 4 months ago

MUPDF needs to built with its own fork of freeglut that adds clipboard access for copy & paste to work. I've tried to get those patches merged upstream, but was not successful.

bjce commented 4 months ago

ok many thanks for your quick answer @ccxvii . Do you think that you could provide the link of the source to be built?

ccxvii commented 4 months ago

From the same place you got mupdf. It's included in the release tarballs, and is available from the same gits as mupdf itself.

https://github.com/ArtifexSoftware/thirdparty-freeglut http://cgit.ghostscript.com/cgi-bin/cgit.cgi/thirdparty-freeglut.git/