[prev in list] [next in list] [prev in thread] [next in thread]
List: postgresql-general
Subject: Missing PG_MODULE_MAGIC error
From: Abhishek Chanda <rony358 () gmail ! com>
Date: 2024-04-22 3:18:53
Message-ID: CAHmZhzFQ2=kH=_6ojHKLONi5UJoe5sTDEdHGJDRUyu7quEwLNw () mail ! gmail ! com
[Download RAW message or body]
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?
[Attachment #3 (text/html)]
<div dir="ltr">Hi all,<div><br></div><div>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</div><div><br></div><div>// pgtam.c</div><div>#include \
"postgres.h"<br>#include <assert.h><br>#include \
"fmgr.h"<br>#include "access/tableam.h"<br>#include \
"access/heapam.h"<br>#include "nodes/execnodes.h"<br>#include \
"catalog/index.h"<br>#include "commands/vacuum.h"<br>#include \
"utils/builtins.h"<br>#include \
"executor/tuptable.h"<br><br>#include \
"rocksdb/c.h"<br><br>PG_MODULE_MAGIC;<br></div><div><br></div><div>// \
Makefile</div><div>MODULE_big = pgtam<br>EXTENSION = pgtam<br>DATA = \
pgtam--0.0.1.sql<br><br>PG_CPPFLAGS += -L/usr/local/lib -g<br>SHLIB_LINK += \
-L/usr/local/lib -lrocksdb<br><br>PG_CONFIG = /usr/local/pgsql/bin/pg_config<br>PGXS \
:= $(shell $(PG_CONFIG) --pgxs)<br>include $(PGXS)<br></div><div><br></div><div>// \
extension build</div><div>╰─$ make clean && make && sudo make \
install<br>rm -f pgtam.dylib libpgtam.a libpgtam.pc<br>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<br>/opt/homebrew/bin/gmkdir -p \
'/usr/local/pgsql/lib'<br>/opt/homebrew/bin/gmkdir -p \
'/usr/local/pgsql/share/extension'<br>/opt/homebrew/bin/gmkdir -p \
'/usr/local/pgsql/share/extension'<br>/opt/homebrew/bin/ginstall -c -m 755 \
pgtam.dylib '/usr/local/pgsql/lib/pgtam.dylib'<br>/opt/homebrew/bin/ginstall \
-c -m 644 .//pgtam.control \
'/usr/local/pgsql/share/extension/'<br>/opt/homebrew/bin/ginstall -c -m 644 \
.//pgtam--0.0.1.sql \
'/usr/local/pgsql/share/extension/'<br></div><div><br></div><div>Postgres \
build: cloned and built at SHA \
849172ff4883d44168f96f39d3fde96d0aa34c99</div><div><br></div><div>╰─$ \
/usr/local/pgsql/bin/pg_ctl -D test-db -l logfile restart<br>waiting for server to \
shut down.... done<br>server stopped<br>waiting for server to start.... \
done<br>server started \
<br>╭─~/src/postgres ‹849172ff48●›<br>╰─$ /usr/local/pgsql/bin/psql \
postgres<br>psql (17devel)<br>Type "help" for help.<br><br>postgres=# \
CREATE EXTENSION pgtam;<br>ERROR: incompatible library \
"/usr/local/pgsql/lib/pgtam.dylib": missing magic block<br>HINT: \
Extension libraries are required to use the PG_MODULE_MAGIC \
macro.<br></div><div><br></div><div>What am I missing?</div></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic