Bug 235358 - net-p2p/qtum: fix build with GCC-based architectures
Summary: net-p2p/qtum: fix build with GCC-based architectures
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Vasil Dimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-31 19:09 UTC by Piotr Kubaj
Modified: 2019-02-08 06:34 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (vd)


Attachments
patch (2.90 KB, patch)
2019-01-31 19:09 UTC, Piotr Kubaj
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 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 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 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 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.