Is there a best practice on setting up glibc on docker alpine linux base image?

Yes there is, I’ve used a custom built glibc to install a JRE on it. You can find it here You can use wget or curl to get the code and apk to install them UPDATED commands see comments below apk –no-cache add ca-certificates wget wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk apk add glibc-2.28-r0.apk … Read more

Compiling with -static-libgcc -static-libstdc++ still results in dynamic dependency on libc.so

GNU libc is not designed to be statically linked. Important functions, e.g. gethostbyname and iconv, will malfunction or not work at all in a static binary. Arguably even worse, under some conditions a static binary will attempt to dynamically open and use libc.so.6, even though the whole point of static linkage is to avoid such … Read more

What is a glibc free/malloc/realloc invalid next size/invalid pointer error and how to fix it?

Answer for Example Question unwind gave the accepted answer to the example question: Your code is wrong. You are allocating space for a single pointer (malloc(sizeof(char*))), but no characters. You are overwriting your allocated space with all the strings, causing undefined behavior (in this particular case, corrupting malloc()‘s book-keeping data). You don’t need to allocate … Read more

difference between %ms and %s scanf

The C Standard does not define such an optional character in the scanf() formats. The GNU lib C, does define an optional a indicator this way (from the man page for scanf): An optional a character. This is used with string conversions, and relieves the caller of the need to allocate a corresponding buffer to … Read more

How to upgrade glibc from version 2.12 to 2.14 on CentOS?

You cannot update glibc on Centos 6 safely. However you can install 2.14 alongside 2.12 easily, then use it to compile projects etc. Here is how: mkdir ~/glibc_install; cd ~/glibc_install wget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gz tar zxvf glibc-2.14.tar.gz cd glibc-2.14 mkdir build cd build ../configure –prefix=/opt/glibc-2.14 make -j4 sudo make install export LD_LIBRARY_PATH=/opt/glibc-2.14/lib