Skip to content

Commit 96efab3

Browse files
authored
fix(test): Find librdkafka on Apple M1 (#1204)
Uses `brew --prefix` to locate `librdkafka` on macOS ARM builds. The homebrew location differs on ARM and puts libraries in a non-standard location. There is a similar workaround in the sentry development environment, except that it writes exports to the zshrc / bashrc files.
1 parent 8cde3a1 commit 96efab3

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,19 @@ clean-target-dir:
144144

145145
.venv/bin/python: Makefile
146146
rm -rf .venv
147+
147148
@# --copies is necessary because OS X make checks the mtime of the symlink
148149
@# target (/usr/local/bin/python), which is always much older than the
149150
@# Makefile, and then proceeds to unconditionally rebuild the venv.
150151
$$RELAY_PYTHON_VERSION -m venv --copies .venv
152+
.venv/bin/pip install -U pip wheel
153+
154+
@# Work around https://github.com/confluentinc/confluent-kafka-python/issues/1190
155+
if [ "$$(uname -sm)" = "Darwin arm64" ]; then \
156+
echo "Using 'librdkafka' from homebrew to build confluent-kafka"; \
157+
export C_INCLUDE_PATH="$$(brew --prefix librdkafka)/include"; \
158+
export LIBRARY_PATH="$$(brew --prefix librdkafka)/lib"; \
159+
fi; \
151160
.venv/bin/pip install -U -r requirements-dev.txt
152161

153162
.git/hooks/pre-commit:

README.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ workspace with multiple features, so when running building or running tests
3939
always make sure to pass the `--all` and `--all-features` flags.
4040
The `processing` feature additionally requires a C compiler and CMake.
4141

42+
To install the development environment, librdkafka must be installed and on the
43+
path. On macOS, we require to install it with `brew install librdkafka`, as the installation script uses `brew --prefix` to determine the correct location.
44+
4245
We use VSCode for development. This repository contains settings files
4346
configuring code style, linters, and useful features. When opening the project
4447
for the first time, make sure to _install the Recommended Extensions_, as they
@@ -55,9 +58,10 @@ development:
5558
also performed in CI.
5659
- `make clean`: Removes all build artifacts, the virtualenv and cached files.
5760

58-
For a lot of tests you will need Redis and Kafka running in their respective
59-
default configuration. `sentry devservices` from
60-
[sentry](https://github.com/getsentry/sentry) does this for you.
61+
Integration tests require Redis and Kafka running in their default
62+
configuration. The most convenient way to get all required services is via
63+
[`sentry devservices`](https://develop.sentry.dev/services/devservices/), which
64+
requires an up-to-date Sentry development environment.
6165

6266
### Building and Running
6367

0 commit comments

Comments
 (0)