zoukankan      html  css  js  c++  java
  • Win10 Ubuntu子系统运行32bit Linux原生程序

    本文主要描述的是:解决  Win10 Ubuntu子系统中运行  32bit Linux原生程序 报错  Exec format error

    问题来源于  在 Win10 Ubuntu子系统中运行  Linux原生交叉编译器  32bit  gcc  。

    解压gcc 后直接运行

    ./arm-linux-gcc -v     报错 :  Exec format error

    按照常规方式   :  原生 Ubuntu 添加 32bit 运行环境

    sudo dpkg --add-architecture i386
    sudo apt-get update
    sudo apt-get install libc6:i386
    sudo apt-get install lib32ncurses5 ​lib32ncurses5-dev
    sudo apt-get install lib32z1

    并没有解决问题。

    报错同样是   Exec format error

    通过  readelf  -a  arm-linux-gcc  检查程序导出表发现问题

    readelf  命令报错:Not an ELF file - it has the wrong magic bytes at the start 

    初步确定问题来源,子系统不支持原生linux文件头。

    而后通过搜索此错误找到相关english网页。 此问题。

    解决方式如下:

    添加xxx形式文件头支持

    1 sudo apt update
    2 sudo apt install qemu-user-static
    3 sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic 'x7fELFx01x01x01x03x00x00x00x00x00x00x00x00x03x00x03x00x01x00x00x00' --mask 'xffxffxffxffxffxffxffxfcxffxffxffxffxffxffxffxffxf8xffxffxffxffxffxffxff'

    可能还有其他依赖需要安装,按照原生linux 的教程即可。  一直在找问题 安装了不少东西,其中有没有用未知。

  • 相关阅读:
    Linux 运维工程师的十个基本技能点
    如何在 Ubuntu 15.04 系统中安装 Logwatch
    线性表的 链式存储
    线性表的 顺序存储
    数据结构 基础知识
    struct和typedef struct
    虚拟内存
    Spring AOP
    常量池、perm(持久代)、方法区、栈
    String类型的对象,是保存在堆里还是在栈里呢?
  • 原文地址:https://www.cnblogs.com/JiuHuan/p/10073632.html
Copyright © 2011-2022 走看看