Bug 250952 - converters/wkhtmltopdf: fix build on arm64/aarch64
Summary: converters/wkhtmltopdf: fix build on arm64/aarch64
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: arm64 Any
: --- Affects Some People
Assignee: Kurt Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-08 14:38 UTC by rasmus
Modified: 2020-11-15 10:25 UTC (History)
4 users (show)

See Also:
pi: maintainer-feedback+


Attachments
patch (1.66 KB, patch)
2020-11-08 16:12 UTC, Kurt Jaeger
no flags Details | Diff
patchfile-for-files-dir (421 bytes, patch)
2020-11-08 16:43 UTC, Kurt Jaeger
no flags Details | Diff
new patchfile-for-files-dir (431 bytes, patch)
2020-11-11 22:23 UTC, rasmus
no flags Details | Diff
Correct patch (435 bytes, patch)
2020-11-11 22:25 UTC, rasmus
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description rasmus 2020-11-08 14:38:02 UTC
CPU isn't correctly tested on arm64 platform for qt. 

If two lines are changed in src/3rdparty/webkit/Source/JavaScriptCore/wtf/Platform.h, it fixes all build errors on the arch. 

Line 1000 and onward can be changed from:

#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) 
|| (CPU(IA64) && !CPU(IA64_32)) 
|| CPU(ALPHA) 
|| CPU(SPARC64) 
|| CPU(S390X) 
|| CPU(PPC64) 
|| CPU(MIPS64)
#define WTF_USE_JSVALUE64 1

to:

#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) 
|| (CPU(IA64) && !CPU(IA64_32)) 
|| CPU(ALPHA) 
|| CPU(SPARC64) 
|| CPU(S390X) 
|| CPU(PPC64) 
|| CPU(MIPS64) 
|| defined(aarch64)
#define WTF_USE_JSVALUE64 1

Of course I sent the above fix to the authors of the software as well:

https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4871

But the port is currently disabled in the ports tree on arm64 because of this defect.

There may be a better way to detect arm64, but the above fix works fine.
Comment 1 Kurt Jaeger freebsd_committer 2020-11-08 16:12:06 UTC
Created attachment 219463 [details]
patch

Something like this patch ?

I'm testbuilding right now, but as I crossbuild, I'm not sure this builds.
Comment 2 Kurt Jaeger freebsd_committer 2020-11-08 16:14:03 UTC
My poudriere jail complains:

qemu: unsupported syscall: 574

and I have not yet found when this syscall was added.
Comment 3 Kurt Jaeger freebsd_committer 2020-11-08 16:16:17 UTC
(In reply to Kurt Jaeger from comment #2)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247025
has a similar report.
My poudriere jail is @r363767
arm      13.0-CURRENT 1300103 r363767 arm64.aarch64 svn+ssh 2020-08-02 15:13:01 /pou/jails/arm
Comment 4 rasmus 2020-11-08 16:22:44 UTC
I'm at 12.2-RELEASE - so that could be a difference?

Your patch looks spot on.

Is there a way I can merge your patch into my ports tree - and try it the same way as you do? Currently i abort the make when it starts compiling, make the change and restart the make.
Comment 5 Kurt Jaeger freebsd_committer 2020-11-08 16:43:53 UTC
Created attachment 219465 [details]
patchfile-for-files-dir

Add this file to the files/ directory of the port.
Comment 6 rasmus 2020-11-08 19:24:10 UTC
Ok, so GitHub messed up my code example, and I copy/pasted it here. Apparently you need to indent code with 4 spaces - otherwise backslashes and underscores disappears. Sorry for the confusion, the correct code is:

#if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \
|| (CPU(IA64) && !CPU(IA64_32))  \
|| CPU(ALPHA) \
|| CPU(SPARC64) \
|| CPU(S390X) \
|| CPU(PPC64) \
|| CPU(MIPS64) \
|| defined(__aarch64__)
#define WTF_USE_JSVALUE64 1

This works for me, with no other alterations. Just compiled the mammoth successfully.
Comment 7 rasmus 2020-11-11 22:21:42 UTC
Did you manage to compile yourself?
Comment 8 rasmus 2020-11-11 22:23:44 UTC
Created attachment 219576 [details]
new patchfile-for-files-dir

With underscores
Comment 9 rasmus 2020-11-11 22:25:52 UTC
Created attachment 219577 [details]
Correct patch
Comment 10 Mark Linimon freebsd_committer freebsd_triage 2020-11-13 07:20:06 UTC
Comment on attachment 219577 [details]
Correct patch

Give this the correct patchname.
Comment 11 Mark Linimon freebsd_committer freebsd_triage 2020-11-15 09:58:48 UTC
I can confirm that this fixes the build for me (using qemu).
Comment 12 commit-hook freebsd_committer 2020-11-15 10:23:10 UTC
A commit references this bug:

Author: pi
Date: Sun Nov 15 10:23:01 UTC 2020
New revision: 555188
URL: https://svnweb.freebsd.org/changeset/ports/555188

Log:
  converters/wkhtmltopdf: fix build on arm64/aarch64

  PR:		250952
  Submitted by:	rasmus@gal.dk
  Reviewed by:	linimon
  MFH:		2020Q4

Changes:
  head/converters/wkhtmltopdf/Makefile
  head/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__wtf__Platform.h
Comment 13 Kurt Jaeger freebsd_committer 2020-11-15 10:24:45 UTC
Thanks, committed!
Comment 14 commit-hook freebsd_committer 2020-11-15 10:25:11 UTC
A commit references this bug:

Author: pi
Date: Sun Nov 15 10:24:19 UTC 2020
New revision: 555189
URL: https://svnweb.freebsd.org/changeset/ports/555189

Log:
  MFH: r555188

  converters/wkhtmltopdf: fix build on arm64/aarch64

  PR:		250952
  Submitted by:	rasmus@gal.dk
  Reviewed by:	linimon
  Approved by:	portmgr (fix blanket)

Changes:
_U  branches/2020Q4/
  branches/2020Q4/converters/wkhtmltopdf/Makefile
  branches/2020Q4/converters/wkhtmltopdf/files/patch-src__3rdparty__webkit__Source__JavaScriptCore__wtf__Platform.h