Qihoo360 / QConf

Qihoo Distributed Configuration Management System
Other
1.87k stars 534 forks source link

debian10 下编译报错 #121

Open ghost opened 5 years ago

ghost commented 5 years ago

使用php:7.3.10-fpm(debian10) 的基础镜像编译报错,大神可否指导一下

image

dockerfile 如下

FROM php:7.3.10-fpm

COPY sources.list   /etc/apt/sources.list

RUN apt-get update && apt-get install -y cmake

ENV QCONF_VER 1.2.1

RUN curl -fSL https://github.com/Qihoo360/QConf/archive/${QCONF_VER}.tar.gz -o /tmp/qconf-${QCONF_VER}.tar.gz

RUN cd /tmp/ \
  && ( \
    tar -xf qconf-${QCONF_VER}.tar.gz \
    && rm -f qconf-${QCONF_VER}.tar.gz \
    && cd QConf-${QCONF_VER} \
    && mkdir build \
    && cd build \
    && cmake .. \
    && make -j "$(nproc)" \
    && make install \
    && cd ../driver/php/ \
    && phpize \
    && ./configure --enable-qconf --with-libqconf-dir=/usr/local/qconf/include --enable-static LDFLAGS=/usr/local/lib/libqconf.a \
    && make -j "$(nproc)" \
    && make install \
    && cd ../../../ \
    && rm -fr QConf-${QCONF_VER} \
  ) \
  && docker-php-ext-enable qconf

CMakeError.log

root@ae2443d78b62:/tmp/QConf-1.2.1/build/CMakeFiles# cat CMakeError.log
Determining if the pthread_create exist failed with the following output:
Change Dir: /tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_37d96/fast"
/usr/bin/make -f CMakeFiles/cmTC_37d96.dir/build.make CMakeFiles/cmTC_37d96.dir/build
make[1]: Entering directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_37d96.dir/CheckSymbolExists.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_37d96.dir/CheckSymbolExists.c.o   -c /tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_37d96
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_37d96.dir/link.txt --verbose=1
/usr/bin/cc      -rdynamic CMakeFiles/cmTC_37d96.dir/CheckSymbolExists.c.o  -o cmTC_37d96
/usr/bin/ld: CMakeFiles/cmTC_37d96.dir/CheckSymbolExists.c.o: in function `main':
CheckSymbolExists.c:(.text+0x1b): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_37d96.dir/build.make:87: cmTC_37d96] Error 1
make[1]: Leaving directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_37d96/fast] Error 2

File /tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_b2d8c/fast"
/usr/bin/make -f CMakeFiles/cmTC_b2d8c.dir/build.make CMakeFiles/cmTC_b2d8c.dir/build
make[1]: Entering directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_b2d8c.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_b2d8c.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.13/Modules/CheckFunctionExists.c
Linking C executable cmTC_b2d8c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b2d8c.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_b2d8c.dir/CheckFunctionExists.c.o  -o cmTC_b2d8c -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
make[1]: *** [CMakeFiles/cmTC_b2d8c.dir/build.make:87: cmTC_b2d8c] Error 1
make[1]: Leaving directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:121: cmTC_b2d8c/fast] Error 2

部分 CMakeOutput.log

    ......
    Feature record: CXX_FEATURE:0cxx_variadic_macros
    Feature record: CXX_FEATURE:0cxx_variadic_templates
Determining if the include file pthread.h exists passed with the following output:
Change Dir: /tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_30a8f/fast"
/usr/bin/make -f CMakeFiles/cmTC_30a8f.dir/build.make CMakeFiles/cmTC_30a8f.dir/build
make[1]: Entering directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_30a8f.dir/CheckIncludeFile.c.o
/usr/bin/cc    -o CMakeFiles/cmTC_30a8f.dir/CheckIncludeFile.c.o   -c /tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
Linking C executable cmTC_30a8f
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_30a8f.dir/link.txt --verbose=1
/usr/bin/cc      -rdynamic CMakeFiles/cmTC_30a8f.dir/CheckIncludeFile.c.o  -o cmTC_30a8f
make[1]: Leaving directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'

Determining if the function pthread_create exists in the pthread passed with the following output:
Change Dir: /tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_75b4b/fast"
/usr/bin/make -f CMakeFiles/cmTC_75b4b.dir/build.make CMakeFiles/cmTC_75b4b.dir/build
make[1]: Entering directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_75b4b.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_75b4b.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.13/Modules/CheckFunctionExists.c
Linking C executable cmTC_75b4b
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_75b4b.dir/link.txt --verbose=1
/usr/bin/cc  -DCHECK_FUNCTION_EXISTS=pthread_create    -rdynamic CMakeFiles/cmTC_75b4b.dir/CheckFunctionExists.c.o  -o cmTC_75b4b -lpthread
make[1]: Leaving directory '/tmp/QConf-1.2.1/build/CMakeFiles/CMakeTmp'
ghost commented 5 years ago

相关问题讨论 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=897892

修改 ./deps/zookeeper/src/zookeeper.c

3427 行 为static char buf[256];

增加buf大小后即可正常编译

但是不知道会有什么隐患

image