
私のプロジェクトではopensshコードをカスタマイズする必要があり、openssh-portable(https://github.com/openssh/openssh-portable)Alpine Linuxのソースコード。ただし、これを行うと、次のエラーが発生します。
*/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*
私はこれがAlpine Linuxがglibcライブラリの代わりにmusl cライブラリに付属しているからだと思います。
このエラーを解決する方法を知りたいです。
- Alpineにglibcをインストールし、musl c libの代わりにglibcを使用するようにmakeコマンドを設定できますか?
- または、musl Cライブラリを使用してopenssh-portableをクロスコンパイルする必要がありますか?もしそうなら、どんな指針や措置を与えてくれてありがとう。
- それとも、リポジトリから取得できるAlpine(musl C libなど)互換のソースコードはありますか?
環境で指定されているとおりに実行できます。autoreconf、./configure、および makeコマンドが成功しました。
答え1
問題は強化されたヘッダーにあるようです。
openssh-portable
問題なくAlpine 3.8で正常に構築できました。
- 新鮮な
alpine:3.8
イメージ - インストールされたビルドの前提条件:
apk add autoconf gcc make musl-dev openssl-dev zlib-dev
autoreconf && ./configure && make -j8
ただし、インストールfortify-headers
と再構成によって上記の内容が中断されるビルドが発生する可能性があります。 Fortifyには、GNU拡張であると疑われる独自のstdlib.h
用途があります。__orig_realpath
Fortifyヘッダーがopensshビルドの強力な要件ではない場合は、これを無視してapk del fortify-headers
ビルドを繰り返してみてください。