Skip to content

Conversation

ken2812221
Copy link
Contributor

Probably fixes #13576. I'm not able to test this. @stacepellegrino, can you test this?

@stacepellegrino
Copy link

Just testing changes now. Performing build to see if it fixes https://github.com/bitcoin/bitcoin/issues/13576

@stacepellegrino
Copy link

Did not fix the problem...

# make
Making all in src
make[1]: Entering directory '/opt/local/src/bitcoin/src'
make[2]: Entering directory '/opt/local/src/bitcoin/src'
make[3]: Entering directory '/opt/local/src/bitcoin'
make[3]: Leaving directory '/opt/local/src/bitcoin'
  CXX      crypto/libbitcoinconsensus_la-aes.lo
  CXX      crypto/libbitcoinconsensus_la-chacha20.lo
  CXX      crypto/libbitcoinconsensus_la-hmac_sha256.lo
  CXX      crypto/libbitcoinconsensus_la-hmac_sha512.lo
  CXX      crypto/libbitcoinconsensus_la-ripemd160.lo
  CXX      crypto/libbitcoinconsensus_la-sha1.lo
  CXX      crypto/libbitcoinconsensus_la-sha256.lo
  CXX      crypto/libbitcoinconsensus_la-sha512.lo
  CXX      crypto/libbitcoinconsensus_la-sha256_sse4.lo
  CXX      libbitcoinconsensus_la-arith_uint256.lo
  CXX      consensus/libbitcoinconsensus_la-merkle.lo
In file included from ./script/script.h:11:0,
                 from ./primitives/transaction.h:11,
                 from ./consensus/merkle.h:11,
                 from consensus/merkle.cpp:5:
./serialize.h:195:39: error: redefinition of 'template<class Stream> void Serialize(Stream&, int8_t)'
 template<typename Stream> inline void Serialize(Stream& s, int8_t a  ) { ser_wr
                                       ^
./serialize.h:193:39: note: 'template<class Stream> void Serialize(Stream&, char)' previously declared here
 template<typename Stream> inline void Serialize(Stream& s, char a    ) { ser_wr
                                       ^
In file included from ./script/script.h:11:0,
                 from ./primitives/transaction.h:11,
                 from ./consensus/merkle.h:11,
                 from consensus/merkle.cpp:5:
./serialize.h:213:39: error: redefinition of 'template<class Stream> void Unserialize(Stream&, int8_t&)'
 template<typename Stream> inline void Unserialize(Stream& s, int8_t& a  ) { a =
                                       ^
./serialize.h:211:39: note: 'template<class Stream> void Unserialize(Stream&, char&)' previously declared here
 template<typename Stream> inline void Unserialize(Stream& s, char& a    ) { a =
                                       ^
Makefile:8138: recipe for target 'consensus/libbitcoinconsensus_la-merkle.lo' failed
make[2]: *** [consensus/libbitcoinconsensus_la-merkle.lo] Error 1
make[2]: Leaving directory '/opt/local/src/bitcoin/src'
Makefile:9824: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/opt/local/src/bitcoin/src'
Makefile:757: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

@stacepellegrino
Copy link

The configure script generates the following as part of its output...

checking for if type char equals int8_t... no

@ken2812221
Copy link
Contributor Author

Can you provide your config.log?

@stacepellegrino
Copy link

Here it is...

config.log

@ken2812221
Copy link
Contributor Author

I forgot to specify the error message for static_assert, would u mind to test this again?

@stacepellegrino
Copy link

That works! Please update the main branch of source with this change.

However, my build failed with...

CXX compat/libbitcoin_util_a-glibc_sanity.o
In file included from compat/glibc_sanity.cpp:12:0:
compat/glibc_sanity.cpp: In function 'bool {anonymous}::sanity_test_fdelt()':
compat/glibc_sanity.cpp:53:5: error: 'memset' was not declared in this scope
FD_ZERO(&fds);
^
Makefile:6248: recipe for target 'compat/libbitcoin_util_a-glibc_sanity.o' failed
make[2]: *** [compat/libbitcoin_util_a-glibc_sanity.o] Error 1
make[2]: Leaving directory '/opt/local/src/bitcoin/src'
Makefile:9824: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/opt/local/src/bitcoin/src'
Makefile:757: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

Shall I open this as a new issue?

@stacepellegrino
Copy link

stacepellegrino commented Jul 1, 2018

Checking for type char equals int8_t fixed.

Opened a new build issue #13581

AC_MSG_CHECKING(for if type char equals int8_t)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdint.h>
#include <type_traits>]],
[[ static_assert(std::is_same<int8_t, char>::value, ""); ]])],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: may as well provide a message for the static_assert?

@Empact
Copy link
Contributor

Empact commented Jul 1, 2018

utACK 49d1f4c

Copy link
Contributor

@jb55 jb55 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 49d1f4c

@laanwj
Copy link
Member

laanwj commented Jul 4, 2018

Can someone please explain why this is needed? I've been compiling bitcoin core on platforms that have char=uint8_t (such as ARM) as well as char=int8_t (such as x86) for years without needing any special define logic for this. What is different on this platform?

@laanwj laanwj requested a review from theuni July 4, 2018 09:43
@luke-jr
Copy link
Member

luke-jr commented Jul 4, 2018

Apparently ARM and x86 have int8_t = signed char, whereas SunOS has int8_t = char?

@laanwj
Copy link
Member

laanwj commented Jul 5, 2018

Thanks @luke-jr, I understand then.
utACK 49d1f4c

@@ -189,7 +189,9 @@ template<typename X> const X& ReadWriteAsHelper(const X& x) { return x; }
SerializationOp(s, CSerActionUnserialize()); \
}

#ifndef CHAR_EQUALS_INT8
template<typename Stream> inline void Serialize(Stream& s, char a ) { ser_writedata8(s, a); } // TODO Get rid of bare char
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the TODO here - not sure its still the goal, certainly not in this PR, would have to carefully consider the consequences for serialization.

@laanwj laanwj merged commit 49d1f4c into bitcoin:master Jul 5, 2018
laanwj added a commit that referenced this pull request Jul 5, 2018
49d1f4c Detect if char equals int8_t (Chun Kuan Lee)

Pull request description:

  Probably fixes #13576. I'm not able to test this. @stacepellegrino, can you test this?

Tree-SHA512: b750e00e11e6b6f6341fec668ec2254cc101c8ebdd4878f320d6cb3b07cf326761146e4ceff0b6405b7e503ff64c093a8274bd524a097e2c49382dc296972c4f
@ken2812221 ken2812221 deleted the int8_t-char-is_same branch July 5, 2018 11:39
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 7, 2020
49d1f4c Detect if char equals int8_t (Chun Kuan Lee)

Pull request description:

  Probably fixes bitcoin#13576. I'm not able to test this. @stacepellegrino, can you test this?

Tree-SHA512: b750e00e11e6b6f6341fec668ec2254cc101c8ebdd4878f320d6cb3b07cf326761146e4ceff0b6405b7e503ff64c093a8274bd524a097e2c49382dc296972c4f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 7, 2020
49d1f4c Detect if char equals int8_t (Chun Kuan Lee)

Pull request description:

  Probably fixes bitcoin#13576. I'm not able to test this. @stacepellegrino, can you test this?

Tree-SHA512: b750e00e11e6b6f6341fec668ec2254cc101c8ebdd4878f320d6cb3b07cf326761146e4ceff0b6405b7e503ff64c093a8274bd524a097e2c49382dc296972c4f
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 8, 2020
49d1f4c Detect if char equals int8_t (Chun Kuan Lee)

Pull request description:

  Probably fixes bitcoin#13576. I'm not able to test this. @stacepellegrino, can you test this?

Tree-SHA512: b750e00e11e6b6f6341fec668ec2254cc101c8ebdd4878f320d6cb3b07cf326761146e4ceff0b6405b7e503ff64c093a8274bd524a097e2c49382dc296972c4f
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 26, 2021
49d1f4c Detect if char equals int8_t (Chun Kuan Lee)

Pull request description:

  Probably fixes bitcoin#13576. I'm not able to test this. @stacepellegrino, can you test this?

Tree-SHA512: b750e00e11e6b6f6341fec668ec2254cc101c8ebdd4878f320d6cb3b07cf326761146e4ceff0b6405b7e503ff64c093a8274bd524a097e2c49382dc296972c4f
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't compile bitcoin for SmartOS - recipe for target 'consensus/libbitcoinconsensus_la-merkle.lo' failed
7 participants