sgerrand / alpine-pkg-glibc

A glibc compatibility layer package for Alpine Linux
2.05k stars 280 forks source link

Create -dev subpackage #44

Closed sgerrand closed 7 years ago

sgerrand commented 7 years ago

💁 These changes add a glibc-dev package.

Closes #43

sgerrand commented 7 years ago

@jairov4: Does this meet your requirements?

sgerrand commented 7 years ago

Good catch. Thanks!

sgerrand commented 7 years ago

@andyshinn: Due to the magic that occurs in abuild for -dev subpackages, I think that this change is OK. The files that appear in the intended packages are correct.

andyshinn commented 7 years ago

Ah, I didn't realize that happened automagically.

jairov4 commented 7 years ago

looks awsome! @sgerrand

jairov4 commented 7 years ago

Guys, how can I test the artifact APK? I dont see any link in circleci

andyshinn commented 7 years ago

You need to log in to CircleCI to see artifacts. They should be at https://circleci.com/gh/sgerrand/alpine-pkg-glibc/86#artifacts/containers/0.

jairov4 commented 7 years ago

I got the APKs but now Im seeing that gcc is not taking as default. Should I set somthing? Im getting:

    fatal error: sys/queue.h: No such file or directory
    #include <sys/queue.h>

Any environment variable may be?

sgerrand commented 7 years ago

This error is related to gcc, not this library. You'll need to set CPATH to let gcc know the location of the header files and LIBRARY_PATH for gcc to pick up the location of any libraries which need to be linked.

sgerrand commented 7 years ago

e.g.

CPATH=/usr/glibc-compat/include LIBRARY_PATH=/usr/glibc-compat/lib
sgerrand commented 7 years ago

An example of the above:

/ # echo '#include <sys/queue.h>' > /tmp/test.c
/ # apk add -q -U gcc
/ # gcc -o test /tmp/test.c
/tmp/test.c:1:23: fatal error: sys/queue.h: No such file or directory
 #include <sys/queue.h>
                       ^
compilation terminated.
/ # apk add --allow-untrusted -q /pkgs/builder/x86_64/glibc-dev-2.25-r1.apk
/ # CPATH=/usr/glibc-compat/include gcc -o test /tmp/test.c
/usr/lib/gcc/x86_64-alpine-linux-musl/6.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find Scrt1.o: No such file or directory
/usr/lib/gcc/x86_64-alpine-linux-musl/6.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crti.o: No such file or directory
/usr/lib/gcc/x86_64-alpine-linux-musl/6.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared
collect2: error: ld returned 1 exit status
/ # CPATH=/usr/glibc-compat/include LIBRARY_PATH=/usr/glibc-compat/lib gcc -o test /tmp/test.c 
/usr/lib/gcc/x86_64-alpine-linux-musl/6.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find -lssp_nonshared
collect2: error: ld returned 1 exit status

The last command succeeded, albeit failing due to another dependency not existing.

nickpresta commented 7 years ago

@sgerrand I can open a new issue if warranted, but I wanted to get your feedback. I'm attempting to use the glibc-dev package per this PR (and pulled from CircleCI's artifacts), but I'm getting strange problems when compiling.

When I install the grpio and grpcio-toolsPython packages they fail at compilation time due to an error in glibc-compat. I'm hoping this package will solve this issue with grpc.

Here is a gist that provides a reproducible Dockerfile and the output I'm seeing.

jairov4 commented 7 years ago

@nickpresta, may be you need add this

  wget -q -O /tmp/gcc-libs.tar.xz "https://www.archlinux.org/packages/core/x86_64/gcc-libs/download" \
    && tar -xvJf /tmp/gcc-libs.tar.xz -C /tmp usr/lib/libgcc_s.so.1 usr/lib/libgcc_s.so \
    && mv /tmp/usr/lib/libgcc* /usr/glibc-compat/lib \
    && rm -rf /tmp/$GLIBC_VER.apk /tmp/usr /tmp/gcc-libs.tar.xz /var/cache/apk/* \
nickpresta commented 7 years ago

Thanks @jairov4 !

Unfortunately, that didn't seem to do anything (gist).

What I can't tell is if I'm missing the Python dev stuff to make this work (as per the comment about missing Python.h).

If I remove the CPATH and LIBRARY_PATH, I get this (which is back to the original problem).

sgerrand commented 7 years ago

@nickpresta: Thanks for bringing this up. It'd be great if you would create a new issue for the python compilation issue that you're facing. We can resolve it there.

nickpresta commented 7 years ago

@sgerrand thanks! I've created https://github.com/sgerrand/alpine-pkg-glibc/issues/45