Skip to content
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

Compilation failed in a project using RandomX #277

Closed
LithiumTins opened this issue Oct 9, 2023 · 3 comments
Closed

Compilation failed in a project using RandomX #277

LithiumTins opened this issue Oct 9, 2023 · 3 comments

Comments

@LithiumTins
Copy link

I encountered a problem when compiling a project that uses RandomX. One of the files, which includes 'intrin_portable.h', fails to compile due to '-Werror=cast-qual'. Here is the relevant code.

FORCE_INLINE rx_vec_f128 rx_cvt_packed_int_vec_f128(const void* addr) {
rx_vec_f128 x;
x.lo = (double)unsigned32ToSigned2sCompl(load32((uint8_t*)addr + 0));
x.hi = (double)unsigned32ToSigned2sCompl(load32((uint8_t*)addr + 4));
return x;
}

It seems that casting 'addr' to the 'uint8_t*' cause this error. However, the function load32() accepts a parameter of type 'const uint8_t *'.
static FORCE_INLINE uint32_t load32(const void *src) {

I just wonder whether it would be fine to cast 'addr' to 'const uint8_t *' instead of 'uint8_t *', for example,

x.lo = (double)unsigned32ToSigned2sCompl(load32((const uint8_t*)addr + 0)); 
@SChernykh
Copy link
Collaborator

Yes, it's totally fine. I even fixed it in my P2Pool branch: SChernykh@7167cf1
You can make a pull request here - I didn't make it because it didn't affect anyone else.

@LithiumTins
Copy link
Author

Yes, it's totally fine. I even fixed it in my P2Pool branch: SChernykh@7167cf1 You can make a pull request here - I didn't make it because it didn't affect anyone else.

Actually I just met the problem when I tried to build the archlinux package of your P2Pool from on RISCV64 :)
It seems you've fixed this on aarch64 part,would you mind fix this on other parts of intrin_portable.h?

@SChernykh
Copy link
Collaborator

Ok, I fixed it in P2Pool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants