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 error with Alpine 3.9 #371

Closed
hyperized opened this issue Mar 6, 2019 · 7 comments
Closed

Build error with Alpine 3.9 #371

hyperized opened this issue Mar 6, 2019 · 7 comments
Labels

Comments

@hyperized
Copy link

When building with the latest Alpine (3.9), which comes with OpenSSL 1.1.1a-r1 I get the following error:

     CC       lib/usual/tls/tls.c
In file included from lib/usual/socket.h:54,
                 from lib/usual/tls/tls_compat.h:10,
                 from lib/usual/tls/tls.c:18:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
  ^~~~~~~
In file included from lib/usual/tls/tls.h:25,
                 from lib/usual/tls/tls_compat.h:5,
                 from lib/usual/tls/tls.c:18:
lib/usual/base.h:336:17: error: conflicting types for '_const_free'
 #define free(x) _const_free(x)
                 ^~~~~~~~~~~
lib/usual/base.h:331:20: note: previous definition of '_const_free' was here
 static inline void _const_free(const void *p)
                    ^~~~~~~~~~~
make: *** [/pgbouncer/lib/mk/antimake.mk:1230: .objs/pgbouncer/lib/usual/tls/tls.o] Error 1
The command '/bin/sh -c make' returned a non-zero code: 2

This error exists in the current master branch as well as the 1.9.0 tag.
The previously known working version for me was OpenSSL 1.0.2r-r0

@PJMODOS
Copy link
Contributor

PJMODOS commented Mar 23, 2019

It's not because of openssl, it's the fact that Alpine is using musl as its libc and it does some redefines in places where it shouldn't (in this case sched.h redefines free) which breaks our own redefinition. The reason why it appeared with newer openssl is change in includes there but it's not openssl problem in itself.

I don't have a good fix for this at the moment.

@PJMODOS PJMODOS changed the title Build error with OpenSSL 1.1.1a-r1 Build error with Alpine 3.9 Mar 23, 2019
@petere petere added the help label Aug 3, 2019
petere added a commit to petere/libusual that referenced this issue Sep 8, 2019
Remove the nonstandard definition of free() that takes a const
pointer, and fix the other APIs built on that.

Overriding standard C library functions and having a nonstandard
meaning of "const" is confusing.  It also breaks the builds on some
platforms.

fixes pgbouncer/pgbouncer#371
petere added a commit that referenced this issue Sep 11, 2019
These depend on libusual's redefinition of free(), which we should get
rid of.

see #371
@hyperized
Copy link
Author

@PJMODOS

Any chance you can bump the lib dependency?
I did a quick test run by updating the submodules to latest and I got:

configure.ac:57: error: possibly undefined macro: AC_USUAL_LIBEVENT
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.

@petere
Copy link
Member

petere commented Sep 16, 2019

Any chance you can bump the lib dependency?

This was done.

@hyperized
Copy link
Author

@petere I'm not sure this solved the reported issue. With the latest tagged build (1.11.0) I still get:

     CC       lib/usual/tls/tls.c
In file included from lib/usual/socket.h:54,
                 from lib/usual/tls/tls_compat.h:10,
                 from lib/usual/tls/tls.c:18:
/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
 #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
  ^~~~~~~
In file included from lib/usual/tls/tls.h:25,
                 from lib/usual/tls/tls_compat.h:5,
                 from lib/usual/tls/tls.c:18:
lib/usual/base.h:336:17: error: conflicting types for '_const_free'
 #define free(x) _const_free(x)
                 ^~~~~~~~~~~
lib/usual/base.h:331:20: note: previous definition of '_const_free' was here
 static inline void _const_free(const void *p)
                    ^~~~~~~~~~~
make: *** [/pgbouncer/lib/mk/antimake.mk:1230: .objs/pgbouncer/lib/usual/tls/tls.o] Error 1

For reproduction purpose, I used the following Dockerfile:

FROM alpine:3.10.2 AS builder

ARG build_tag=pgbouncer_1_11_0

RUN wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-linux.tar.gz
RUN tar xvzf pandoc-2.7.3-linux.tar.gz --strip-components 1 -C /usr/local

RUN apk --no-cache add make pkgconfig autoconf automake libtool py-docutils git gcc g++ libevent-dev openssl-dev c-ares-dev ca-certificates
RUN git clone --branch ${build_tag} --recurse-submodules -j8 https://github.com/pgbouncer/pgbouncer.git

WORKDIR pgbouncer

RUN ./autogen.sh
RUN ./configure --prefix=/pgbouncer --with-libevent=libevent-prefix
RUN make
RUN make install

Note that we're using the latest version of Alpine 3.10.2, but it's no different on 3.9

Is there anything I might have missed?

@petere
Copy link
Member

petere commented Sep 25, 2019

There is no release yet with the fix. I realize that this is kind of confusing, but that's how GitHub works.

@hyperized
Copy link
Author

Yeah I see now, my bad. The issue is indeed fixed on the master branch.
I presume this will be in the 1.12.0 release?

Thanks a lot :)!

@petere
Copy link
Member

petere commented Oct 1, 2019

I presume this will be in the 1.12.0 release?

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants