无法在 Docker alpine:3.7 上安装 pecl
Cannot pecl install on Docker alpine:3.7
运行 pecl install xdebug
(或任何其他包)在 alpine 3.7 映像构建或容器中总是导致
checking whether the C compiler works... no
有人知道这是怎么回事吗?这是相关的 config.log:
configure:2695: $? = 0
configure:2684: cc -v >&5
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/6.4.0/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-6.4.0/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 6.4.0' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-cloog-backend --enable-languages=c,c++,objc,java,fortran,ada --disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared --enable-threads --enable-tls --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
gcc version 6.4.0 (Alpine 6.4.0)
configure:2695: $? = 0
configure:2684: cc -V >&5
cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
compilation terminated.
configure:2695: $? = 1
configure:2684: cc -qversion >&5
cc: error: unrecognized command line option '-qversion'; did you mean '--version'?
cc: fatal error: no input files
compilation terminated.
configure:2695: $? = 1
configure:2715: checking whether the C compiler works
configure:2737: cc conftest.c >&5
Error loading shared library libopcodes-2.28.so: No such file or directory (needed by /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as)
Error loading shared library libbfd-2.28.so: No such file or directory (needed by /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as)
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_errmsg: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_arch_bits_per_address: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_error_program_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xcalloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_openw: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_section_flags: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_error: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_section_by_name_if: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_is_local_label: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_hash_set_default_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xstrerror: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: filename_cmp: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: filename_ncmp: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_make_section_anyway: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_init: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_section_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: unlink_if_ordinary: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _bfd_elf_obj_attrs_arg_type: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_add_obj_attr_string: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_reloc_code_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_compression_header_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: lbasename: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _xexit_cleanup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_add_obj_attr_int: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_format: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xrealloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_get_default_section_type: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_map_over_sections: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_reloc_name_lookup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_target_list: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xmalloc_set_program_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: hex_init: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_obj_attr_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xexit: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_reloc_type_lookup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_make_section_old_way: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_symtab: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xmalloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_scan_vma: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xstrdup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_set_obj_attr_contents: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: getpwd: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_alloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_section_contents: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_reloc_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_update_compression_header: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_install_relocation: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_section_by_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_close: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_add_obj_attr_int_string: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_arch_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: concat: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_reloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_cache_close_all: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: i386_regtab_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _sch_istable: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: i386_regtab: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: cs: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: ss: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: gs: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _sch_toupper: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: i386_optab: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: ds: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: es: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _hex_value: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: fs: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _sch_tolower: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _bfd_elf_large_com_section: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _bfd_std_section: symbol not found
configure:2741: $? = 1
configure:2779: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2784: error: in `/usr/src/php/xdebug-2.6.0':
configure:2787: error: C compiler cannot create executables
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_env_CC_set=''
ac_cv_env_CC_value=''
ac_cv_env_CFLAGS_set=''
ac_cv_env_CFLAGS_value=''
ac_cv_env_CPPFLAGS_set=''
ac_cv_env_CPPFLAGS_value=''
ac_cv_env_CPP_set=''
ac_cv_env_CPP_value=''
ac_cv_env_LDFLAGS_set=''
ac_cv_env_LDFLAGS_value=''
ac_cv_env_LIBS_set=''
ac_cv_env_LIBS_value=''
ac_cv_env_build_alias_set=''
ac_cv_env_build_alias_value=''
ac_cv_env_host_alias_set=''
ac_cv_env_host_alias_value=''
ac_cv_env_target_alias_set=''
ac_cv_env_target_alias_value=''
ac_cv_path_EGREP='/bin/grep -E'
ac_cv_path_GREP='/bin/grep'
ac_cv_prog_ac_ct_CC='cc'
lt_cv_path_SED='/bin/sed'
## ----------------- ##
## Output variables. ##
## ----------------- ##
AR=''
AWK=''
CC='cc'
CFLAGS=''
CONFIGURE_COMMAND=' '\''./configure'\'' '
CONFIGURE_OPTIONS=''
CPP=''
CPPFLAGS=''
DEFS=''
DSYMUTIL=''
ECHO='echo'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='/bin/grep -E'
EXEEXT=''
GREP='/bin/grep'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LN_S=''
LTLIBOBJS=''
NMEDIT=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RE2C=''
SED='/bin/sed'
SHELL='/bin/sh'
SHLIB_DL_SUFFIX_NAME=''
SHLIB_SUFFIX_NAME=''
STRIP=''
ac_ct_CC='cc'
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target=''
target_alias=''
target_cpu=''
target_os=''
target_vendor=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
configure: exit 77
我相信您需要为此安装 g++
库。
这里是我的方法:
FROM alpine:3.7
ENV PHPIZE_DEPS \
git \
file \
re2c \
autoconf \
make \
zlib \
zlib-dev \
g++
ENV PHP_DEPS \
php7@community \
php7-dev@community \
php7-bcmath@community \
# but you can avoid pecl installation by this method
php7-xdebug@community
RUN set -xe; \
apk add --update --no-cache --virtual .build-deps ${PHPIZE_DEPS}; \
echo '@community http://nl.alpinelinux.org/alpine/v3.7/community/' >> /etc/apk/repositories; \
apk --update add --no-cache ${PHP_DEPS}; \
# or pecl installation
pecl install xdebug; \
# clean up (remove build packages)
apk del .build-deps
CMD ["php-fpm7", "-F"]
我认为你只需要安装 musl-dev
包(musl c 库 (libc) 实现):
FROM alpine:3.7
RUN apk update && apk upgrade
RUN apk add --no-cache php7-pear php7-dev gcc musl-dev make
RUN pecl install xdebug
好吧,其实问题是我对 dockerfiles 的误解。
- 作为
RUN
命令 运行 在单独的容器中工作目录不会持久化。必须使用 WORKDIR
而不是
cd "$_"
无效
因此我在根文件夹中提取了 PHP 源,我猜这弄乱了一些文件。一旦提取到自己的文件夹中,编译工作正常。
运行 pecl install xdebug
(或任何其他包)在 alpine 3.7 映像构建或容器中总是导致
checking whether the C compiler works... no
有人知道这是怎么回事吗?这是相关的 config.log:
configure:2695: $? = 0
configure:2684: cc -v >&5
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-alpine-linux-musl/6.4.0/lto-wrapper
Target: x86_64-alpine-linux-musl
Configured with: /home/buildozer/aports/main/gcc/src/gcc-6.4.0/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl --target=x86_64-alpine-linux-musl --with-pkgversion='Alpine 6.4.0' --enable-checking=release --disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls --disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie --enable-cloog-backend --enable-languages=c,c++,objc,java,fortran,ada --disable-libssp --disable-libmpx --disable-libmudflap --disable-libsanitizer --enable-shared --enable-threads --enable-tls --with-system-zlib --with-linker-hash-style=gnu
Thread model: posix
gcc version 6.4.0 (Alpine 6.4.0)
configure:2695: $? = 0
configure:2684: cc -V >&5
cc: error: unrecognized command line option '-V'
cc: fatal error: no input files
compilation terminated.
configure:2695: $? = 1
configure:2684: cc -qversion >&5
cc: error: unrecognized command line option '-qversion'; did you mean '--version'?
cc: fatal error: no input files
compilation terminated.
configure:2695: $? = 1
configure:2715: checking whether the C compiler works
configure:2737: cc conftest.c >&5
Error loading shared library libopcodes-2.28.so: No such file or directory (needed by /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as)
Error loading shared library libbfd-2.28.so: No such file or directory (needed by /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as)
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_errmsg: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_arch_bits_per_address: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_error_program_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xcalloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_openw: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_section_flags: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_error: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_section_by_name_if: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_is_local_label: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_hash_set_default_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xstrerror: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: filename_cmp: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: filename_ncmp: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_make_section_anyway: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_init: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_section_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: unlink_if_ordinary: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _bfd_elf_obj_attrs_arg_type: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_add_obj_attr_string: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_reloc_code_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_compression_header_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: lbasename: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _xexit_cleanup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_add_obj_attr_int: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_format: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xrealloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_get_default_section_type: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_map_over_sections: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_reloc_name_lookup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_target_list: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xmalloc_set_program_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: hex_init: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_obj_attr_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xexit: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_reloc_type_lookup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_make_section_old_way: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_symtab: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xmalloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_scan_vma: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: xstrdup: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_set_obj_attr_contents: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: getpwd: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_alloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_section_contents: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_reloc_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_update_compression_header: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_install_relocation: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_section_by_name: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_close: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_elf_add_obj_attr_int_string: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_get_arch_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: concat: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_set_reloc: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: bfd_cache_close_all: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: i386_regtab_size: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _sch_istable: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: i386_regtab: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: cs: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: ss: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: gs: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _sch_toupper: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: i386_optab: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: ds: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: es: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _hex_value: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: fs: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _sch_tolower: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _bfd_elf_large_com_section: symbol not found
Error relocating /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/../../../../x86_64-alpine-linux-musl/bin/as: _bfd_std_section: symbol not found
configure:2741: $? = 1
configure:2779: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2784: error: in `/usr/src/php/xdebug-2.6.0':
configure:2787: error: C compiler cannot create executables
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_env_CC_set=''
ac_cv_env_CC_value=''
ac_cv_env_CFLAGS_set=''
ac_cv_env_CFLAGS_value=''
ac_cv_env_CPPFLAGS_set=''
ac_cv_env_CPPFLAGS_value=''
ac_cv_env_CPP_set=''
ac_cv_env_CPP_value=''
ac_cv_env_LDFLAGS_set=''
ac_cv_env_LDFLAGS_value=''
ac_cv_env_LIBS_set=''
ac_cv_env_LIBS_value=''
ac_cv_env_build_alias_set=''
ac_cv_env_build_alias_value=''
ac_cv_env_host_alias_set=''
ac_cv_env_host_alias_value=''
ac_cv_env_target_alias_set=''
ac_cv_env_target_alias_value=''
ac_cv_path_EGREP='/bin/grep -E'
ac_cv_path_GREP='/bin/grep'
ac_cv_prog_ac_ct_CC='cc'
lt_cv_path_SED='/bin/sed'
## ----------------- ##
## Output variables. ##
## ----------------- ##
AR=''
AWK=''
CC='cc'
CFLAGS=''
CONFIGURE_COMMAND=' '\''./configure'\'' '
CONFIGURE_OPTIONS=''
CPP=''
CPPFLAGS=''
DEFS=''
DSYMUTIL=''
ECHO='echo'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='/bin/grep -E'
EXEEXT=''
GREP='/bin/grep'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LN_S=''
LTLIBOBJS=''
NMEDIT=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RE2C=''
SED='/bin/sed'
SHELL='/bin/sh'
SHLIB_DL_SUFFIX_NAME=''
SHLIB_SUFFIX_NAME=''
STRIP=''
ac_ct_CC='cc'
bindir='${exec_prefix}/bin'
build=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target=''
target_alias=''
target_cpu=''
target_os=''
target_vendor=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
configure: exit 77
我相信您需要为此安装 g++
库。
这里是我的方法:
FROM alpine:3.7
ENV PHPIZE_DEPS \
git \
file \
re2c \
autoconf \
make \
zlib \
zlib-dev \
g++
ENV PHP_DEPS \
php7@community \
php7-dev@community \
php7-bcmath@community \
# but you can avoid pecl installation by this method
php7-xdebug@community
RUN set -xe; \
apk add --update --no-cache --virtual .build-deps ${PHPIZE_DEPS}; \
echo '@community http://nl.alpinelinux.org/alpine/v3.7/community/' >> /etc/apk/repositories; \
apk --update add --no-cache ${PHP_DEPS}; \
# or pecl installation
pecl install xdebug; \
# clean up (remove build packages)
apk del .build-deps
CMD ["php-fpm7", "-F"]
我认为你只需要安装 musl-dev
包(musl c 库 (libc) 实现):
FROM alpine:3.7
RUN apk update && apk upgrade
RUN apk add --no-cache php7-pear php7-dev gcc musl-dev make
RUN pecl install xdebug
好吧,其实问题是我对 dockerfiles 的误解。
- 作为
RUN
命令 运行 在单独的容器中工作目录不会持久化。必须使用WORKDIR
而不是 cd "$_"
无效
因此我在根文件夹中提取了 PHP 源,我猜这弄乱了一些文件。一旦提取到自己的文件夹中,编译工作正常。