tcdi/plrust

plrust installation fails when postgres 15 compiled with gprof profiler

Closed this issue · 2 comments

steps followed as per
https://plrust.io/install-plrust.html#trusted-install

postgres@pg:~/plrust/plrust$ rustup default 1.72.0
info: using existing install for '1.72.0-x86_64-unknown-linux-gnu'
info: default toolchain set to '1.72.0-x86_64-unknown-linux-gnu'

  1.72.0-x86_64-unknown-linux-gnu unchanged - rustc 1.72.0 (5680fa18f 2023-08-23)

info: note that the toolchain '1.72.0-x86_64-unknown-linux-gnu' is currently in use (overridden by '/var/lib/postgresql/plrust/rust-toolchain.toml')
postgres@pg:~/plrust/plrust$ rustc -V
rustc 1.72.0 (5680fa18f 2023-08-23)
postgres@pg:~/plrust/plrust$ uname -a
Linux pg 5.15.0-94-generic #104-Ubuntu SMP Tue Jan 9 15:25:40 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

postgres@pg:~$ rustc -V
rustc 1.72.0 (5680fa18f 2023-08-23)

#the final step.
postgres@pg:~/plrust/plrust$ cargo pgrx package --features "pg15 trusted"
       Using PgConfig("pg15") and `pg_config` from /opt/15/usr/local/bin/pg_config
    Building extension with features pg15 trusted
     Running command "/var/lib/postgresql/.rustup/toolchains/1.72.0-x86_64-unknown-linux-gnu/bin/cargo" "build" "--release" "--features" "pg15 trusted" "--no-default-features" "--message-format=json-render-diagnostics"
    Finished release [optimized] target(s) in 0.22s
  Installing extension
     Copying control file to target/release/plrust-pg15/opt/15/usr/local/share/postgresql/extension/plrust.control
     Copying shared library to target/release/plrust-pg15/opt/15/usr/local/lib/postgresql/plrust.so
 Discovering SQL entities
  Discovered 5 SQL entities: 0 schemas (0 unique), 3 functions, 0 types, 0 enums, 2 sqls, 0 ords, 0 hashes, 0 aggregates, 0 triggers
thread '<unnamed>' panicked at 'not implemented: "__gmon_start__" is stubbed and cannot be used right now.', /var/lib/postgresql/.pgrx/postmaster_stubs/opt/15/usr/local/bin/postmaster_stub.rs:69915:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
Aborted (core dumped)


postgres@pg:~/plrust/plrust$ /opt/15/usr/local/bin/pg_config
BINDIR = /opt/15/usr/local/bin
DOCDIR = /opt/15/usr/local/share/doc/postgresql
HTMLDIR = /opt/15/usr/local/share/doc/postgresql
INCLUDEDIR = /opt/15/usr/local/include
PKGINCLUDEDIR = /opt/15/usr/local/include/postgresql
INCLUDEDIR-SERVER = /opt/15/usr/local/include/postgresql/server
LIBDIR = /opt/15/usr/local/lib
PKGLIBDIR = /opt/15/usr/local/lib/postgresql
LOCALEDIR = /opt/15/usr/local/share/locale
MANDIR = /opt/15/usr/local/share/man
SHAREDIR = /opt/15/usr/local/share/postgresql
SYSCONFDIR = /opt/15/usr/local/etc/postgresql
PGXS = /opt/15/usr/local/lib/postgresql/pgxs/src/makefiles/pgxs.mk
CONFIGURE =  '--prefix=/opt/15/usr/local' '--enable-dtrace' '--enable-profiling' '--enable-cassert' '--enable-debug' 'CFLAGS=-ggdb -Og -g3 -fno-omit-frame-pointer'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -g -pg -DLINUX_PROFILE -ggdb -Og -g3 -fno-omit-frame-pointer
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,--as-needed -Wl,-rpath,'/opt/15/usr/local/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgcommon -lpgport -lz -lreadline -lm
VERSION = PostgreSQL 15.5

i guess the core issue is around -pg cflags for postgresql or maybe not, but i used them because i installed a profiler to trace locks. not sure why this flag if at all is messing with the installation, or is it something else.

@cabecada Can you share the RUST_BACKTRACE=1 version of that?

i reinstalled pg. worked fine. thanks