On 21 November 2017 at 17:41, Alessio Gottardo <tappo...@yahoo.it.invalid> wrote:
> Thank you Chris, > > I've been reading about this new world (to me) of the reasons behind glibc > and ulibc. In some way there are similar issues in "toy languages / higher > level languages" like java or javascript (node.js) when shipping the > equivalent of executables with tons of dependencies (and transitive > dependencies) making the artefact huge in terms of disk space. > > Anyway, I've added the following to the docker file (using RUN statements) > in order to include the binary package of glibc to Linux Alpine (cf. > https://github.com/sgerrand/alpine-pkg-glibc#installing): > > > apk --no-cache add ca-certificates wget > wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent. > com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub > wget https://github.com/sgerrand/alpine-pkg-glibc/releases/ > download/2.25-r0/glibc-2.25-r0.apk > apk add glibc-2.25-r0.apk > > However I get the same compilation error. > > I believe that's because somehow I need to point the cmake/make stuff to > glibc (instead of the default/system ulibc) hardcoding somewhere the path? > If that's the case then I am not sure where I should change this stuff and > which path I should add. > Please let me know if this rings any bell. > I've followed these installation steps and now realise that the glibc package above is runtime only and does not support local compilation - were it to do so it would probably be called "glibc-dev" by convention. This means that you can only run packages that were compiled elsewhere, which is presumably the case for JDKs etc. In retrospect an obvious choice when the target is a minimalist OS so apologies for leading you down a bit of a blind alley. In terms of progressing further I would suggest you might look into extending a build system such as sgerrand's (the one that generates the glibc.apk package) in order to either build a glibc-dev package (this will probably result in a bloated Alpine image) or to build qpid-proton and export it as a .apk file. The latter might be the most satisfactory solution since you would then not require many of the build dependencies you already have (git, cmake, gcc etc) in order to install qpid-proton in the live environment. The down-side is that it's quite and involved process and certainly not one for the faint of heart! Another alternative is that we make a more official version of the source code hack I previously mentioned to make Proton compatible with the reduced (I'm not judging) musl libc. Any thoughts, Messrs. Stitcher, Conway et al? Thanks > Alessio > > > > > > On Monday, 20 November 2017, 19:34:50 GMT, Chris Richardson < > c...@fourc.eu> wrote: > > 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 withpatch -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 <tappo...@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 > c...@fourc.eu > > FourC AS, Vestre Rosten 81, Trekanten, NO-7075 Tiller, Norway > www.fourc.eu > > Follow us on LinkedIn, Facebook, Google+ and Twitter! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org > For additional commands, e-mail: users-h...@qpid.apache.org -- *Chris Richardson*, System Architect c...@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>!*