Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails in Alpine #187

Open
agarciamontoro opened this issue Oct 1, 2019 · 2 comments · May be fixed by #196
Open

Build fails in Alpine #187

agarciamontoro opened this issue Oct 1, 2019 · 2 comments · May be fixed by #196

Comments

@agarciamontoro
Copy link

The build fails in Alpine Linux with the following error:

mysql_fdw.c: In function 'mysql_load_library':
mysql_fdw.c:217:56: error: 'RTLD_DEEPBIND' undeclared (first use in this function); did you mean 'RTLD_DEFAULT'?
  mysql_dll_handle = dlopen(_MYSQL_LIBNAME, RTLD_LAZY | RTLD_DEEPBIND);
                                                        ^~~~~~~~~~~~~
                                                        RTLD_DEFAULT
mysql_fdw.c:217:56: note: each undeclared identifier is reported only once for each function it appears in
make: *** [<builtin>: mysql_fdw.o] Error 1

A minimal Dockerfile to reproduce the error:

FROM postgres:11-alpine

ENV MYSQL_FDW_VERSION=REL-2_5_3

RUN apk add --no-cache \
    git \
    libc-dev \
    mariadb-dev \
    make \
    gcc

RUN git clone -b "$MYSQL_FDW_VERSION" https://github.com/EnterpriseDB/mysql_fdw.git /tmp/mysql_fdw

RUN cd /tmp/mysql_fdw && make USE_PGXS=1

The build succeeds when removing the RTLD_DEEPBIND flag.

@youkefan18
Copy link

Hi guys, is there anyone looking into this?
Seems alpine should apply same logic as freeBSD?

Currently I can only sed this line to remove RTLD_DEEPBIND as a workaround...

@alexwebb-cbi
Copy link

Also ran into this today. Had to add clang and llvm9 as well to get it to build and install correctly.

Here's my Dockerfile, adapted from agarciamontoro's above:

# adapted from https://github.com/EnterpriseDB/mysql_fdw/issues/187

# start with official Postgres image
FROM postgres:11.6-alpine

# version of MySQL foreign data wrapper to use
ENV MYSQL_FDW_VERSION=REL-2_5_3

# add various dependencies for mysql_fdw build process
RUN apk add --no-cache make gcc libc-dev clang llvm9 mariadb-dev

# grab mysql_fdw source (see https://github.com/EnterpriseDB/mysql_fdw)
RUN wget -c https://github.com/EnterpriseDB/mysql_fdw/archive/${MYSQL_FDW_VERSION}.tar.gz -O - | tar -xz -C /usr/local/lib/

# fix an error in mysql_fdw.c
RUN sed -i 's/ | RTLD_DEEPBIND//' /usr/local/lib/mysql_fdw-${MYSQL_FDW_VERSION}/mysql_fdw.c

# build and install the extension
RUN cd /usr/local/lib/mysql_fdw-${MYSQL_FDW_VERSION} && make USE_PGXS=1 && make USE_PGXS=1 install

francoisp added a commit to francoisp/mysql_fdw that referenced this issue Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants