qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Richardson ...@fourc.eu>
Subject Re: Compiling proton-c for Linux Alpine
Date Mon, 20 Nov 2017 19:34:41 GMT
Hi Alessio,

The problem here appears to be that qpid-proton assumes glibc is installed
on your system (it is on "most"(tm) linuces), but alpine doesn't appear to
contain it, nor yet is it available in the default apk repositories. The
pthread-stub package which provides /usr/include/pthread.h does not include
the expected PTHREAD_MUTEX_ADAPTIVE_NP definition.

The easiest option might be to use a docker image which does include glibc,
try one of the documented solutions here
http://wiki.alpinelinux.org/wiki/Running_glibc_programs or here
https://github.com/sgerrand.

This is a bit of a hack and comes with a huge disclaimer as I haven't
tested it at all, but if glibc isn't an option you could change the
PTHREAD_MUTEX_ADAPTIVE_NP
to PTHREAD_MUTEX_NORMAL. I _think_ the only side effect would be that some
sub-optimal system calls might take place so the thread locking would not
be as efficient.
I've attached a patch to do this which you can apply with
patch -p1 < qpid-proton-0.18.0-pthread-stub.patch

I hope this helps to point you in the right direction.

Chris


On 20 November 2017 at 17:11, Alessio Gottardo <tappoz84@yahoo.it.invalid>
wrote:

> Hi there,
> I am trying to compile Qpid Proton on Linux Alpine (within a docker image).
> I am getting this error:
> /go/src/qpid-proton/proton-c/src/proactor/epoll.c: In function
> 'pmutex_init':/go/src/qpid-proton/proton-c/src/proactor/epoll.c:104:36:
> error: 'PTHREAD_MUTEX_ADAPTIVE_NP' undeclared (first use in this function)
>  pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
>                         ^~~~~~~~~~~~~~~~~~~~~~~~~/go/
> src/qpid-proton/proton-c/src/proactor/epoll.c:104:36: note: each
> undeclared identifier is reported only once for each function it appears
> inmake[2]: *** [proton-c/CMakeFiles/qpid-proton.dir/build.make:695:
> proton-c/CMakeFiles/qpid-proton.dir/src/proactor/epoll.c.o] Error
> 1make[1]: *** [CMakeFiles/Makefile2:1069: proton-c/CMakeFiles/qpid-proton.dir/all]
> Error 2make: *** [Makefile:141: all] Error 2
> The relevant part of the Dockerfile (FROM golang:1.8.3-alpine3.6):
> ```# download Apache QPIDWORKDIR /go/src/RUN git clone --progress
> --verbose http://git.apache.org/qpid-proton.git
> # dependencies for Apache QPID (check https://pkgs.alpinelinux.org/
> packages)RUN apk add gcc=6.3.0-r4 g++=6.3.0-r4 cmake=3.8.1-r0
> make=4.2.1-r0RUN apk add python2=2.7.13-r1RUN apk add libssl1.0=1.0.2m-r0
> cyrus-sasl=2.1.26-r10RUN apk add swig=3.0.10-r0
> # compile and install Apache QPIDWORKDIR /go/src/qpid-protonRUN git
> checkout tags/0.18.0WORKDIR /go/src/qpid-proton/buildRUN cmake ..
> -DCMAKE_INSTALL_PREFIX=/usr -DSYSINSTALL_BINDINGS=ONRUN make install```
> The previous steps are based on the details I found here:
> https://github.com/apache/qpid-proton/blob/master/INSTALL.md
> The reason for doing this is to be able to run Go applications using
> Docker and the Electron library for QPID.
> I am not familiar with compiling C projects and I am not able to proceed
> based on that error message.It seems some header files are missing or
> something like that but I can not figure out which dependency is
> missing.Any hint or help on how to compile this library for Linux Alpine?
> Thank youAlessio
>
>


-- 

*Chris Richardson*, System Architect
cr@fourc.eu


*FourC AS, Vestre Rosten 81, Trekanten, NO-7075 Tiller, Norwaywww.fourc.eu
<http://www.fourc.eu/>*

*Follow us on LinkedIn <http://bit.ly/fourcli>, Facebook
<http://bit.ly/fourcfb>, Google+ <http://bit.ly/fourcgp> and Twitter
<http://bit.ly/fourctw>!*

Mime
View raw message