【问题标题】:Errors compiling Mesos on Alpine Linux在 Alpine Linux 上编译 Mesos 时出错
【发布时间】:2016-02-24 22:56:20
【问题描述】:

我正在尝试基于 Alpine Linux 创建一个用于测试的 Mesos 0.27.1 映像,并且通过反复试验,我已经成功地完成了大部分编译。现在我遇到了一个看起来非常低级的错误,我想知道这是否意味着我根本无法在 Alpine 上使用 Mesos。

错误是这样的:

libtool: compile:  g++ -DPACKAGE_NAME=\"libprocess\" -DPACKAGE_TARNAME=\"libprocess\" -DPACKAGE_VERSION=\"0.0.1\" "-DPACKAGE_STRING=\"libprocess 0.0.1\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libprocess\" -DVERSION=\"0.0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_APR_POOLS_H=1 -DHAVE_LIBAPR_1=1 -DHAVE_SVN_VERSION_H=1 -DHAVE_LIBSVN_SUBR_1=1 -DHAVE_SVN_DELTA_H=1 -DHAVE_LIBSVN_DELTA_1=1 -DHAVE_LIBCURL=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DHAVE_LIBZ=1 -DHAVE_LIBDL=1 -I. -DBUILD_DIR=\"/usr/src/mesos-0.27.1/3rdparty/libprocess\" -I./include -I./3rdparty/stout/include -isystem 3rdparty/boost-1.53.0 -I3rdparty/libev-4.15 -I3rdparty/picojson-1.3.0 -DPICOJSON_USE_INT64 -D__STDC_FORMAT_MACROS -I3rdparty/glog-0.3.3/src -I3rdparty/ry-http-parser-1c3624a -I/usr/include/subversion-1 -I/usr/include/apr-1 -I/usr/include/apr-1.0 -g1 -O0 -Wno-unused-local-typedefs -std=c++11 -MT libprocess_la-logging.lo -MD -MP -MF .deps/libprocess_la-logging.Tpo -c src/logging.cpp  -fPIC -DPIC -o libprocess_la-logging.o
In file included from ./include/process/time.hpp:18:0,
                 from ./include/process/clock.hpp:18,
                 from ./include/process/delay.hpp:16,
                 from src/logging.cpp:15:
./3rdparty/stout/include/stout/duration.hpp:80:27: error: 'timeval' does not name a type
   explicit Duration(const timeval& t)
                           ^
./3rdparty/stout/include/stout/duration.hpp: In constructor 'Duration::Duration(const int&)':
./3rdparty/stout/include/stout/duration.hpp:82:15: error: request for member 'tv_sec' in 't', which is of non-class type 'const int'
     nanos = t.tv_sec * SECONDS + t.tv_usec * MICROSECONDS;
               ^
./3rdparty/stout/include/stout/duration.hpp:82:36: error: request for member 'tv_usec' in 't', which is of non-class type 'const int'
     nanos = t.tv_sec * SECONDS + t.tv_usec * MICROSECONDS;
                                    ^
./3rdparty/stout/include/stout/duration.hpp: In member function 'timeval Duration::timeval() const':
./3rdparty/stout/include/stout/duration.hpp:95:3: error: return type 'struct timeval' is incomplete
   {
   ^
./3rdparty/stout/include/stout/duration.hpp:96:20: error: aggregate 'timeval t' has incomplete type and cannot be defined
     struct timeval t;
                    ^
Makefile:844: recipe for target 'libprocess_la-logging.lo' failed
make[4]: *** [libprocess_la-logging.lo] Error 1
make[4]: Leaving directory '/usr/src/mesos-0.27.1/3rdparty/libprocess'
Makefile:1321: recipe for target 'all-recursive' failed
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory '/usr/src/mesos-0.27.1/3rdparty/libprocess'
Makefile:490: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/usr/src/mesos-0.27.1/3rdparty'
Makefile:443: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/usr/src/mesos-0.27.1/3rdparty'
Makefile:682: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

我现在应该放弃所有希望并放弃这项努力吗?

【问题讨论】:

  • 你为什么使用 Alpine Linux?因为它比最小的 GNU/Linux 小几 MB?不要跟随炒作!至少除非你能够面对后果。
  • 看起来您在过程中的某处缺少包含 time.h 的内容。通常time.h 将包括sys/time.h,其中包括bits/time.h,这就是timevaltv_sectv_usec 的定义所在。
  • 我怀疑这是否可行,因为 glibcmusl libc 存在差异...
  • DavidC.Rankin- 我添加了 linux-headers apk,所以如果我需要添加另一个开发包,我很乐意将其添加到列表中。 Tobi- 我想知道这是否会是这样。我可以使用最小的 Ubuntu,Mesos 可以在上面运行(并且有预构建的软件包),但我想看看我是否可以让 Alipine 工作。 hek2mgl- 随便...

标签: linux mesos alpine


【解决方案1】:

我有一个可以编译的构建。如果你想看看我做了什么,你可以从这里开始:

https://github.com/jimfcarroll/mesos-on-alpine/blob/alpine/alpine/build.sh

你可以这样使用它:

https://github.com/jimfcarroll/mesos-on-alpine/blob/alpine/alpine/README

它对系统包含文件进行了更改,并且有一个代码补丁,它从我的 mesos 高山分支中挑选出来。您可以查看这些内容以了解更改内容。

它可以正常运行,但是大约有 10-15 个测试失败。

其中一些失败与 Alpine 标准命令(如:“cp”和“du”)采用与 mesos 预期不同的参数有关。

至少有一个是因为我的补丁消除了与 mesos 读取 fstab 相关的功能。

我不确定其他人。

我的目标不是获得基于 alpine 的 mesos-master 和 mesos-slave(尽管如果我能做到那会很好),而是构建 libmesos.so 以便我可以运行基于 Docker Alpine 的 Mesos通过在构建库后移动它们来构建框架。

编辑:我应该注意,我还没有让它成功地针对 mesosphere 发布的 mesos-master 和 mesos-slave 工作,所以以此为起点。我很想看看是否有人取得了更大的进步。

【讨论】:

    【解决方案2】:

    我今天遇到了这个问题,answer from David C Rankin 帮助我完成了这项工作。在/3rdparty/libprocess/3rdparty/stout/include/stout/duration.hpp 中,我刚刚在#include time.h 的调用下添加了#include <sys/time.h>

    之后,您可能会遇到安装 POM 的问题(ssl 证书不存在且未找到 tools.jar),但这些问题超出了此答案的范围。

    【讨论】:

    • 我通过在大约三个地方修补代码来获得编译以帮助父亲。但是我最终在围绕 fstab 使用的编译中遇到了死胡同。从那里我不知道可以做些什么来解决这个问题,因为这似乎与 musl libc 差异有关。
    【解决方案3】:

    从 Git 中的最新代码开始,Mesos 现在应该在开箱即用的 Alpine Linux 上构建(请参阅https://issues.apache.org/jira/browse/MESOS-5540)——这些更改应该包含在后续的 Apache Mesos 版本中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-18
      • 1970-01-01
      相关资源
      最近更新 更多