From: | Abhishek Chanda <rony358(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Missing PG_MODULE_MAGIC error |
Date: | 2024-04-22 03:18:53 |
Message-ID: | CAHmZhzFQ2=kH=_6ojHKLONi5UJoe5sTDEdHGJDRUyu7quEwLNw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
I am trying to test an extension that links to rocksdb. When I try to load
it in postgres, it complains "missing magic block" while I do
have PG_MODULE_MAGIC in my src. Here is a minimal repro
// pgtam.c
#include "postgres.h"
#include <assert.h>
#include "fmgr.h"
#include "access/tableam.h"
#include "access/heapam.h"
#include "nodes/execnodes.h"
#include "catalog/index.h"
#include "commands/vacuum.h"
#include "utils/builtins.h"
#include "executor/tuptable.h"
#include "rocksdb/c.h"
PG_MODULE_MAGIC;
// Makefile
MODULE_big = pgtam
EXTENSION = pgtam
DATA = pgtam--0.0.1.sql
PG_CPPFLAGS += -L/usr/local/lib -g
SHLIB_LINK += -L/usr/local/lib -lrocksdb
PG_CONFIG = /usr/local/pgsql/bin/pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
// extension build
╰─$ make clean && make && sudo make install
rm -f pgtam.dylib libpgtam.a libpgtam.pc
gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Werror=vla
-Werror=unguarded-availability-new -Wendif-labels
-Wmissing-format-attribute -Wcast-function-type -Wformat-security
-fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument
-Wno-compound-token-split-by-macro -g -ggdb -Og -g3 -fno-omit-frame-pointer
-fvisibility=hidden -bundle -o pgtam.dylib -L/usr/local/pgsql/lib
-isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk
-Wl,-dead_strip_dylibs -fvisibility=hidden -L/usr/local/lib -lrocksdb
-bundle_loader /usr/local/pgsql/bin/postgres
/opt/homebrew/bin/gmkdir -p '/usr/local/pgsql/lib'
/opt/homebrew/bin/gmkdir -p '/usr/local/pgsql/share/extension'
/opt/homebrew/bin/gmkdir -p '/usr/local/pgsql/share/extension'
/opt/homebrew/bin/ginstall -c -m 755 pgtam.dylib
'/usr/local/pgsql/lib/pgtam.dylib'
/opt/homebrew/bin/ginstall -c -m 644 .//pgtam.control
'/usr/local/pgsql/share/extension/'
/opt/homebrew/bin/ginstall -c -m 644 .//pgtam--0.0.1.sql
'/usr/local/pgsql/share/extension/'
Postgres build: cloned and built at SHA
849172ff4883d44168f96f39d3fde96d0aa34c99
╰─$ /usr/local/pgsql/bin/pg_ctl -D test-db -l logfile restart
waiting for server to shut down.... done
server stopped
waiting for server to start.... done
server started
╭─~/src/postgres ‹849172ff48●›
╰─$ /usr/local/pgsql/bin/psql postgres
psql (17devel)
Type "help" for help.
postgres=# CREATE EXTENSION pgtam;
ERROR: incompatible library "/usr/local/pgsql/lib/pgtam.dylib": missing
magic block
HINT: Extension libraries are required to use the PG_MODULE_MAGIC macro.
What am I missing?
From | Date | Subject | |
---|---|---|---|
Next Message | Saksham Joshi | 2024-04-22 05:10:24 | Re: Not able to grant access on pg_signal_backend on azure flexible server |
Previous Message | Ron Johnson | 2024-04-22 02:50:46 | Re: CLUSTER vs. VACUUM FULL |