0

pllua モジュールをビルドしようとしていますが、問題が発生しています。

問題は間違った PostgreSQL バージョンにあると思いますが、よくわかりません。誰かが私を助けてくれたらありがたいです。

Postgres の場所: /opt/PostgreSQL/9.3/bin (サポートなしのエンタープライスド バージョンです)

Lua の場所: /opt/myLua (luaDist でビルド)

root@lua:/opt/BootstrapLuaDist/LuaDist/bin# ./luadist /opt/myLua/ list

Installed modules:
==================

  bit32-5.2.0   (Ubuntu-x86_64)  [provided by luajit-2.0.3]
  lua-5.1.5 (Ubuntu-x86_64)  [provided by luajit-2.0.3]
  luaffi-1.0    (Ubuntu-x86_64)  [provided by luajit-2.0.3]
  luafilesystem-1.6.2   (Ubuntu-x86_64)
  luajit-2.0.3  (Ubuntu-x86_64)
  luasocket-3.0-rc1 (Ubuntu-x86_64)
  srlua-5.1 (Ubuntu-x86_64)
  zlib-1.2.6    (Ubuntu-x86_64)

pllua makefile を変更しました。

# Makefile for PL/Lua
# $Id: Makefile,v 1.12 2009/09/20 14:20:48 carvalho Exp $

# Lua specific

# General
#LUAINC = -I/usr/local/include
#LUALIB = -L/usr/local/lib -llua

# LuaJIT
#LUAINC = -I/usr/local/include/luajit-2.0
#LUALIB = -L/usr/local/lib -lluajit-5.1

#myLuaJit 2.0.3
LUAINC= -I/opt/myLua/include
LUALIB = -L/op/myLua/lib -lliblua


# Debian/Ubuntu
#LUAINC = -I/usr/include/lua5.1
#LUALIB = -llua5.1

# Fink
#LUAINC = -I/sw/include -I/sw/include/postgresql
#LUALIB = -L/sw/lib -llua

# Lua for Windows
#LUAINC = -IC:/PROGRA~1/Lua/5.1/include
#LUALIB = -LC:/PROGRA~1/Lua/5.1/lib -llua5.1


# no need to edit below here
MODULE_big = pllua
EXTENSION = pllua
DATA = pllua--1.0.sql
#DATA_built = pllua.sql

REGRESS = plluatest
OBJS = pllua.o plluaapi.o plluaspi.o
PG_CPPFLAGS = $(LUAINC)
SHLIB_LINK = $(LUALIB)

#PG_CONFIG = /usr/local/pgsql/bin/pg_config
PG_CONFIG = /opt/PostgreSQL/9.3/bin/pg_config
#PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

しかし、コンパイルするとエラーと警告が発生します:

root@lua:/opt/pllua-1.0# make
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -I/opt/myLua/include -I. -I. -I/opt/PostgreSQL/9.3/include/postgresql/server -I/opt/PostgreSQL/9.3/include/postgresql/internal -D_GNU_SOURCE -I/opt/local/20140108/fc7f8f12-7861-11e3-aaff-000c29d23b02/include/libxml2  -I/usr/local/include/libxml2 -I/usr/local/include  -c -o pllua.o pllua.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -I/opt/myLua/include -I. -I. -I/opt/PostgreSQL/9.3/include/postgresql/server -I/opt/PostgreSQL/9.3/include/postgresql/internal -D_GNU_SOURCE -I/opt/local/20140108/fc7f8f12-7861-11e3-aaff-000c29d23b02/include/libxml2  -I/usr/local/include/libxml2 -I/usr/local/include  -c -o plluaapi.o plluaapi.c
In file included from plluaapi.c:8:0:
rowstamp.h: In function ‘rowstamp_set’:
rowstamp.h:26:2: warning: implicit declaration of function ‘HeapTupleHeaderGetXmin’ [-Wimplicit-function-declaration]
  stamp->xmin = HeapTupleHeaderGetXmin(tup->t_data);
  ^
plluaapi.c: At top level:
plluaapi.c:41:3: error: unknown type name ‘int2’
   int2 len;
   ^
plluaapi.c: In function ‘luaP_gettypeinfo’:
plluaapi.c:149:5: warning: implicit declaration of function ‘GETSTRUCT’ [-Wimplicit-function-declaration]
     typeinfo = (Form_pg_type) GETSTRUCT(type);
     ^
plluaapi.c:149:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     typeinfo = (Form_pg_type) GETSTRUCT(type);
                ^
plluaapi.c: In function ‘luaP_modinit’:
plluaapi.c:350:11: warning: implicit declaration of function ‘heap_getattr’ [-Wimplicit-function-declaration]
           lua_pushstring(L, text2string(heap_getattr(SPI_tuptable->vals[i],
           ^
plluaapi.c: In function ‘luaP_newfunction’:
plluaapi.c:637:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   procst = (Form_pg_proc) GETSTRUCT(proc);
            ^
plluaapi.c: In function ‘luaP_pusharray’:
plluaapi.c:753:9: warning: implicit declaration of function ‘fetch_att’ [-Wimplicit-function-declaration]
         luaP_pushdatum(L, fetch_att(*p, ti->byval, ti->len), typeelem);
         ^
plluaapi.c:755:9: warning: implicit declaration of function ‘att_addlength_pointer’ [-Wimplicit-function-declaration]
         *p = att_addlength_pointer(*p, ti->len, *p);
         ^
plluaapi.c:755:12: warning: assignment makes pointer from integer without a cast [enabled by default]
         *p = att_addlength_pointer(*p, ti->len, *p);
            ^
plluaapi.c:756:9: warning: implicit declaration of function ‘att_align_nominal’ [-Wimplicit-function-declaration]
         *p = (char *) att_align_nominal(*p, ti->align);
         ^
plluaapi.c:756:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         *p = (char *) att_align_nominal(*p, ti->align);
              ^
plluaapi.c: In function ‘luaP_toarray’:
plluaapi.c:954:13: warning: implicit declaration of function ‘store_att_byval’ [-Wimplicit-function-declaration]
             store_att_byval(*p, PointerGetDatum(v), ti->len);
             ^
plluaapi.c: In function ‘luaP_todatum’:
plluaapi.c:1047:15: warning: implicit declaration of function ‘heap_form_tuple’ [-Wimplicit-function-declaration]
               dat = PointerGetDatum(SPI_returntuple(heap_form_tuple(ti->tupdesc,
               ^
plluaapi.c:1047:15: warning: passing argument 1 of ‘SPI_returntuple’ makes pointer from integer without a cast [enabled by default]
In file included from pllua.h:18:0,
                 from plluaapi.c:7:
/opt/PostgreSQL/9.3/include/postgresql/server/executor/spi.h:113:24: note: expected ‘HeapTuple’ but argument is of type ‘int’
 extern HeapTupleHeader SPI_returntuple(HeapTuple tuple, TupleDesc tupdesc);
                        ^
make: *** [plluaapi.o] Error 1

どうもありがとう

### - アップデート - -

問題を (部分的にのみ) 修正しました。enterprisedb から postgreSQL 9.2 をダウンロードしたところ、コンパイルは正常に行われ、pllua.so が /opt/PostgreSQL/9.2/lib/postgresql にインストールされました。

実行すると: root@lua:/opt/PostgreSQL/9.2/bin# ./psql -U postgres -p 5435 -c "CREATE EXTENSION pllua" postgres

エラーが発生します:

エラー: ライブラリ "/opt/PostgreSQL/9.2/lib/postgresql/pllua.so" を読み込めませんでした: /opt/PostgreSQL/9.2/lib/postgresql/pllua.so: 未定義のシンボル: luaopen_math

luaopen_math の問題は何ですか? コンパイルの前に luaJit ライブラリをロードする必要があるのでしょうか?

4

2 に答える 2