microo8 / plgo

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

There is no rule for building the target “sample.bc” required for “all”. Stop #29

Closed biter777 closed 4 years ago

biter777 commented 5 years ago

There is no rule for building the target “sample.bc” required for “all”. Stop Pls help

$ cd build
$ sudo make install

make: *** There is no rule for building the target “sample.bc” required for “all”. Stop.

PostgreSQL: PostgreSQL 11.2 (Ubuntu 11.2-1.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0, 64-bit

Go: go1.12.2 linux/amd64

Linux: Ubuntu 18.04.2 LTS

GCC: gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

G++: g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

Makefile:

EXTENSION = sample
DATA = sample--0.1.sql  # script files to install
# REGRESS = sample_test     # our test script file (without extension)
MODULES = sample          # our c module file to build

# postgres build stuff
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
microo8 commented 5 years ago

Can I see your code? It builds? sample.so is in the build dir?

biter777 commented 5 years ago

Of course. See below... On pg10 no problem, but on pg11 it swears at the absence of a .bc file. And if I install the extension myself on pg11, it works.

On the 'build' dir I have: Makefile sample.control sample.h sample.so sample--0.1.sql

Code:

package main

import (
    "github.com/microo8/plgo"
)

func MakeTsVectorTrigger(td *plgo.TriggerData) *plgo.TriggerRow {
    return td.NewRow
}
AoAnima commented 5 years ago

same problem

onshorechet commented 5 years ago

It looks like it is related to the new JIT in postgresql: https://www.postgresql.org/docs/current/jit-extensibility.html

howesteve commented 5 years ago

Same problem here.

mochizk commented 5 years ago

I faced a similar issue in other extensions and make install with_llvm=no worked.

bartek5186 commented 4 years ago

I faced a similar issue in other extensions and make install with_llvm=no worked.

It works. But... There should be a llvm .bc producer also.

microo8 commented 4 years ago

Can someone please take a look at it? I don't know even where to start and also I can't reproduce it.

mochizk commented 4 years ago

I think you can reproduce this by configuring postgresql with ./configure --with-llvm to enable JIT. In that case Makefile try to generate llvm bit code files(.bc), but cannot generate it from Go code.

In src/makefiles/pgxs.mk, with_llvm variable is used to control this behavior. So I use make install with_llvm=no, but I'm not sure this is correct solution.

bartek5186 commented 4 years ago

install simple: postgresql-11-postgis-2.5, postgresql-server-dev-11. under ubuntu 18.04.

Yesterday i found some sources, but it's too hard for me at this moment.

https://github.com/SRI-CSL/gllvm 
https://blog.gopheracademy.com/advent-2018/llvm-ir-and-go/
biter777 commented 4 years ago

Any news on the subject? p.s. Maybe it's easy to make a copy of the compiled extension without the bc file?

microo8 commented 4 years ago

Just use make install with_llvm=no