For my projects I have to customize the openssh code and I am planning to build the openssh-portable(https://github.com/openssh/openssh-portable) source code in the Alpine linux. But I am getting the following error while doing so.
*/home/openssh-portable # make
(cd openbsd-compat && make)
make[1]: Entering directory '/home/openssh-portable/openbsd-compat'
cc -g -O2 -pipe -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -fstack-protector-strong -fPIE -I. -I.. -I. -I./.. -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -DHAVE_CONFIG_H -c arc4random.c
In file included from /usr/include/fortify/sys/socket.h:25,
from ../includes.h:27,
from arc4random.c:27:
**/usr/include/fortify/stdlib.h:40:1: error: 'realpath' undeclared here (not in a function); did you mean 'realloc'?**
_FORTIFY_FN(realpath) char *realpath(const char *__p, char *__r)
^~~~~~~~~~~
/usr/include/fortify/stdlib.h:41: confused by earlier errors, bailing out
make[1]: *** [Makefile:99: arc4random.o] Error 1
make[1]: Leaving directory '/home/openssh-portable/openbsd-compat'
make: *** [Makefile:165: openbsd-compat/libopenbsd-compat.a] Error 2*
I suspect it is because the Alpine linux comes with the musl c librray rather than glibc library.
I would like to know how to solve this error.
- Is it possible to install glibc in Alpine and configure the make command to use the glibc rather than musl c lib?
- Or should I cross compile the openssh-portable using musl C libarary? if so any guidance or steps will be appreciated?
- or is there any Alpine(i.e, musl C lib) compatible source code available which I can pull from a repo
As specified in the environment, I am able to run autoreconf, ./configure and make commands successfully.