在Linux Mint 17 x86_64中编译Open Surge的问题:跳过不兼容的库



我正在使用Linux Mint 17 x86_64,在为开源游戏open Surge(基于Allegro库)编译修改后的库Alfont时收到以下警告:

danil@linuxmint ~/opensnc-code-opensurge/alfont $ gcc -fPIC -DPIC -O2 -m32 -Iinclude `freetype-config --cflags` -o src/alfont.o -c src/alfont.csrc/alfont.c: In function ‘alfont_ugetx’:
src/alfont.c:3765:4: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
    ugetxc((char**)s);
    ^
src/alfont.c:3765:4: note: expected ‘const char **’ but argument is of type ‘char **’
src/alfont.c:3767:2: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
  ugetxc((char**)s);
  ^
src/alfont.c:3767:2: note: expected ‘const char **’ but argument is of type ‘char **’
src/alfont.c:3771:2: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
  ugetxc(&lpszWS);
  ^
src/alfont.c:3771:2: note: expected ‘const char **’ but argument is of type ‘char **’
src/alfont.c:3773:2: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
  ugetxc(&lpszWS);
  ^
src/alfont.c:3773:2: note: expected ‘const char **’ but argument is of type ‘char **’
src/alfont.c:3818:2: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
  ugetxc((char**)s);
  ^
src/alfont.c:3818:2: note: expected ‘const char **’ but argument is of type ‘char **’
src/alfont.c:3820:2: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
  ugetxc((char**)s);
  ^
src/alfont.c:3820:2: note: expected ‘const char **’ but argument is of type ‘char **’
src/alfont.c: In function ‘alfont_ugetxc’:
src/alfont.c:4087:2: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
  ugetxc(&lpszWS);
  ^
src/alfont.c:4087:2: note: expected ‘const char **’ but argument is of type ‘char **’
src/alfont.c:4089:2: warning: passing argument 1 of ‘ugetxc’ from incompatible pointer type [enabled by default]
  ugetxc(&lpszWS);
  ^
src/alfont.c:4089:2: note: expected ‘const char **’ but argument is of type ‘char **’

我认为这些问题不是很严重。但下一步,我会得到以下错误:

danil@linuxmint ~/opensnc-code-opensurge/alfont $ gcc -O2 -m32 -shared -Wl,-soname,libalfont.so.2 -o libalfont.so.2.0.9 src/alfont.o `freetype-config --libs` `allegro-config --libs |sed 's/-lalleg_unsharable//'`
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.so when searching for -lfreetype
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.a when searching for -lfreetype
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.so when searching for -lfreetype
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libfreetype.a when searching for -lfreetype
/usr/bin/ld: cannot find -lfreetype
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng12.so when searching for -lpng12
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng12.a when searching for -lpng12
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng12.so when searching for -lpng12
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libpng12.a when searching for -lpng12
/usr/bin/ld: cannot find -lpng12
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/liballeg.so when searching for -lalleg
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/liballeg.so when searching for -lalleg
/usr/bin/ld: cannot find -lalleg
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so when searching for -lc
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.a when searching for -lc
collect2: error: ld returned 1 exit status

请告诉我如何用不兼容的库修复这些错误?

您的问题是试图在64位系统上编译32位二进制文件。

一种解决方案可能是编译64位二进制文件,这样就可以使用您的本地64位库。

如果出于某种原因需要将其编译为32位二进制文件,则必须确保安装所有需要的32位库。您还必须确保您的freetypeconfig和allegro-config程序指向32位版本的库。

最新更新