mastercoin-MSC / mastercore

mastercore info
mastercoin.org
MIT License
24 stars 11 forks source link

UINT64_C is not portable #231

Closed m21 closed 9 years ago

m21 commented 9 years ago

Mainly for @dexX7 , can't compile on Linux32:

mastercore_rounduint64_tests.cpp: In member function ‘void mastercore_rounduint64_tests::mastercore_rounduint64_simple::test_method()’: mastercore_rounduint64_tests.cpp:15:1: error: ‘UINT64_C’ was not declared in this scope

zathras-crypto commented 9 years ago

What about if you configure with CXXFLAGS=-D__STDC_CONSTANT_MACROS?

dexX7 commented 9 years ago

Hm interesting. I actually assumed it should be available, given that stdint.h is a standard library, but I'm not sure about details.

dexX7 commented 9 years ago

So UINT64_C is basically just a macro to add a literal to a number:

# if __WORDSIZE == 64
#  define UINT64_C(c)   c ## UL
# else
#  define UINT64_C(c)   c ## ULL
# endif

The goal of using UINT64_C in this those tests was to provide very accurate results to compare against, namely uint64_t typed numbers and nothing else, but something similar can be achieved by explicit casts.

But it's an interesting topic. Is providing 32 bit ready code a goal at the moment? It would be very nice, if there were auto tests for all plattforms, similar to https://travis-ci.org/bitcoin/bitcoin/. I'm aware of @msgilligan's Jenkins setup, but unsure, if it's fully capable or even operational at the moment.

dexX7 commented 9 years ago

Can you try #232?

msgilligan commented 9 years ago

Jenkins is operational and I just finished adding support for doing builds from the "stable" (0.0.8) branch and an "integration" (0.0.9) branch and parameterizing the consensus and regtest functional tests. It's on a 64-bit Debian OS so I assume the builds are 64-bit. It should be possible to parameterize the build job and build both 32 and 64-bit versions.

The current build commands, which you should be able to see in action in the Console Output of the last build, are as follows:

./autogen.sh
./configure
make
./src/test/test_bitcoin --log_format=XML --log_sink=test_bitcoin.xml --log_level=test_suite --report_level=no

Are there parameters to configure or make that can generate a 32-bit build (and also run the Boost unit tests in 32-bit mode)?

dexX7 commented 9 years ago

Ah, thanks for the info @msgilligan: in theory it should be possible, but I'm not very familiar with the whole build chain. Also see my comment here: https://github.com/mastercoin-MSC/mastercore/pull/232#issuecomment-66626377

Building via Gitian as 32 bit version worked for me, but I was unable to test correctness, for once due to the lack of unit tests and second because I have no 32 bit system to test with. I could try to go the Gitian route to get a 32 bit build for Ubuntu and then run the regtests there.

dexX7 commented 9 years ago

@m21: fixed via #232.