-
Notifications
You must be signed in to change notification settings - Fork 0
Development Tips
I recommend lima for creating VMs.
limactl create --arch=riscv64 --name=riscv64-box --set='.ssh.forwardAgent = true'The enabling of agent forwarding is optional but if you add your ssh key to your agent with ssh-add ~/.ssh/id_ed25519, it means you can commit and push to the git repo directly from the VM.
For amd64 the debian template is good if you'd rather not use ubuntu.
It's not enough to test amd64 using docker with rosetta on a mac as the amd64 kernel is needed for the ptrace calls to work correctly.
Usually inside a debian/ubuntu now the following dependencies are needed
sudo apt install python3-venv python3-dev gcc makeOn riscv64 the latest rustc and cargo can also be installed using rustup in order to build uv for faster package management and venv creation. But it takes a very long time to build!
In order to recompile the C module, the usual and simplest way is running pip install -e . again. This turns out to be rather SLOW! It does a clean build.
I find it helpful to create a GNUmakefile that builds the extension for the current version of python that you are working on
SRC_DIR = src
BUILD_DIR = build/lib.macosx-14-arm64-cpython-38
SO = pymontrace/attacher.cpython-38-darwin.so
.PHONY: all
all: $(SRC_DIR)/$(SO)
#pip uninstall pymontrace --yes
#.venv/bin/python3 setup.py install
#pip install -e .
#sudo -v
#bash -c 'trap "kill 0" EXIT; python3 examples/script_to_debug.py & sleep 1; ./hack/example.sh'
$(SRC_DIR)/$(SO): $(BUILD_DIR)/$(SO)
cp $< $@
$(BUILD_DIR)/$(SO): $(wildcard c_src/*.c)
python3 setup.py build
-include MakefileOne I had going on my linux aarch64 VM
BUILDSUFFIX = linux-aarch64-cpython-311
SOPLAT = cpython-311-aarch64-linux-gnu
BUILD_DIR = build/lib.$(BUILDSUFFIX)
SO = pymontrace/attacher.$(SOPLAT).so
.PHONY: all
all: check src/$(SO)
cc -fsyntax-only -Wall -Werror c_src/attacher_linux_64bit.c
#pip uninstall pymontrace --yes
# pip install -e . --no-index --no-deps
#.venv/bin/python3 setup.py install
src/$(SO): $(BUILD_DIR)/$(SO)
cp $< $@
$(BUILD_DIR)/$(SO): $(wildcard c_src/*.c)
.venv/bin/python3 setup.py build
-include Makefileand the amd64 VM
BUILD_DIR = build/lib.linux-x86_64-cpython-311
SO = pymontrace/attacher.cpython-311-x86_64-linux-gnu.so
SRC_DIR = src
.PHONY: all
all: check $(SRC_DIR)/$(SO)
cc -fsyntax-only -Wall -Werror c_src/attacher_linux_64bit.c
#pip uninstall --yes pymontrace
#python3 setup.py install
#pytest -x
$(SRC_DIR)/$(SO): $(BUILD_DIR)/$(SO)
cp $< $@
$(BUILD_DIR)/$(SO): $(wildcard c_src/*.c)
python3 setup.py build
-include Makefile