GNOME Bugzilla – Bug 653615
cogl_release_status="snapshot" breaks linking on 64-bit systems due to namespace conflict with ltoptions.m4
Last modified: 2011-06-29 12:55:45 UTC
On amd64 systems, shared libraries must be built with -fPIC, otherwise linking will fail: /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/cogl-gl.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC .libs/cogl-gl.o: could not read symbols: Bad value collect2: ld returned 1 exit status Interestingly, cogl's choice of whether or not by default to build its object files with -fPIC depends on the value of cogl_release_status. Allow me to explain. Cogl's configure.ac contains several lines like m4_define([default], [m4_if(cogl_release_status, [git], [yes], [no])]) while ltoptions.m4 (included by aclocal.m4) contains the following code: # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) In other words, when cogl_release_status="git", m4 defines default="yes", and so the default value of pic_mode is "yes" (build with -fPIC only). And when cogl_release_status="snapshot", m4 defines default="no", and so the default value of pic_mode is "no" (build without -fPIC only, which is guaranteed to fail on amd64). Hence, the cogl-1.7.0 tarball (which has cogl_release_status="snapshot") by default fails to link on 64-bit systems. The default can be overridden (using a --with-pic=yes flag passed to configure), but such behavior is certainly not desirable.
Created attachment 190915 [details] [review] build: Do not define "default" in m4 this patch should fix the issue. testing would be appreciated, so that we can do a 1.7.2 release in time for the next Gnome 3.2 snapshot.
Tested on a 64bit system where the issue was present with the 1.7.0 tarball, applying this patch does make the issue go away.
Attachment 190915 [details] pushed as 38a728b - build: Do not define "default" in m4