🌐 AI搜索 & 代理 主页
Skip to content

Commit 44260e2

Browse files
authored
fix pgml conflicts with plpython (#931)
1 parent dd722c8 commit 44260e2

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

.github/workflows/ubuntu-packages-and-docker-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
libpython3.10-dev \
8989
python3.10-dev \
9090
ruby \
91-
mold
91+
lld
9292
9393
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
9494
sudo gem install deb-s3-0.11.4.gem

pgml-dashboard/content/docs/guides/setup/v2/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ postgresql-server-dev-${POSTGRES_VERSION}
278278
python3
279279
python3-pip
280280
libpython3
281-
mold
281+
lld
282282
```
283283

284284
##### Rust

pgml-extension/.cargo/config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"]
44

55
[target.x86_64-unknown-linux-gnu]
6-
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=/usr/bin/mold"]
6+
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=lld"]
77

88
[target.aarch64-unknown-linux-gnu]
9-
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=/usr/bin/mold"]
9+
rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup,-fuse-ld=lld"]

pgml-extension/build.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,16 @@ fn main() {
44
println!("cargo:rustc-link-search=/opt/homebrew/opt/openblas/lib");
55
println!("cargo:rustc-link-search=/opt/homebrew/opt/libomp/lib");
66
}
7+
8+
// PostgreSQL is using dlopen(RTLD_GLOBAL). this will parse some
9+
// of symbols into the previous opened .so file, but the others will use a
10+
// relative offset in pgml.so, and will cause a null-pointer crash.
11+
//
12+
// hid all symbol to avoid symbol conflicts.
13+
//
14+
// append mode (link-args) only works with clang ld (lld)
15+
println!(
16+
"cargo:link-args=-Wl,--version-script={}/ld.map",
17+
std::env::current_dir().unwrap().to_string_lossy(),
18+
);
719
}

pgml-extension/ld.map

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
global:
3+
Pg_magic_func;
4+
_PG_init;
5+
*_wrapper;
6+
local:
7+
*;
8+
};

0 commit comments

Comments
 (0)