diff --git a/.github/workflows/ubuntu-packages-and-docker-image.yml b/.github/workflows/ubuntu-packages-and-docker-image.yml index 8d8e05f39..a60657e44 100644 --- a/.github/workflows/ubuntu-packages-and-docker-image.yml +++ b/.github/workflows/ubuntu-packages-and-docker-image.yml @@ -88,7 +88,7 @@ jobs: libpython3.10-dev \ python3.10-dev \ ruby \ - mold + lld curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem sudo gem install deb-s3-0.11.4.gem diff --git a/pgml-dashboard/content/docs/guides/setup/v2/installation.md b/pgml-dashboard/content/docs/guides/setup/v2/installation.md index 9fc753db0..dec066ed7 100644 --- a/pgml-dashboard/content/docs/guides/setup/v2/installation.md +++ b/pgml-dashboard/content/docs/guides/setup/v2/installation.md @@ -278,7 +278,7 @@ postgresql-server-dev-${POSTGRES_VERSION} python3 python3-pip libpython3 -mold +lld ``` ##### Rust diff --git a/pgml-extension/.cargo/config b/pgml-extension/.cargo/config index 4739f795d..4eb992743 100644 --- a/pgml-extension/.cargo/config +++ b/pgml-extension/.cargo/config @@ -3,7 +3,7 @@ rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"] [target.x86_64-unknown-linux-gnu] -rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=/usr/bin/mold"] +rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=lld"] [target.aarch64-unknown-linux-gnu] -rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=/usr/bin/mold"] +rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=lld"] diff --git a/pgml-extension/build.rs b/pgml-extension/build.rs index eb180a21c..ae6761a6a 100644 --- a/pgml-extension/build.rs +++ b/pgml-extension/build.rs @@ -4,4 +4,16 @@ fn main() { println!("cargo:rustc-link-search=/opt/homebrew/opt/openblas/lib"); println!("cargo:rustc-link-search=/opt/homebrew/opt/libomp/lib"); } + + // PostgreSQL is using dlopen(RTLD_GLOBAL). this will parse some + // of symbols into the previous opened .so file, but the others will use a + // relative offset in pgml.so, and will cause a null-pointer crash. + // + // hid all symbol to avoid symbol conflicts. + // + // append mode (link-args) only works with clang ld (lld) + println!( + "cargo:link-args=-Wl,--version-script={}/ld.map", + std::env::current_dir().unwrap().to_string_lossy(), + ); } diff --git a/pgml-extension/ld.map b/pgml-extension/ld.map new file mode 100644 index 000000000..930b96e33 --- /dev/null +++ b/pgml-extension/ld.map @@ -0,0 +1,8 @@ +{ +global: + Pg_magic_func; + _PG_init; + *_wrapper; +local: + *; +};
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: