GithubHelp home page GithubHelp logo

Comments (13)

cjbottaro avatar cjbottaro commented on May 20, 2024 7

This actually works totally fine with the official Postgres Alpine image. Here's a Dockerfile that uses the official image to build/install wal2json:

FROM postgres:10.5-alpine AS builder

RUN apk add --no-cache build-base git
RUN git clone https://github.com/eulerto/wal2json.git
WORKDIR wal2json
RUN USE_PGXS=1 make && make install

FROM postgres:10.5-alpine
COPY --from=builder /wal2json/wal2json.so /usr/local/lib/postgresql/

Works with https://github.com/disneystreaming/pg2k4j (which relies on this plugin).

from wal2json.

eulerto avatar eulerto commented on May 20, 2024

What are the steps to compile wal2json?

ERROR: could not load library "/usr/local/lib/postgresql/wal2json.so": Error relocating /usr/local/lib/postgresql/wal2json.so: __snprintf_chk: symbol not found

It seems something wrong with your OS, no?

Are there any compiled builds with static linking?

Extensions are not linked statically to Postgres.

from wal2json.

OndraZizka avatar OndraZizka commented on May 20, 2024

What are the steps to compile wal2json?

sudo apt install libpq-dev        
sudo apt install postgresql-common
sudo apt install postgresql-server-dev-all

git clone https://github.com/eulerto/wal2json.git
cd wal2json
PATH=`which pg_config`:$PATH
USE_PGXS=1 make
#USE_PGXS=1 make install
chmod a+rx wal2json.so
sudo cp wal2json.so /usr/local/lib/postgresql

It seems something wrong with your OS, no?

Doesn't seem so, all other thing works fine. It's a standard Ubuntu 18.04.
Update: It's a Docker image postgres:9.5-alpine with musl instead of glibc.

Extensions are not linked statically to Postgres.

I meant to compile the .so statically with it's dependencies.

from wal2json.

OndraZizka avatar OndraZizka commented on May 20, 2024

I think the issue is I am actually running PostgreSQL in Alpine Linux based Docker container, and the issue is that you depend on glibc but Alpine has musl. I've changed the title and the description.

I have found a probable solution - glibc package for Alpine Linux.

from wal2json.

eulerto avatar eulerto commented on May 20, 2024

I'm not sure PostgreSQL works with musl (I've never tried). I found other reports from this same error message.

from wal2json.

OndraZizka avatar OndraZizka commented on May 20, 2024

PostgreSQL works fine on Alpine, there is an official Docker image:
https://hub.docker.com/r/library/postgres/tags/
I have tried to install the alpine-pkg-glibc in the container but no success yet.
Is there any chance __snprintf_chk could be replaced? (Sorry if being too obnoxious)

Personally, it's not a blocker for me because I am heading to RDS, but I like to develop against Docker containers. Others will run to the same issue with wal2json in postgres:*-alpine.

from wal2json.

OndraZizka avatar OndraZizka commented on May 20, 2024

I recalled ldd. Here's a list of what's missing. I think there's too much to get rid of glibc.

$ ldd /usr/local/lib/postgresql/wal2json.so
ldd (0x7ffade911000)
libc.so.6 => ldd (0x7ffade911000)
Error relocating /usr/local/lib/postgresql/wal2json.so: palloc0: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: __snprintf_chk: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pg_lsn_out: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: parse_bool: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pg_strncasecmp: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: nocachegetattr: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: CurrentMemoryContext: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: OidOutputFunctionCall: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: RelationIdGetRelation: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: OutputPluginWrite: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: lappend: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: ReleaseSysCache: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: elog_finish: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: initStringInfo: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: AllocSetContextCreate: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: list_free_deep: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: text_to_cstring: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errstart: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: OutputPluginPrepareWrite: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: appendStringInfoChar: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: appendStringInfo: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: get_namespace_name: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pg_detoast_datum: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: TopMemoryContext: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: escape_json: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: MemoryContextDelete: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pstrdup: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: RelationClose: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: elog_start: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: format_type: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: getTypeOutputInfo: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: SearchSysCache: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errmsg: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: timestamptz_to_str: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: DirectFunctionCall2Coll: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errfinish: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: appendStringInfoString: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: DirectFunctionCall1Coll: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: RelationGetIndexList: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: heap_getsysattr: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: MemoryContextReset: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: pfree: symbol not found
Error relocating /usr/local/lib/postgresql/wal2json.so: errcode: symbol not found

from wal2json.

OndraZizka avatar OndraZizka commented on May 20, 2024

Seems like I am in a dead end with Alpine: gliderlabs/docker-alpine#149

from wal2json.

OndraZizka avatar OndraZizka commented on May 20, 2024

I have tried to install glibc like it's done in this Dockerfile: https://github.com/jeanblanchard/docker-alpine-glibc/blob/master/Dockerfile
Still no success.

from wal2json.

OndraZizka avatar OndraZizka commented on May 20, 2024

One more info - what I see after my build:

gcc-nm /usr/local/lib/postgresql/wal2json.so | grep GLIB
                 U __ctype_b_loc@@GLIBC_2.3
                 w __cxa_finalize@@GLIBC_2.2.5
                 U __snprintf_chk@@GLIBC_2.3.4
                 U __stack_chk_fail@@GLIBC_2.4
                 U memmove@@GLIBC_2.2.5
                 U strcmp@@GLIBC_2.2.5
                 U strlen@@GLIBC_2.2.5
                 U strncpy@@GLIBC_2.2.5
                 U strspn@@GLIBC_2.2.5

I have read in man pages for ld(8) that it tries to deduce what dependencies to use based on what it was linked against. I am not sure if there's some fallback if it can't find the exact version...

from wal2json.

Shashankft9 avatar Shashankft9 commented on May 20, 2024

I am also facing the similar issue.
I am running postgres DB as a container on alpine linux.
Please guide me how to resolve this issue

from wal2json.

cjbottaro avatar cjbottaro commented on May 20, 2024

Alpine is becoming (or maybe already is) the standard for running Docker containers. In dev, prod, and everywhere in between. There are official Postgres Docker images for Alpine. It seems that this should build on officially supported distros.

from wal2json.

arajkumar avatar arajkumar commented on May 20, 2024
RUN USE_PGXS=1 make && make install

In the latest versions, disable the llvm if you see errors related to clang or llvm.

RUN make with_llvm=no && make with_llvm=no install

from wal2json.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.