【问题标题】:Trying to compile GTK application for 32bit linux from 64bit linux尝试从 64 位 linux 为 32 位 linux 编译 GTK 应用程序
【发布时间】:2016-11-13 19:13:51
【问题描述】:

我正在尝试从 64 位 linux 为 32 位 linux 编译 GTK 应用程序。

当我运行这个命令时:

gcc main.c -m32 -mms-bitfields -o output/main `pkg-config --cflags --libs gtk+-3.0` && ./output/main

我收到以下错误:

/usr/bin/ld: cannot find -lgtk-3
/usr/bin/ld: cannot find -lgdk-3
/usr/bin/ld: cannot find -latk-1.0
/usr/bin/ld: cannot find -lgio-2.0
/usr/bin/ld: cannot find -lpangocairo-1.0
/usr/bin/ld: cannot find -lgdk_pixbuf-2.0
/usr/bin/ld: cannot find -lcairo-gobject
/usr/bin/ld: cannot find -lpango-1.0
/usr/bin/ld: cannot find -lcairo
/usr/bin/ld: cannot find -lgobject-2.0
/usr/bin/ld: cannot find -lglib-2.0
collect2: error: ld returned 1 exit status

运行 Linux Mint 17.2 Rafaela。

我有所有必需的包,我什至包括了-m32 选项,但它仍然不起作用。

还有一个类似的问题here 没有被接受的答案。

编辑:

下面接受的答案建议我安装 32 位版本的 libgtk-3-dev。如果不删除重要的系统包,我就无法做到这一点。最后,我只好使用安装了 32 位版本的 libgtk-3-dev 的 32 位 Linux 发行版。

【问题讨论】:

    标签: linux gcc gtk cross-platform cpu-architecture


    【解决方案1】:

    你可以跑:

    apt-get install libgtk-3-dev:i386
    

    然后重新运行您的编译命令,它应该可以工作。如果上面的命令返回一个错误说它找不到指定的包,你可能需要运行它,然后再试一次:

    dpkg --add-architecture i386
    

    警告:如果上面的命令要求您删除软件包,请仔细阅读列表,如果列表中包含重要的系统软件包或者您不确定,请不要继续。

    【讨论】:

    • 如何撤消dpkg --add-architecture i386的影响,我试过sudo dpkg --remove-architecture i386但我得到了这个错误-dpkg: error: cannot remove architecture 'i386' currently in use by the database
    • 您是否删除了 libgtk-3-dev:i386 及其所有依赖项?
    • 我没有安装它。当它说要删除一堆包时,我停了下来,其中一个是桌面环境。
    • 找到解决方案/解释。 link
    • wiki.debian.org/Multiarchthe immediate practical effects are getting rid of the ia32-libs package, and allowing proper cross-architecture dependencies for cross-building. 根据那个 wiki,dpkg 在 2011 年开始支持多架构。
    猜你喜欢
    • 2012-01-05
    • 1970-01-01
    • 1970-01-01
    • 2011-04-03
    • 2017-04-07
    • 1970-01-01
    • 1970-01-01
    • 2019-10-01
    • 1970-01-01
    相关资源
    最近更新 更多