iCyberon / pg_ulid

Universally Unique Lexicographically Sortable Identifier (ULID) for PostgreSQL
MIT License
59 stars 4 forks source link

build error #6

Open ShonFrazier opened 3 years ago

ShonFrazier commented 3 years ago

I'm experiencing an issue building, but I don't have any extra space to remove like in #4. Here is my output:

$ go version
go version go1.16.3 darwin/amd64
$ postgres --version
postgres (PostgreSQL) 13.2
$ make
Makefile:25: warning: overriding commands for target 'pg_ulid.so'
/usr/local/lib/postgresql/pgxs/src/makefiles/../../src/Makefile.shlib:293: warning: ignoring old commands for target 'pg_ulid.so'
make: Circular pg_ulid.so <- pg_ulid.so dependency dropped.
go build -buildmode=c-shared -o pg_ulid.so main.go pg_ulid.go
pg_ulid.go:10:2: no required module provides package github.com/oklog/ulid: go.mod file not found in current directory or 
any parent directory; see 'go help modules'
make: *** [pg_ulid.so] Error 1
basaran commented 3 years ago

I'm the one who created the #4 but it seems the issue with the MakeFile is already fixed. However, when I tried to compile this on another server, I also had run into the same issue which might be related to the recent changes with go and the way they do the modules. No go programmer here, anyhow, what you can try is:

a. git clone the github.com/oklog/ulid and move everything into the pg_ulid git clone.

b. then run go get github.com/oklog/ulid inside pg_ulid.

but it doesn't end here, it also seems there is a missing library from postgresql-libs, which is utils/nabstime.h so you might need to remove that from the go main mod, but that still doesn't end here.

It also seems some things have changed from v12 to v13

https://github.com/microo8/plgo/issues/35#issuecomment-565337584

You would need to edit both main.go and pg_ulid.go to replace %s/FunctionCallInfoData/FunctionCallInfoBaseData/g

After all these steps, I was able to have the compilation finish but I didn't try it on the server yet. It's very possible everything I had done was wrong :) so try at your own risk. At this point, I think I might give up on this extension. Sadly, this was the fastest ulid extension in the community and @iCyberon is not responding.

iCyberon commented 3 years ago

I might be able to allocate some time during the week to investigate the issue.

basaran commented 3 years ago

hello, it seems to be working fine after switching the function names and taking out the nabstime.h. I can send a PR for you to test if it will help.

iCyberon commented 3 years ago

@basaran that would be great.

basaran commented 3 years ago

PR sent, thank you for your time. If you could add the go get instructions to the readme, that would be very helpful too. Makefile was not able to get the module on my Arch go1.16.3.

msawangwan commented 2 years ago

@basaran hi is there any chance you could help me troubleshoot this error:

#10 4.416 /usr/bin/install -c -m 644 pg_ulid.so '/usr/local/lib/postgresql/bitcode'/pg_ulid/./
#10 4.418 cd '/usr/local/lib/postgresql/bitcode' && /usr/lib/llvm12/bin/llvm-lto -thinlto -thinlto-action=thinlink -o pg_ulid.index.bc pg_ulid/pg_ulid.so
#10 4.441 LLVM ERROR: ThinLTO cannot create input file: The file was not recognized as a valid object file
#10 4.441 PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
#10 4.441 Stack dump:
#10 4.441 0.    Program arguments: /usr/lib/llvm12/bin/llvm-lto -thinlto -thinlto-action=thinlink -o pg_ulid.index.bc pg_ulid/pg_ulid.so
#10 4.444 make: *** [/usr/local/lib/postgresql/pgxs/src/makefiles/pgxs.mk:238: install] Aborted

Trying to build using docker alpine linux, the command [sudo] make install fails (the last step!).

BTW I'm using your fork of this project but I'm asking here because there's no issue tracker in yours 😄 .

basaran commented 2 years ago

hola, well I'm not sure :)

You should try to compile locally first, and if you are using the fork from my repo, make sure you use pg13.

Also, do note, this pg_ulid gets loaded as an extension (added to postgres, not compiled in it). So, I am not sure why you need the llvm to compile it.

But that is okay as I'm generally not sure about many things in life.

AshnaSabu123 commented 1 year ago

Hi,

Getting the same error . Please check the below logs

Makefile:25: warning: overriding recipe for target 'pg_ulid.so' /usr/lib/postgresql/13/lib/pgxs/src/makefiles/../../src/Makefile.shlib:293: warning: ignoring old recipe for target 'pg_ulid.so' make: Circular pg_ulid.so <- pg_ulid.so dependency dropped. go build -buildmode=c-shared -o pg_ulid.so main.go pg_ulid.go

command-line-arguments

./main.go:11:10: fatal error: utils/nabstime.h: No such file or directory 11 | #include "utils/nabstime.h" | ^~~~~~ compilation terminated. make: *** [Makefile:25: pg_ulid.so] Error 2

e-Miracle commented 1 year ago

Hi,

Getting the same error . Please check the below logs

Makefile:25: warning: overriding recipe for target 'pg_ulid.so' /usr/lib/postgresql/13/lib/pgxs/src/makefiles/../../src/Makefile.shlib:293: warning: ignoring old recipe for target 'pg_ulid.so' make: Circular pg_ulid.so <- pg_ulid.so dependency dropped. go build -buildmode=c-shared -o pg_ulid.so main.go pg_ulid.go

command-line-arguments

./main.go:11:10: fatal error: utils/nabstime.h: No such file or directory 11 | #include "utils/nabstime.h" | ^~~~~~ compilation terminated. make: *** [Makefile:25: pg_ulid.so] Error 2

same here

saadahmedkhan commented 9 months ago

Hi, Getting the same error . Please check the below logs Makefile:25: warning: overriding recipe for target 'pg_ulid.so' /usr/lib/postgresql/13/lib/pgxs/src/makefiles/../../src/Makefile.shlib:293: warning: ignoring old recipe for target 'pg_ulid.so' make: Circular pg_ulid.so <- pg_ulid.so dependency dropped. go build -buildmode=c-shared -o pg_ulid.so main.go pg_ulid.go

command-line-arguments

./main.go:11:10: fatal error: utils/nabstime.h: No such file or directory 11 | #include "utils/nabstime.h" | ^~~~~~ compilation terminated. make: *** [Makefile:25: pg_ulid.so] Error 2

same here

Same here