我正在尝试从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位Linux发行版,安装了32位版本的libgtk-3-dev
。
答案 0 :(得分:2)
You could run:
apt-get install libgtk-3-dev:i386
then rerun your compile command and it should work. If the above command returns an error saying it cannot find the package specified, you may need to run this, then try again:
dpkg --add-architecture i386
Warning: If the command above asks you to remove packages, read the list carefully, if the list includes important system packages or if you are unsure then do not proceed.