-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to build on PPC64 #3826
Comments
Are you on big endian or little endian? |
Big Endian. CPU info:
|
Would it be possible to white list those platforms that support |
Yeah I think there's far too much dependency on little-endian math scattered throughout the code. Feel free to track all occurrences down and submit patches to fix them. |
I created a pull request for the modified CMakeLists. |
Thanks. Why is it needed to set the |
-mcpu=native for some reason fails with G5 or ppc970 gcc, so I just set it manually to the lowest common denominator, a G4 for 32 bit, G5 for 64 bit and Power8 for 64 bit little endian. |
See: A lot of the math in there is LE dependent. |
Also, the crypto implementations in the src/crypto directory are the x86 implementations, for example, chacha has a different implementation for PowerPC: https://cr.yp.to/chacha.html. |
Is it any better nowadays ? That particular thing got fixed a while ago. |
Monero is endian agnostic now? I haven't booted my power mac in a while, so I havent tested anything. |
Well, we won't know for sure until someone reports another problem :) |
Just compiled latest git, monerod fails all handshakes and monero-wallet-cli creates invalid keys and is unable to open valid wallets. |
Can you start with unit_tests please ? |
And crypto tests. "make release-test" should run them all. |
This is the output: 47% tests passed, 8 tests failed out of 15 Total Test time (real) = 7919.46 sec The following tests FAILED: The exceptions are because I killed the tests that were taking too long. |
Can you please run and attach the output of these two commands: ./build/Linux/master/release/tests/crypto/cncrypto-tests tests/crypto/tests.txt |
Ok, done. |
Are you running with commit hash aa1d321 ? |
The short HEAD outputs 5c85da5, I cloned the repo yesterday. |
The main problem seems to be Keccak being wrong. Which is a shame since the last change to Keccak was to allegedly make it work on big endian architectures :) |
As for the IP errors, this should fix it: diff --git a/contrib/epee/include/net/local_ip.h b/contrib/epee/include/net/local_ip.h index 52c5855b9..90e6a07b0 100644 --- a/contrib/epee/include/net/local_ip.h +++ b/contrib/epee/include/net/local_ip.h @@ -27,6 +27,15 @@ #pragma once +namespace +{ + static inline uint32_t leip(uint32_t x) + { + x = ((x & 0x00ff00ff) << 8) | ((x & 0xff00ff00) >> 8); + return (x << 16) | (x >> 16); + } +} + namespace epee { namespace net_utils @@ -34,6 +43,7 @@ namespace epee inline bool is_ip_local(uint32_t ip) { + ip = leip(ip); /* local ip area 10.0.0.0 <97> 10.255.255.255 @@ -57,6 +67,7 @@ namespace epee inline bool is_ip_loopback(uint32_t ip) { + ip = leip(ip); if( (ip | 0xffffff00) == 0xffffff7f) return true; //MAKE_IP |
This might fix the keccak part (edited, needs more parentheses): diff --git a/src/crypto/keccak.c b/src/crypto/keccak.c index b5946036e..ee20adb2d 100644 --- a/src/crypto/keccak.c +++ b/src/crypto/keccak.c @@ -145,7 +145,7 @@ void keccak1600(const uint8_t *in, size_t inlen, uint8_t *md) #define IS_ALIGNED_64(p) (0 == (7 & ((const char*)(p) - (const char*)0))) #define KECCAK_PROCESS_BLOCK(st, block) { \ for (int i_ = 0; i_ < KECCAK_WORDS; i_++){ \ - ((st))[i_] ^= ((block))[i_]; \ + ((st))[i_] ^= swap64le(((block))[i_]); \ }; \ keccakf(st, KECCAK_ROUNDS); } |
The IP stuff is wrong, the IPs should be in network byte order. If they're not, then somhting else is probably wrong. |
Or maybe not. That will need thinking. |
The patches didnt change much. Test project /home/jribeiro/Development/monero/build/Linux/master/release |
Well, you're going to have to debug it I'm afraid, or wait for someone else with big endian hardware to have a look. Since it was recently "fixed" for big endian, it should be mostly there already. |
I have zero knowledge of how monero works, what should I look into first? |
Since the (primary) culprit seems to be Keccak, you don't need to know how monero works, just how to build it. The Keccak output for a given input should indeed be identical on big and little endian archs. I suspect once Keccak's fixed, a lot of stuff will start working. We can then see what's next in line. |
Here is the failing core_tests log (Ubuntu 16 PowerPC BE 32bit). |
core_tests also gets stuck in Fedora 25 ppc64. |
Core tests passes completely when using llvm3.9 on fedora 25 and llvm (clang) 7.0 in gentoo, looks like gcc is buggy for ppc64 lol First log is for gentoo in release, second for fedora in debug, looks like at the end there is a double free error, but everything passes for core_tests. core_tests_llvm7_release.log.gz |
And now... does it sync the blockchain ? :) |
Nope, its not syncing. |
New bitmonero log after 4866 |
It fixes values read/written from/to the network differently on little endian and big endian archs. |
And I see at least another one that needs fixing. |
I updated 4866, |
New log |
I found more places that need endian fixing. I'll post when I've fixed all I see. |
4866 updated again. |
New log, also unit_tests is getting stuck after mnemonics test, core_tests passes. |
We can receive packet :) |
Will this bug be fixed? I'm willing to provide ssh access to a machine for testing. |
I can debug as a background task if I have access to such a machine. |
Post a ssh public key, I can give you access to my G5 with gentoo. It has clang-8 and gcc-8.2. |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDEGd0x3Tkn/Ht1gKZlQY2T0oEpPEenGGPqzPMHMvHJ8S/PLbkVAFfNLDuBdshnm3r/4eMYspBO8/Pa55ICrURwhLk/aQ5vuNwvoReSib5omItheNM5ALWZpVfNTBZct1raryBIaDOUn9SvfLhZzhKojRSrFF4P5Nitn4aMjcGiKklIdFluQ0cIOmA4yY2DY8x6NPECVtPsJrwc89CMlPtlXNd8TgAWy8PvEQb7H9T6XaW4Mn1fGwT52+70q/Eyo4iNrGuLx74obvtAd3nCugTJykE1dXIiQQ3FtmtPqZCOQfaAVteKWvUPWYs4yc+b7LCqf06YvFhw+FfkS04F0gV user@host |
You should have access now. |
PPC64le (little endian) is failing some tests: I couldnt find the .log for the wide-difficulty test, what is the filename? |
hash-slow-2 and hash-slow-4 are failing in big endian ppc64 |
It should all be in LastTest.log |
Thanks much for the G5 access. The patch above fixes most issues. There's still a failure in serialization unit tests, which I think is due to using boost code that's not endianness nice (not 100% sure). I think all the rest is fixed (but it takes massive amounts of time to build/test on that G5 so I've not run a full test run). |
The serialization test failure is now also fixed, same PR. |
Monero and wallet are fully syncing and working on your PR, tested on my G5 and on a newer power8 in be mode! monerodevs@nerv-la.ddns.net:1234 <- BE Fedora 27, 6 threads 8gb ram |
Thanks, I'll try to go build/test from time to time and fix any problems. |
Seems resolved. |
Seems like this is the cause:
Full log: https://kojipkgs.fedoraproject.org//work/tasks/3387/27023387/build.log
The text was updated successfully, but these errors were encountered: