This is the multi-page printable view of this section. .
Developers
- 1: Development
1 - Development
Set up development environment
You can set up development environment simply using envd. It will create a docker container and install all the dependencies for you.
Or you can setup development environment following these steps manually:
- Install base dependency.
- Install
clang-16. Other versions ofclangare not supported.
- Install Rust. Do not install
rustcusing a package manager.
- Clone the Repository.
- Install
cargo-pgrx.
cargo-pgrx is a helpful tool to develop a PostgreSQL extension. You can read the document in https://docs.rs/crate/cargo-pgrx/latest.
Cross compilation
Assuming that you build binary and schema for aarch64 target in x86_64 host environment, you can follow these steps:
- Install cross compilation toolchain.
Set environment variables.
Set emulator, linker and sysroot for Rust by adding the following section to the end of ~/.cargo/config.toml.
- Generate PostgreSQL header files on target architecture. It can be done with
cargo-pgrxand you can also take advantages of files undervendor/pgrx_configandvendor/pgrx_binding. For details, please refer to the documentation ofpgrx.
Debug
Debug information included in the compiled binary even in release mode so you can always use gdb for debugging.
For a debug build, backtrace is printed when a thread in background worker process panics, but not for a session process error. For a release build, backtrace is never printed. But if you set environment variable RUST_BACKTRACE to 1, all backtraces are printed. It’s recommended for you to debug a release build with the command RUST_BACKTRACE=1 cargo pgrx run --release.