• 关于在64位linux下开发32位linux程序的一些问题,ubuntu,debian,opensuse


    1,debian x64上支行ubuntuX64编译的32位程序 

    Linux debian 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64

    需要安装包

    apt-get install lib32stdc++6
    apt install glibc-devel.i686 glibc-devel
    apt-get install lib32z1-dev

    apt install libc6-dev-i386

    软件包:lib32z1-dev(1:1.2.8.dfsg-2+deb8u1) [security]
    lib32z1-dev 的相关链接
    Screenshot
    Debian 的资源:
    报告问题
    开发者信息
    Debian Changelog
    版权文件
    Debian 补丁追踪网站
    下载源码包 zlib:
    [zlib_1.2.8.dfsg-2+deb8u1.dsc]
    [zlib_1.2.8.dfsg.orig.tar.gz]
    [zlib_1.2.8.dfsg-2+deb8u1.debian.tar.xz]
    维护者:
    Mark Brown (QA 页面)
    外部的资源:
    主页 [zlib.net]
    相似软件包:
    lib64z1-dev
    libz-mingw-w64-dev
    lib32z1
    libz-mingw-w64
    zlib1g-dev
    libn32z1-dev
    zlib1g-dbg
    lib64z1
    zlib1g
    compression library - 32 bit development
    zlib is a library implementing the deflate compression method found in gzip and PKZIP. This package includes the development support files for building 32 bit applications.
    
    其他与 lib32z1-dev 有关的软件包
    依赖
    推荐
    建议
    增强
    dep: lib32c-dev
    本虚包由这些包填实: libc6-dev-i386
    dep: lib32z1 (= 1:1.2.8.dfsg-2+deb8u1)
    compression library - 32 bit runtime
    dep: zlib1g-dev (= 1:1.2.8.dfsg-2+deb8u1)
    压缩库 - 开发文件

    有32位的环境后,在/下可以看见

     lib32,lib64的库,程序就可以运行了.

    使用file ,ldd 命令查看

     可以正常加载x86的地址了.

    2,opensuse

    openSUSE-Update-Leap-15.1 ,x64

    zyppper install glibc-devel-32bit
    zypper install libstdc++-devel-32bit 
    zypper install libstdc++6-32bit  
    前几天在64位linux下开发跨平台的代码,包括32位和64位的版本都需要编译,在给g++加上-m32开关之后,g++报了一个错误:
    
    gnu/stubs-32.h: No such file or directory compilation terminated. make: ***
    
    在网上翻了一圈,情况就是64位linux缺省只安装了64位的头文件和Lib版本,需要增加32位的版本库,网上提到的安装方法一般是CentOs, Ubuntu之类的发行版,我用的是OpenSuse,最后在老外的网页上找到了一个比较全面的各个版本的安装说明:
    
    You need 32bit embedded GNU C Library. This incldes development Libraries, header files, contains the symlinks, headers, and object files needed to compile and link programs which use the standard C library.
    
    Fix for Debian Linux
    Type the following command:
    $ sudo apt-get install libc6-dev
    
    Fix for Ubuntu Linux
    Type the following command:
    $ sudo apt-get install libc6-dev-i386
    
    Fix for OpenSUSE / Novell Suse Linux (SLES)
    Type the following command:
    # zypper in glibc-devel-32bit
    
    Fix for RHEL / Fedora / CentOS / Scientific Linux
    Type the following command:
    # yum install glibc-devel.i686
    
     
    
    安装了头文件,还要注意安装库文件,方法同上,包括以下库:
    
    gcc-32bit gcc7-32bit libstdc++6-gcc7-32bit libstdc++6-gcc7-locale libstdc++6-locale

     3,ubuntu x64上支行32位程序 

    Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-142-generic x86_64)

    apt-get install ia32-libs
    apt-get install lib32ncurses5 ​
    apt-get install lib32z1
    apt-get install lib32z1-dev
    apt install libc6-dev-i386
    Ubuntu apt-get install ia32 for 32-bit on 64-bit
    先更新 ia32的库
    
    复制代码
    https://www.cnblogs.com/tianciliangen/articles/3395973.html
    
    
    To install 32-bit libraries on a 64-bit linux system
    Install:
    
      $ apt-get install ia32-libs
    To install 32-bit libraries for development
    Install:
    
      $ apt-get install lib32gcc1 libc6-i386 lib32z1 lib32stdc++6
      $ apt-get install lib32asound2 lib32ncurses5 lib32gomp1 lib32z1-dev lib32bz2-dev
      $ apt-get install g++-multilib
    You may need this too, or it may be a virtual package already provided:
    
      $ apt-get install ia32-libs-gtk
    You may need a symlink, which g++-multilib may set up for you automatically:
    
      $ ln -s /usr/lib32/libstdc++.so.6 /usr/lib32/libstdc++.so
    Update LD_LIBRARY_PATH
    You may need to add the LD path, for example like this:
    
      $ edit /etc/profile
      ... add these lines...
      LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib32:/usr/lib32
      export LD_LIBRARY_PATH
    To compile with gcc
    To compile things with gcc, you need to add the flag -m32 like this:
    
      gcc -m32 myfile.c
    

      

  • 相关阅读:
    [VB]用API打开浏览文件夹对话框,选择文件夹
    C# 16进制与字符串、字节数组之间的转换
    DIV未知高度的垂直居中代码
    Webbrowser控件判断网页加载完毕的简单方法
    一些控制鼠标的例子!
    Kernel device tree: simplebus
    Display Serial Interface (From WIKI)
    消费提示:常见 处理器/显卡 性能排名网站 汇总
    HDMI notes From HDMI wiki
    Linux graphics stack 理解
  • 原文地址:https://www.cnblogs.com/bleachli/p/12780848.html
Copyright © 2020-2023  润新知