设为首页收藏本站返回主页

Ubuntu Kylin技术论坛

 找回密码
 立即注册
搜索
查看: 6918|回复: 7
打印 上一主题 下一主题

ubuntu16.04 编译Android5.1报错

[复制链接]
  • TA的每日心情
    开心
    2016-5-17 10:29
  • 签到天数: 1 天

    [LV.1]初来乍到

    跳转到指定楼层
    楼主
    发表于 2016-5-12 16:04:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    hi kylin team,
        我使用 ubuntu16.04 构建 android 编译环境后编译 android5.1 时出现如下报错。请向开发团队反馈看能否给出解决方案,谢谢!

    当我使用 ubuntu16.04 构建 Android 编译环境后, 编译报错. 报错信息如下:
    /home/.../proj/.../anroidsrcroot/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/../lib/gcc/x86_64-linux/4.6/../../../../x86_64-linux/bin/ld: error: out/host/linux-x86/obj32/STATIC_LIBRARIES/libcompiler_rt_intermediates/libcompiler_rt.a(eprintf.o): unsupported reloc 43 against global symbol stderr
    external/compiler-rt/lib/builtins/eprintf.c:32: error: unsupported reloc 43
    collect2: ld returned 1 exit status
    host C++: libnativehelper_32 <= libnativehelper/JNIHelp.cpp
    make: *** [out/host/linux-x86/obj32/lib/libcompiler_rt.so] Error 1
    make: *** 正在等待未完成的任务....

    请问如何解决该报错? 我确认编译环境安装 OK, 下面是 ubuntu16.04 上安装工具的版本信息:
    root@... :~# sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dri:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 dpkg-dev
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    bison is already the newest version (2:3.0.4.dfsg-1).
    build-essential is already the newest version (12.1ubuntu2).
    curl is already the newest version (7.47.0-1ubuntu2).
    dpkg-dev is already the newest version (1.18.4ubuntu1).
    flex is already the newest version (2.6.0-11).
    g++-multilib is already the newest version (4:5.3.1-1ubuntu1).
    git is already the newest version (1:2.7.4-0ubuntu1).
    gnupg is already the newest version (1.4.20-1ubuntu3).
    libc6-dev is already the newest version (2.23-0ubuntu3).
    libgl1-mesa-dev is already the newest version (11.2.0-1ubuntu2).
    libxml2-utils is already the newest version (2.9.3+dfsg1-1).
    x11proto-core-dev is already the newest version (7.0.28-2ubuntu1).
    xsltproc is already the newest version (1.1.28-2.1).
    zip is already the newest version (3.0-11).
    libgl1-mesa-dri:i386 is already the newest version (11.2.0-1ubuntu2).
    libncurses5-dev:i386 is already the newest version (6.0+20160213-1ubuntu1).
    libreadline6-dev:i386 is already the newest version (6.3-8ubuntu2).
    libx11-dev:i386 is already the newest version (2:1.6.3-1ubuntu2).
    zlib1g-dev:i386 is already the newest version (1:1.2.8.dfsg-2ubuntu4).
    gperf is already the newest version (3.0.4-2).
    python-markdown is already the newest version (2.6.6-1).
    tofrodos is already the newest version (1.7.13+ds-2ubuntu1).
    mingw32 is already the newest version (4.2.1.dfsg-2ubuntu1).
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

    宿主机环境 binutils 版本信息:
    root@...:~# apt-get install binutils
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    binutils is already the newest version (2.26-8ubuntu2).
    0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
    root@...:~# objdump -v
    GNU objdump (GNU Binutils for Ubuntu) 2.26
    Copyright (C) 2015 Free Software Foundation, Inc.
    This program is free software; you may redistribute it under the terms of
    the GNU General Public License version 3 or (at your option) any later version.
    This program has absolutely no warranty.

    宿主机环境 gcc 版本信息:
    root@...:~# gcc --version
    gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    从报错信息来看,是在链接 host 程序时出错。链接 host 程序时用的工具链是放在 codebase 中的,即 prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/../lib/gcc/x86_64-linux/4.6/../../../../x86_64-linux/bin/ld.
    1. 搞不明白,既然工具链在 codebase 中,也就不应该依赖宿主机 gcc 和 binutils, 就算我宿主机 gcc 和 binutils 版本较高,也不应该报此错误?
    2. 请问如何解决此错误?降级宿主机 binutils 版本吗?
    3. 在 ubuntu16.04 上编译贵司代码时,我还曾遇见另一个错误由 make 报出,即 ***recipe commence before first target, 查看 make 版本是 4.1, 后来重新覆盖安装 make 3.81 解决。

    长期来看编译环境迁移到 ubuntu16.04 LTS 是必然的事情,因此非常期待贵司的解答,谢谢!

    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    昨天 08:48
  • 签到天数: 791 天

    [LV.10]以坛为家III

    推荐
    发表于 2016-5-13 09:53:31 | 只看该作者
    似乎是binutil的问题哦,ubuntu 1604都在报这个错误,参考:
    http://forum.ubuntu.org.cn/viewtopic.php?f=122&t=477707

    另外看到某个论坛某人的解决方案,不知道是否有效:
    1: sudo apt-get update binutils
    2: apt-cache search linux-image
    3: apt-get install linux-headers-4.3.0-1-amd64
    4: apt-get install linux-image-4.3.0-1-amd64-dbg
    5. apt-get install linux-image-4.3.0-1-amd64
    6. Restart

    不行的话就只能等更新了,上游应该是收到这个bug了。
    回复 支持 1 反对 0

    使用道具 举报

  • TA的每日心情
    开心
    2016-5-17 10:29
  • 签到天数: 1 天

    [LV.1]初来乍到

    沙发
     楼主| 发表于 2016-5-12 16:06:46 | 只看该作者
    只能说,工具链兼容性做得很一般。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2016-5-17 10:29
  • 签到天数: 1 天

    [LV.1]初来乍到

    板凳
     楼主| 发表于 2016-5-12 16:26:23 | 只看该作者
    unsupported reloc 43 是什么鬼,特么的不过调了个 fprintf 就报这种错,还要人活不
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2016-5-17 10:29
  • 签到天数: 1 天

    [LV.1]初来乍到

    地板
     楼主| 发表于 2016-5-12 16:27:38 | 只看该作者
      1 /* ===---------- eprintf.c - Implements __eprintf --------------------------===
      2  *
      3  *                     The LLVM Compiler Infrastructure
      4  *
      5  * This file is dual licensed under the MIT and the University of Illinois Open
      6  * Source Licenses. See LICENSE.TXT for details.
      7  *
      8  * ===----------------------------------------------------------------------===
      9  */
    10
    11
    12
    13 #include "int_lib.h"
    14 #include <stdio.h>
    15
    16
    17 /*
    18  * __eprintf() was used in an old version of <assert.h>.
    19  * It can eventually go away, but it is needed when linking
    20  * .o files built with the old <assert.h>.
    21  *
    22  * It should never be exported from a dylib, so it is marked
    23  * visibility hidden.
    24  */
    25 #ifndef _WIN32
    26 __attribute__((visibility("hidden")))
    27 #endif
    28 COMPILER_RT_ABI void
    29 __eprintf(const char* format, const char* assertion_expression,
    30           const char* line, const char* file)
    31 {
    32         fprintf(stderr, format, assertion_expression, line, file);
    33         fflush(stderr);
    34         compilerrt_abort();
    35 }

    第 32 行
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2016-5-17 10:29
  • 签到天数: 1 天

    [LV.1]初来乍到

    5#
     楼主| 发表于 2016-5-12 16:34:02 | 只看该作者
    顶起来。ubuntu12.04 工作得好好的。越整越回去了。
    话说这个论坛的管理员到底有没有途径和权限反馈此问题。希望 kylin team 可以早点收到反馈。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2016-5-17 10:29
  • 签到天数: 1 天

    [LV.1]初来乍到

    7#
     楼主| 发表于 2016-5-18 14:03:52 | 只看该作者
    本帖最后由 madaossan 于 2016-5-18 14:07 编辑
    handsome_feng 发表于 2016-5-13 09:53
    似乎是binutil的问题哦,ubuntu 1604都在报这个错误,参考:
    http://forum.ubuntu.org.cn/viewtopic.php?f ...

    谢斑竹。
    链接中提到将 prebuilt 里面的 ld.gold 替换成系统的就可以,但会报另外一个错误,也是解不了。
    如果是 linux-header / vmlinux 问题,我自己编译了 3.18.8 的 kernel 并做了 make headers_install, 没用。
    降级 libc6-dev / gcc / binutils 什么的还没试,话说我也不知道怎么用 apt-get 安全降级(斑竹如果知道可以顺道讲讲,不要步骤复杂的,最好我能很快理解那种...,如果有科普链接也可以贴下,再谢斑竹^_^),还怕有的东西可能要找旧版本的源,或者是 ppa 源什么的, add 之后 apt-get update 时公司破网络有时候也不是什么都源都能用,搞不好还得改回来,实在懒得折腾。
    搞了两天了,被折磨的心慌,没法干活了,还是换回老 12.04 版本算了,郁闷...
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    昨天 08:48
  • 签到天数: 791 天

    [LV.10]以坛为家III

    8#
    发表于 2016-5-18 14:19:57 | 只看该作者
    madaossan 发表于 2016-5-18 14:03
    谢斑竹。
    链接中提到将 prebuilt 里面的 ld.gold 替换成系统的就可以,但会报另外一个错误,也是解不了 ...

    用apt-cache policy gcc 可以查看源里gcc的版本,例如查到的是4:5.3.1-1ubuntu1,则可以通过
    sudo apt-get install gcc=4:5.3.1-1ubuntu1 来安装特殊版本,如果添加了老版本的源,就可以这样退回到以前版本了,但是很有可能破坏其他的依赖,导致整个系统紊乱,我觉得你还是先用1404吧,这个长期支持版也还在支持周期内,1204还是太老了。
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    小黑屋|手机版|Archiver|Ubuntu Kylin    

    GMT+8, 2018-1-6 14:43 , Processed in 0.189882 second(s), 13 queries , File On.

    Powered by Discuz! X3.3

    © 2001-2017 Comsenz Inc.

    快速回复 返回顶部 返回列表