Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit b3bfff3

Browse files
author
ceedii
committed
Fix build issue for libbeamhash on Ubuntu 22.04
1 parent 5bb86a0 commit b3bfff3

File tree

16 files changed

+996
-1108
lines changed

16 files changed

+996
-1108
lines changed

.github/workflows/dotnet.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
build:
1111

12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1313

1414
steps:
1515
- name: Checkout

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy as BUILDER
22
WORKDIR /app
33
RUN apt-get update && \
4-
apt-get -y install cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libzmq3-dev golang-go libgmp-dev libc++-dev
4+
apt-get -y install cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libzmq3-dev golang-go libgmp-dev libc++-dev zlib1g-dev
55
COPY . .
66
WORKDIR /app/src/Miningcore
77
RUN dotnet publish -c Release --framework net6.0 -o ../../build

build-debian-11.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rm packages-microsoft-prod.deb
1111

1212
# install dev-dependencies
1313
sudo apt-get update; \
14-
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5-dev libgmp-dev libc++-dev
14+
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5-dev libgmp-dev libc++-dev zlib1g-dev
1515

1616
(cd src/Miningcore && \
1717
BUILDIR=${1:-../../build} && \

build-debian-12.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rm packages-microsoft-prod.deb
1111

1212
# install dev-dependencies
1313
sudo apt-get update; \
14-
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5-dev libgmp-dev libc++-dev
14+
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5-dev libgmp-dev libc++-dev zlib1g-dev
1515

1616
(cd src/Miningcore && \
1717
BUILDIR=${1:-../../build} && \

build-ubuntu-20.04.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rm packages-microsoft-prod.deb
1111

1212
# install dev-dependencies
1313
sudo apt-get update; \
14-
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libgmp-dev libc++-dev
14+
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libgmp-dev libc++-dev zlib1g-dev
1515

1616
(cd src/Miningcore && \
1717
BUILDIR=${1:-../../build} && \

build-ubuntu-21.04.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ rm packages-microsoft-prod.deb
1111

1212
# install dev-dependencies
1313
sudo apt-get update; \
14-
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libgmp-dev libc++-dev
14+
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libgmp-dev libc++-dev zlib1g-dev
1515

1616
(cd src/Miningcore && \
1717
BUILDIR=${1:-../../build} && \

build-ubuntu-22.04.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# install dev-dependencies
66
sudo apt-get update; \
7-
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libgmp-dev libc++-dev
7+
sudo apt-get -y install dotnet-sdk-6.0 git cmake clang ninja-build build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libgmp-dev libc++-dev zlib1g-dev
88

99
(cd src/Miningcore && \
1010
BUILDIR=${1:-../../build} && \

examples/handshake_pool.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"percentage": 1
7676
}
7777
],
78+
"enableAsicBoost": true,
7879
"blockRefreshInterval": 250,
7980
"jobRebroadcastTimeout": 0,
8081
"clientConnectionTimeout": 600,

src/Native/libbeamhash/blake/blake2-config.h

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,68 +15,69 @@
1515
#define __BLAKE2_CONFIG_H__
1616

1717
#if defined(_M_IX86_FP)
18-
#if _M_IX86_FP == 2
19-
#define HAVE_SSE2
20-
#ifndef HAVE_AVX
21-
#define HAVE_AVX
22-
#endif
23-
#endif
18+
#if _M_IX86_FP == 2
19+
#define HAVE_SSE2
20+
#ifndef HAVE_AVX
21+
#define HAVE_AVX
22+
#endif
23+
#endif
2424
#elif defined(_M_AMD64) || defined(_M_X64)
25-
#define HAVE_SSSE3
25+
#define HAVE_SSSE3
2626
#endif
2727

2828
// These don't work everywhere
29-
#if defined(__SSE2__)
30-
#define HAVE_SSE2
29+
#if defined(__SSE2__)
30+
#define HAVE_SSE2
3131
#endif
3232

3333
#if defined(__SSSE3__)
34-
#define HAVE_SSSE3
34+
#define HAVE_SSSE3
3535
#endif
3636

3737
#if defined(__SSE4_1__)
38-
#define HAVE_SSE41
38+
#define HAVE_SSE41
3939
#endif
4040

4141
#if defined(__AVX__) || defined(__AVX2__)
42-
#define HAVE_AVX
42+
#define HAVE_AVX
4343
#endif
4444

4545
#if defined(__XOP__)
46-
#define HAVE_XOP
46+
#define HAVE_XOP
4747
#endif
4848

4949

5050
#ifdef HAVE_AVX2
51-
#ifndef HAVE_AVX
52-
#define HAVE_AVX
53-
#endif
51+
#ifndef HAVE_AVX
52+
#define HAVE_AVX
53+
#endif
5454
#endif
5555

5656
#ifdef HAVE_XOP
57-
#ifndef HAVE_AVX
58-
#define HAVE_AVX
59-
#endif
57+
#ifndef HAVE_AVX
58+
#define HAVE_AVX
59+
#endif
6060
#endif
6161

6262
#ifdef HAVE_AVX
63-
#ifndef HAVE_SSE41
64-
#define HAVE_SSE41
65-
#endif
63+
#ifndef HAVE_SSE41
64+
#define HAVE_SSE41
65+
#endif
6666
#endif
6767

6868
#ifdef HAVE_SSE41
69-
#ifndef HAVE_SSSE3
70-
#define HAVE_SSSE3
71-
#endif
69+
#ifndef HAVE_SSSE3
70+
#define HAVE_SSSE3
71+
#endif
7272
#endif
7373

7474
#ifdef HAVE_SSSE3
75-
#define HAVE_SSE2
75+
#define HAVE_SSE2
7676
#endif
7777

7878
#if !defined(HAVE_SSE2)
79-
#error "This code requires at least SSE2."
79+
#error "This code requires at least SSE2."
8080
#endif
8181

8282
#endif
83+
Lines changed: 75 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
/*
22
BLAKE2 reference source code package - optimized C implementations
3+
34
Written in 2012 by Samuel Neves <sneves@dei.uc.pt>
5+
46
To the extent possible under law, the author(s) have dedicated all copyright
57
and related and neighboring rights to this software to the public domain
68
worldwide. This software is distributed without any warranty.
9+
710
You should have received a copy of the CC0 Public Domain Dedication along with
811
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
912
*/
@@ -13,136 +16,121 @@
1316

1417
#include <stdint.h>
1518

16-
static inline uint32_t load32(const void* src)
19+
static inline uint32_t load32( const void *src )
1720
{
1821
#if defined(NATIVE_LITTLE_ENDIAN)
19-
uint32_t w;
20-
memcpy(&w, src, sizeof w);
21-
return w;
22+
uint32_t w;
23+
memcpy(&w, src, sizeof w);
24+
return w;
2225
#else
23-
const uint8_t* p = (const uint8_t*)src;
24-
uint32_t w = *p++;
25-
w |= (uint32_t)(*p++) << 8;
26-
w |= (uint32_t)(*p++) << 16;
27-
w |= (uint32_t)(*p++) << 24;
28-
return w;
26+
const uint8_t *p = ( const uint8_t * )src;
27+
uint32_t w = *p++;
28+
w |= ( uint32_t )( *p++ ) << 8;
29+
w |= ( uint32_t )( *p++ ) << 16;
30+
w |= ( uint32_t )( *p++ ) << 24;
31+
return w;
2932
#endif
3033
}
3134

32-
static inline uint64_t load64(const void* src)
35+
static inline uint64_t load64( const void *src )
3336
{
3437
#if defined(NATIVE_LITTLE_ENDIAN)
35-
uint64_t w;
36-
memcpy(&w, src, sizeof w);
37-
return w;
38+
uint64_t w;
39+
memcpy(&w, src, sizeof w);
40+
return w;
3841
#else
39-
const uint8_t* p = (const uint8_t*)src;
40-
uint64_t w = *p++;
41-
w |= (uint64_t)(*p++) << 8;
42-
w |= (uint64_t)(*p++) << 16;
43-
w |= (uint64_t)(*p++) << 24;
44-
w |= (uint64_t)(*p++) << 32;
45-
w |= (uint64_t)(*p++) << 40;
46-
w |= (uint64_t)(*p++) << 48;
47-
w |= (uint64_t)(*p++) << 56;
48-
return w;
42+
const uint8_t *p = ( const uint8_t * )src;
43+
uint64_t w = *p++;
44+
w |= ( uint64_t )( *p++ ) << 8;
45+
w |= ( uint64_t )( *p++ ) << 16;
46+
w |= ( uint64_t )( *p++ ) << 24;
47+
w |= ( uint64_t )( *p++ ) << 32;
48+
w |= ( uint64_t )( *p++ ) << 40;
49+
w |= ( uint64_t )( *p++ ) << 48;
50+
w |= ( uint64_t )( *p++ ) << 56;
51+
return w;
4952
#endif
5053
}
5154

52-
static inline void store32(void* dst, uint32_t w)
55+
static inline void store32( void *dst, uint32_t w )
5356
{
5457
#if defined(NATIVE_LITTLE_ENDIAN)
55-
memcpy(dst, &w, sizeof w);
58+
memcpy(dst, &w, sizeof w);
5659
#else
57-
uint8_t* p = (uint8_t*)dst;
58-
*p++ = (uint8_t)w;
59-
w >>= 8;
60-
*p++ = (uint8_t)w;
61-
w >>= 8;
62-
*p++ = (uint8_t)w;
63-
w >>= 8;
64-
*p++ = (uint8_t)w;
60+
uint8_t *p = ( uint8_t * )dst;
61+
*p++ = ( uint8_t )w; w >>= 8;
62+
*p++ = ( uint8_t )w; w >>= 8;
63+
*p++ = ( uint8_t )w; w >>= 8;
64+
*p++ = ( uint8_t )w;
6565
#endif
6666
}
6767

68-
static inline void store64(void* dst, uint64_t w)
68+
static inline void store64( void *dst, uint64_t w )
6969
{
7070
#if defined(NATIVE_LITTLE_ENDIAN)
71-
memcpy(dst, &w, sizeof w);
71+
memcpy(dst, &w, sizeof w);
7272
#else
73-
uint8_t* p = (uint8_t*)dst;
74-
*p++ = (uint8_t)w;
75-
w >>= 8;
76-
*p++ = (uint8_t)w;
77-
w >>= 8;
78-
*p++ = (uint8_t)w;
79-
w >>= 8;
80-
*p++ = (uint8_t)w;
81-
w >>= 8;
82-
*p++ = (uint8_t)w;
83-
w >>= 8;
84-
*p++ = (uint8_t)w;
85-
w >>= 8;
86-
*p++ = (uint8_t)w;
87-
w >>= 8;
88-
*p++ = (uint8_t)w;
73+
uint8_t *p = ( uint8_t * )dst;
74+
*p++ = ( uint8_t )w; w >>= 8;
75+
*p++ = ( uint8_t )w; w >>= 8;
76+
*p++ = ( uint8_t )w; w >>= 8;
77+
*p++ = ( uint8_t )w; w >>= 8;
78+
*p++ = ( uint8_t )w; w >>= 8;
79+
*p++ = ( uint8_t )w; w >>= 8;
80+
*p++ = ( uint8_t )w; w >>= 8;
81+
*p++ = ( uint8_t )w;
8982
#endif
9083
}
9184

92-
static inline uint64_t load48(const void* src)
85+
static inline uint64_t load48( const void *src )
9386
{
94-
const uint8_t* p = (const uint8_t*)src;
95-
uint64_t w = *p++;
96-
w |= (uint64_t)(*p++) << 8;
97-
w |= (uint64_t)(*p++) << 16;
98-
w |= (uint64_t)(*p++) << 24;
99-
w |= (uint64_t)(*p++) << 32;
100-
w |= (uint64_t)(*p++) << 40;
101-
return w;
87+
const uint8_t *p = ( const uint8_t * )src;
88+
uint64_t w = *p++;
89+
w |= ( uint64_t )( *p++ ) << 8;
90+
w |= ( uint64_t )( *p++ ) << 16;
91+
w |= ( uint64_t )( *p++ ) << 24;
92+
w |= ( uint64_t )( *p++ ) << 32;
93+
w |= ( uint64_t )( *p++ ) << 40;
94+
return w;
10295
}
10396

104-
static inline void store48(void* dst, uint64_t w)
97+
static inline void store48( void *dst, uint64_t w )
10598
{
106-
uint8_t* p = (uint8_t*)dst;
107-
*p++ = (uint8_t)w;
108-
w >>= 8;
109-
*p++ = (uint8_t)w;
110-
w >>= 8;
111-
*p++ = (uint8_t)w;
112-
w >>= 8;
113-
*p++ = (uint8_t)w;
114-
w >>= 8;
115-
*p++ = (uint8_t)w;
116-
w >>= 8;
117-
*p++ = (uint8_t)w;
99+
uint8_t *p = ( uint8_t * )dst;
100+
*p++ = ( uint8_t )w; w >>= 8;
101+
*p++ = ( uint8_t )w; w >>= 8;
102+
*p++ = ( uint8_t )w; w >>= 8;
103+
*p++ = ( uint8_t )w; w >>= 8;
104+
*p++ = ( uint8_t )w; w >>= 8;
105+
*p++ = ( uint8_t )w;
118106
}
119107

120-
static inline uint32_t rotl32(const uint32_t w, const unsigned c)
108+
static inline uint32_t rotl32( const uint32_t w, const unsigned c )
121109
{
122-
return (w << c) | (w >> (32 - c));
110+
return ( w << c ) | ( w >> ( 32 - c ) );
123111
}
124112

125-
static inline uint64_t rotl64(const uint64_t w, const unsigned c)
113+
static inline uint64_t rotl64( const uint64_t w, const unsigned c )
126114
{
127-
return (w << c) | (w >> (64 - c));
115+
return ( w << c ) | ( w >> ( 64 - c ) );
128116
}
129117

130-
static inline uint32_t rotr32(const uint32_t w, const unsigned c)
118+
static inline uint32_t rotr32( const uint32_t w, const unsigned c )
131119
{
132-
return (w >> c) | (w << (32 - c));
120+
return ( w >> c ) | ( w << ( 32 - c ) );
133121
}
134122

135-
static inline uint64_t rotr64(const uint64_t w, const unsigned c)
123+
static inline uint64_t rotr64( const uint64_t w, const unsigned c )
136124
{
137-
return (w >> c) | (w << (64 - c));
125+
return ( w >> c ) | ( w << ( 64 - c ) );
138126
}
139127

140128
/* prevents compiler optimizing out memset() */
141-
static inline void secure_zero_memory(void* v, size_t n)
129+
static inline void secure_zero_memory( void *v, size_t n )
142130
{
143-
volatile uint8_t* p = (volatile uint8_t*)v;
144-
while (n--)
145-
*p++ = 0;
131+
volatile uint8_t *p = ( volatile uint8_t * )v;
132+
while( n-- ) *p++ = 0;
146133
}
147134

148-
#endif
135+
#endif
136+

0 commit comments

Comments
 (0)