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

时间:2014-10-22 17:36:33

标签: linux gcc allegro linuxmint

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

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

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

1 个答案:

答案 0 :(得分:1)

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

一种解决方案可能是编译64位二进制文​​件,而是可以使用本机64位库。

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