apache / apache/pulsar-client-cpp

[Bug] Build fails on 32-bit platforms: overflow in expression; result is -64771072 with type 'long'

Open
#449 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
71
Forks
90
Avg merge
2h 33m
Merged PRs (30d)
3

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar-client-cpp/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?

[log](https://pkg-status.freebsd.org/beefy17/data/main-i386-default/pe65c3d3818f0_s74f6ec6fe3c/logs/pulsar-client-cpp-3.6.0.log)

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Research direction

Start with lib/ClientConfigurationImpl.h at the operationTimeout initializer on line 33 and review the linked FreeBSD 32-bit build log. Verify the correction by building pulsar-client-cpp 3.6.0 on a 32-bit platform and confirming the integer-overflow error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.