On Macintosh, to allow some symbols to go unlinked, it is necessary to pass -C link-args='-Wl,-undefined,dynamic_lookup'
to the Rust compiler. One needs to do this when building Postgres plugins, because some of the Postgres intrinsics are only compiled into the Postgres server, and not available for linking from shared libs.
At present, the project's process is as follows:
cargo build -v
.rustc
is copied and -C link-args='-Wl,-undefined,dynamic_lookup'
added to it.This seems like a hard sell for automation. What options are available for adding codegen flags to Rust builds through cargo
?
Placing a file named build.rs in the root of a package will cause Cargo to compile that script and execute it just before building the package.
You'll only compile in release mode once, but you'll run the compiled program many times, so release mode trades longer compile time for code that runs faster. That is why the default opt-level for the release profile is 3 .
Cargo stores the output of a build into the "target" directory. By default, this is the directory named target in the root of your workspace. To change the location, you can set the CARGO_TARGET_DIR environment variable, the build. target-dir config value, or the --target-dir command-line flag.
Cargo. toml is the manifest file for Rust's package manager, cargo . This file contains metadata such as name, version, and dependencies for packages, which are call "crates" in Rust.
cargo
provides rustc
command which allows one to pass arbitrary compiler flags. The following should do it:
% cargo rustc -- -C link-args='-Wl,-undefined,dynamic_lookup'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With