microo8 / plgo

easily create postgresql extensions in golang; moved to gitlab.com/microo8/plgo
292 stars 23 forks source link

invalid operation #28

Closed rongfengliang closed 5 years ago

rongfengliang commented 5 years ago

the same as https://github.com/microo8/plgo/issues/19

i hava use go get -u github.com/microo8/plgo/... but can't works

golang version

go version
go version go1.10.4 linux/amd64

postgresql version

with pg_config

VERSION = PostgreSQL 10.7 (Ubuntu 10.7-0ubuntu0.18.04.1)
rongfengliang commented 5 years ago

more info


 Jsonb *jsonb = DatumGetJsonbP(val);
                 ^
# command-line-arguments
/tmp/plgo530731453/pl.go:360:203: invalid operation: (func literal)((*_Ctype_struct_FunctionCallInfoData)(unsafe.Pointer(fcinfo))) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:413:51: invalid operation: _Cfunc_trigger_fired_before(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:418:50: invalid operation: _Cfunc_trigger_fired_after(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:423:52: invalid operation: _Cfunc_trigger_fired_instead(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:428:52: invalid operation: _Cfunc_trigger_fired_for_row(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:433:58: invalid operation: _Cfunc_trigger_fired_for_statement(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:438:54: invalid operation: _Cfunc_trigger_fired_by_insert(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:443:54: invalid operation: _Cfunc_trigger_fired_by_update(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:448:54: invalid operation: _Cfunc_trigger_fired_by_delete(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:453:56: invalid operation: _Cfunc_trigger_fired_by_truncate(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/tmp/plgo530731453/pl.go:453:56: too many errors
Cannot build package: exit status 2
mingjunyang commented 5 years ago

ths same too.

system and software info

Linux 5a821c081d3d 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

go version go1.12.1 linux/amd64

BINDIR = /usr/pgsql-10/bin
DOCDIR = /usr/pgsql-10/doc
HTMLDIR = /usr/pgsql-10/doc/html
INCLUDEDIR = /usr/pgsql-10/include
PKGINCLUDEDIR = /usr/pgsql-10/include
INCLUDEDIR-SERVER = /usr/pgsql-10/include/server
LIBDIR = /usr/pgsql-10/lib
PKGLIBDIR = /usr/pgsql-10/lib
LOCALEDIR = /usr/pgsql-10/share/locale
MANDIR = /usr/pgsql-10/share/man
SHAREDIR = /usr/pgsql-10/share
SYSCONFDIR = /etc/sysconfig/pgsql
PGXS = /usr/pgsql-10/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--enable-rpath' '--prefix=/usr/pgsql-10' '--includedir=/usr/pgsql-10/include' '--mandir=/usr/pgsql-10/share/man' '--datadir=/usr/pgsql-10/share' '--with-icu' '--with-perl' '--with-python' '--with-tcl' '--with-tclconfig=/usr/lib64' '--with-openssl' '--with-pam' '--with-gssapi' '--with-includes=/usr/include' '--with-libraries=/usr/lib64' '--enable-nls' '--enable-dtrace' '--with-uuid=e2fs' '--with-libxml' '--with-libxslt' '--with-ldap' '--with-selinux' '--with-systemd' '--with-system-tzdata=/usr/share/zoneinfo' '--sysconfdir=/etc/sysconfig/pgsql' '--docdir=/usr/pgsql-10/doc' '--htmldir=/usr/pgsql-10/doc/html' 'CFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' 'LDFLAGS=-Wl,--as-needed' 'PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include
CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic
CFLAGS_SL = -fPIC
LDFLAGS = -Wl,--as-needed -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-10/lib',--enable-new-dtags
LDFLAGS_EX = 
LDFLAGS_SL = 
LIBS = -lpgcommon -lpgport -lpthread -lselinux -lxslt -lxml2 -lpam -lssl -lcrypto -lgssapi_krb5 -lz -lreadline -lrt -lcrypt -ldl -lm 
VERSION = PostgreSQL 10.7

gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)

error info

# github.com/microo8/plgo/test/types
/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-785071314/000001.o: In function `elog_notice':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:32: undefined reference to `elog_start'
/tmp/go-link-785071314/000001.o: In function `elog_error':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:36: undefined reference to `elog_start'
/root/go/src/github.com/microo8/plgo/test/types/pl.go:36: undefined reference to `elog_finish'
/tmp/go-link-785071314/000001.o: In function `get_col_as_datum':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:49: undefined reference to `SPI_getbinval'
/tmp/go-link-785071314/000001.o: In function `get_heap_getattr':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:60: undefined reference to `heap_getsysattr'
/root/go/src/github.com/microo8/plgo/test/types/pl.go:60: undefined reference to `nocachegetattr'
/tmp/go-link-785071314/000001.o: In function `array_to_datum':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:129: undefined reference to `palloc0'
/root/go/src/github.com/microo8/plgo/test/types/pl.go:140: undefined reference to `get_typlenbyvalalign'
/root/go/src/github.com/microo8/plgo/test/types/pl.go:141: undefined reference to `construct_md_array'
/tmp/go-link-785071314/000001.o: In function `datum_to_array':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:206: undefined reference to `pg_detoast_datum'
/root/go/src/github.com/microo8/plgo/test/types/pl.go:214: undefined reference to `get_typlenbyvalalign'
/root/go/src/github.com/microo8/plgo/test/types/pl.go:216: undefined reference to `deconstruct_array'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_connect':
/tmp/go-build/cgo-gcc-prolog:51: undefined reference to `SPI_connect'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_execute_plan':
/tmp/go-build/cgo-gcc-prolog:75: undefined reference to `SPI_execute_plan'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_finish':
/tmp/go-build/cgo-gcc-prolog:93: undefined reference to `SPI_finish'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_fname':
/tmp/go-build/cgo-gcc-prolog:113: undefined reference to `SPI_fname'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_gettype':
/tmp/go-build/cgo-gcc-prolog:133: undefined reference to `SPI_gettype'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_gettypeid':
/tmp/go-build/cgo-gcc-prolog:154: undefined reference to `SPI_gettypeid'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_prepare':
/tmp/go-build/cgo-gcc-prolog:175: undefined reference to `SPI_prepare'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_SPI_result_code_string':
/tmp/go-build/cgo-gcc-prolog:194: undefined reference to `SPI_result_code_string'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_get_call_expr_argtype':
/tmp/go-build/cgo-gcc-prolog:634: undefined reference to `get_call_expr_argtype'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_heap_form_tuple':
/tmp/go-build/cgo-gcc-prolog:716: undefined reference to `heap_form_tuple'
/tmp/go-link-785071314/000001.o: In function `elog_notice':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:32: undefined reference to `elog_finish'
/tmp/go-link-785071314/000001.o: In function `cstring_to_datum':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:72: undefined reference to `cstring_to_text'
/tmp/go-link-785071314/000001.o: In function `datum_to_cstring':
/root/go/src/github.com/microo8/plgo/test/types/pl.go:149: undefined reference to `text_to_cstring'
/tmp/go-link-785071314/000001.o: In function `_cgo_ef99b68db014_Cfunc_parseTypeString':
/tmp/go-build/cgo-gcc-prolog:809: undefined reference to `parseTypeString'
collect2: error: ld returned 1 exit status

# github.com/microo8/plgo/test/bgw
/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/tmp/go-link-413882421/000002.o: In function `background_sigterm':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:58: undefined reference to `MyLatch'
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:58: undefined reference to `SetLatch'
/tmp/go-link-413882421/000002.o: In function `background_sighup':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:69: undefined reference to `MyLatch'
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:69: undefined reference to `SetLatch'
/tmp/go-link-413882421/000002.o: In function `elog_log':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:25: undefined reference to `elog_start'
/tmp/go-link-413882421/000002.o: In function `wait_latch':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:30: undefined reference to `MyLatch'
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:30: undefined reference to `WaitLatch'
/tmp/go-link-413882421/000002.o: In function `reset_latch':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:38: undefined reference to `MyLatch'
/tmp/go-link-413882421/000002.o: In function `background_main':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:78: undefined reference to `pqsignal'
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:80: undefined reference to `pqsignal'
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:81: undefined reference to `BackgroundWorkerUnblockSignals'
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:82: undefined reference to `proc_exit'
/tmp/go-link-413882421/000002.o: In function `_PG_init':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:103: undefined reference to `RegisterBackgroundWorker'
/tmp/go-link-413882421/000002.o: In function `elog_log':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:25: undefined reference to `elog_finish'
/tmp/go-link-413882421/000002.o: In function `reset_latch':
/root/go/src/github.com/microo8/plgo/test/bgw/bdw.go:38: undefined reference to `ResetLatch'
collect2: error: ld returned 1 exit status

# github.com/microo8/plgo
/root/go/src/github.com/microo8/plgo/pl.go: In function ‘jsonb_to_datum’:
/root/go/src/github.com/microo8/plgo/pl.go:149:17: warning: implicit declaration of function ‘DatumGetJsonbP’; did you mean ‘DatumGetJsonb’? [-Wimplicit-function-declaration]
  return (Datum) DatumGetJsonbP(DirectFunctionCall1(jsonb_in, (Datum) (char *) val));
                 ^~~~~~~~~~~~~~
                 DatumGetJsonb
/root/go/src/github.com/microo8/plgo/pl.go: In function ‘datum_to_jsonb_cstring’:
/root/go/src/github.com/microo8/plgo/pl.go:236:17: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
  Jsonb *jsonb = DatumGetJsonbP(val);
                 ^~~~~~~~~~~~~~
# github.com/microo8/plgo
/root/go/src/github.com/microo8/plgo/pl.go:357:161: invalid operation: (func literal)() == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:410:44: invalid operation: _Cfunc_trigger_fired_before(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:415:43: invalid operation: _Cfunc_trigger_fired_after(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:420:45: invalid operation: _Cfunc_trigger_fired_instead(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:425:45: invalid operation: _Cfunc_trigger_fired_for_row(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:430:51: invalid operation: _Cfunc_trigger_fired_for_statement(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:435:47: invalid operation: _Cfunc_trigger_fired_by_insert(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:440:47: invalid operation: _Cfunc_trigger_fired_by_update(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:445:47: invalid operation: _Cfunc_trigger_fired_by_delete(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:450:49: invalid operation: _Cfunc_trigger_fired_by_truncate(td.tgEvent) == _Ctype__Bool(true) (mismatched types _Ctype_char and _Ctype__Bool)
/root/go/src/github.com/microo8/plgo/pl.go:450:49: too many errors
rongfengliang commented 5 years ago

@mingjunyang master branch it's ok for pg 11 && git checkout efae75298155d8f66a9c28a788e4def50916c061 may be works for pg10 i have't do some test

rongfengliang commented 5 years ago

@mingjunyang it works for pg10 with git checkout efae75298155d8f66a9c28a788e4def50916c061

mingjunyang commented 5 years ago

thx !