pulsar-client-cpp
pulsar-client-cpp copied to clipboard
[Bug] Build fails on 32-bit platforms: overflow in expression; result is -64771072 with type 'long'
Search before asking
- [X] I searched in the issues and found nothing similar.
Version
3.6.0
Minimal reproduce step
build on 32-bit platform
What did you expect to see?
n/a
What did you see instead?
In file included from /wrkdirs/usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/ClientConfiguration.cc:22:
/wrkdirs/usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/ClientConfigurationImpl.h:33:65: error: overflow in expression; result is -64771072 with type 'long' [-Werror,-Winteger-overflow]
33 | std::chrono::nanoseconds operationTimeout{30L * 1000 * 1000 * 1000};
| ~~~~~~~~~~~~~~~~~~^~~~~~
/wrkdirs/usr/ports/net-p2p/pulsar-client-cpp/work/pulsar-client-cpp-3.6.0/lib/ClientConfigurationImpl.h:33:65: error: overflow in expression; result is -64771072 with type 'long' [-Werror,-Winteger-overflow]
33 | std::chrono::nanoseconds operationTimeout{30L * 1000 * 1000 * 1000};
| ~~~~~~~~~~~~~~~~~~^~~~~~
2 errors generated.
Anything else?
Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
build on 32-bit platform
@yurivict what hardware are you targeting?
On FreeBSD we run 32 builds for i386 and arm7. i386 binaries can also run on 64-bit systems on FreeBSD and Linux. This isn't particularly practical, but this is done in part to catch bugs this these.
I think we should not use long here because long is not portable. We should use unsigned long long or the types from stdint.h