编译64位Linux的32位GTK +应用程序 [英] Compiling 32-bit GTK+ Applications of 64 bit Linux

查看:128
本文介绍了编译64位Linux的32位GTK +应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编译64位Linux上的32位GTK +应用程序时遇到了一些麻烦,特别是Ubuntu 10.04。编译64位GTK +应用程序可以正常工作,并且所有设置都可以编译32位应用程序,但它不适用于GTK +。



我有一个很简单的测试程序,我正在用于故障排除,它只是一个gtk_init和一个gtk_main,它编译为-m64。我正在用gcc 4.6.2编译,调用它:

  gcc -m32 gtktest.c`pkg-config --cflags gtk + -2.0`pkg-config --libs gtk + -2.0` 

这是两种不同的类型我得到的错误消息:

  /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.2 /../../../../x86_64-unknown-linux-gnu/bin/ld:warning:libXext.so.6,需要/usr/lib/../lib32/libgtk-x11-2.0 .so,找不到(尝试使用-rpath或-rpath-link)

  / usr / lib /../ lib32 / libgdk-x11-2.0.so:对'XmbSetWMProperties'的

请记住,这些不是唯一的错误,我只是包含了两个特定类型以供参考并保持简短,我收到了整个GTK +库的错误。



我在lib32文件夹中拥有所有正确的32位版本的库。



Hopefull有人遇到过这个问题并且可以帮助我,这真的让我非常头痛,并且我无法在网上的任何地方给予很多帮助。



请问是否有任何问题您需要我提供的其他信息来帮助诊断此问题。



注意:我确实有ia32-libs和gcc-multilib软件包。 Ubuntu 10.04没有单独的ia32-libs-gtk软件包,但是我认为它们被包装到ia32-libs软件包中。他们都出现在我的系统上。



我认为这必定是某种链接器配置问题。我最近构建了新的Free Pascal编译器和一个32位交叉编译器,并且我还将GCC升级到了4.6.2,以充分利用一些新的C ++特性并修复了C99支持。我的系统中仍然存在默认的4.4.3 GCC。在我认为问题已经出现的时候,我安装了一个新的binutils,因为我一直在试验Clang和LLVM作为工具链,并且我想要和ld提供插件功能,所以我认为不妨升级它们。

一切工作都很好,编译64位程序,新工具根本没有问题,我可以编译32位程序,但是当它出现我知道我目前的一套库是合适的,并且我已经安装了Free Basic,它只能发出32位代码,而我在升级之前,能够构建32位GTK +程序没有任何问题。



只是想知道是否有人有任何想法可以在此升级中更改配置或者已经拥有此功能发生在他们面前?我真的应该升级到一个更新的发行版,这样我就可以利用所有新软件无需破解我的所有软件包,但不幸的是,新内核中存在一个错误,它会阻止我的计算机从待机状态返回,这是我用于个人项目的笔记本电脑,所以适当的电源管理非常重要,如果我使用系统,这不是一个巨大的损失,除非我的工作流程设置得非常完美。

解决方案

您可以告诉pkg-config使用环境变量PKG_CONFIG_PATH搜索32位库。
对于Ubuntu,

  export PKG_CONFIG_PATH = / usr / lib32 / pkgconfig:$ PKG_CONFIG_PATH 

  export PKG_CONFIG_PATH = / usr / lib / pkgconfig:$ PKG_CONFIG_PATH 


I am having some trouble compiling 32-bit GTK+ applications on 64-bit Linux, specifically Ubuntu 10.04. Compiling 64-bit GTK+ applications works fine, and everything is set up to compile 32-bit apps as well, but it doesn't work with GTK+

I have a very simple test program that I am using for trouble shooting that is simply a gtk_init and a gtk_main, which compiles fine as -m64. I am compiling with gcc 4.6.2, calling it with:

gcc -m32 gtktest.c `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`

These are the two different kinds of error messages I get:

/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../x86_64-unknown-linux-gnu/bin/ld: warning: libXext.so.6, needed by /usr/lib/../lib32/libgtk-x11-2.0.so, not found (try using -rpath or -rpath-link)

and

/usr/lib/../lib32/libgdk-x11-2.0.so: undefined reference to `XmbSetWMProperties'

Keep in mind that these aren't the only errors, I just included the two specific types for reference and to keep it short, I get errors for the whole stack of GTK+ libraries.

I do have all of the proper 32-bit versions of the libraries in my lib32 folders.

Hopefull someone has had this problem before and can help me, this is really causing me quite the headaches, and I can't fine much help any where on the net.

Please ask if there is any other information you need me to provide to help with diagnosing this problem.

Note: I do have the ia32-libs and gcc-multilib packages. Ubuntu 10.04 does not have a separate ia32-libs-gtk packages, but I think these are wrapped in to the ia32-libs packages. They all are present on my system.

I think this must be some sort of linker config problem. I've recently built the new Free Pascal compiler and a 32 bit cross compiler, and I also upgraded GCC to 4.6.2 to take advantage of some of the new C++ features and fixes to C99 support. The default 4.4.3 GCC still exists on my system. Where I think the problem has been introduced is when I installed a new binutils because I've been experimenting with Clang and LLVM as a toolchain, and I wanted and ld with plug-in capabilities, so I figured might as well upgrade them all.

Everything works fine compiling 64 bit programs, there hasn't been a single problem with the new tools at all, and I can compile 32-bit programs but when it comes time to explicitly link something in I have problems.

I know my current set of libs is appropriate, and I have Free Basic installed which only emits 32 bit code, and I was able to build 32-bit GTK+ programs no problem before this upgrade.

Just wondering if anyone has any ideas what configs might have been changed in this upgrade or has had this happen to them before? I really should upgrade to a newer distro so I can take advantage of all the new software with out have to hack up all of my packages, but unfortunatly there is a bug in the newer kernels that prevents my computer from coming back from standby, and this is a laptop I use for personal side projects, so proper power management is pretty important, and it's not a huge loss if I bork the system, other than I have it set up pretty much perfect for my workflow.

解决方案

You may tell pkg-config to search for the 32-bit libraries with the environment variable PKG_CONFIG_PATH. For Ubuntu,

export PKG_CONFIG_PATH=/usr/lib32/pkgconfig:$PKG_CONFIG_PATH

For Redhat,

export PKG_CONFIG_PATH=/usr/lib/pkgconfig:$PKG_CONFIG_PATH

这篇关于编译64位Linux的32位GTK +应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆