Bug 235358

Summary: net-p2p/qtum: fix build with GCC-based architectures
Product: Ports & Packages Reporter: Piotr Kubaj <pkubaj>
Component: Individual Port(s)Assignee: Vasil Dimov <vd>
Status: Closed FIXED    
Severity: Affects Only Me CC: linimon, pkubaj
Priority: --- Flags: bugzilla: maintainer-feedback? (vd)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Piotr Kubaj freebsd_committer freebsd_triage 2019-01-31 19:09:27 UTC
Created attachment 201564 [details]
patch

The code for big-endian architectures is broken and doesn't compile.

#define fix_endian64(dst_, src_) dst_ = ethash_swap_u64(src_
misses ) at the end of line.

fix_endian_arr32 and fix_endian_arr64 are broken because of bad "while" placement. Unfortunately, I couldn't find what the issue is, so I just removed do while, which simplifies things.

Another error is that for loop in fix_endian_arr{32,64} uses , instead of ;.

Also remove const qualifier from nonce since it's actually modified and causes another build error (although Clang for some strange reason accepts it).

Tested on powerpc64 and amd64.

Hardware sponsored by IntegriCloud.
Comment 1 commit-hook freebsd_committer freebsd_triage 2019-02-07 19:30:05 UTC
A commit references this bug:

Author: vd
Date: Thu Feb  7 19:29:37 UTC 2019
New revision: 492383
URL: https://svnweb.freebsd.org/changeset/ports/492383

Log:
  net-p2p/qtum: fix compilation on big-endian machines

  PR:		235358
  Submitted by:	Piotr Kubaj <pkubaj@anongoth.pl>

Changes:
  head/net-p2p/qtum/files/
  head/net-p2p/qtum/files/patch-src__cpp-ethereum__libethash__endian.h
  head/net-p2p/qtum/files/patch-src__cpp-ethereum__libethash__internal.c
Comment 2 Vasil Dimov freebsd_committer freebsd_triage 2019-02-07 19:38:19 UTC
(In reply to Piotr Kubaj from comment #0)

I have committed your patch with some modifications.

> The code for big-endian architectures is broken and doesn't compile.
>
> #define fix_endian64(dst_, src_) dst_ = ethash_swap_u64(src_
> misses ) at the end of line.
>
> fix_endian_arr32 and fix_endian_arr64 are broken because of bad "while" placement. 
> Unfortunately, I couldn't find what the issue is, so I just removed do while,
> which simplifies things.

The problem is/was that there was a missing } before the while keyword. The reason for
the while is to enforce a ; after the macro call when using it. 

> Another error is that for loop in fix_endian_arr{32,64} uses , instead of ;.

Doh :(

> Also remove const qualifier from nonce since it's actually modified and causes 
> another build error (although Clang for some strange reason accepts it).

It needed removing in just one place.

Have you submitted these patches upstream?

Thanks!
Comment 3 Piotr Kubaj freebsd_committer freebsd_triage 2019-02-08 06:34:14 UTC
(In reply to Vasil Dimov from comment #2)
I have just now sent two PR's with those patches.