After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 653615 - cogl_release_status="snapshot" breaks linking on 64-bit systems due to namespace conflict with ltoptions.m4
cogl_release_status="snapshot" breaks linking on 64-bit systems due to namesp...
Status: RESOLVED FIXED
Product: cogl
Classification: Platform
Component: general
1.7.x
Other Linux
: Normal normal
: ---
Assigned To: Cogl maintainer(s)
Cogl maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-06-29 07:04 UTC by Alexandre Rostovtsev
Modified: 2011-06-29 12:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
build: Do not define "default" in m4 (2.21 KB, patch)
2011-06-29 09:15 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review

Description Alexandre Rostovtsev 2011-06-29 07:04:18 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.
Comment 1 Emmanuele Bassi (:ebassi) 2011-06-29 09:15:37 UTC
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.
Comment 2 Øyvind Kolås (pippin) 2011-06-29 11:05:46 UTC
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.
Comment 3 Emmanuele Bassi (:ebassi) 2011-06-29 12:55:42 UTC
Attachment 190915 [details] pushed as 38a728b - build: Do not define "default" in m4