Bug 32114 - Fails to build with gcc 4.5
Summary: Fails to build with gcc 4.5
Status: RESOLVED DUPLICATE of bug 29871
Alias: None
Product: PolicyKit
Classification: Unclassified
Component: daemon (show other bugs)
Version: unspecified
Hardware: Other All
: medium major
Assignee: David Zeuthen (not reading bugmail)
QA Contact: David Zeuthen (not reading bugmail)
Depends on:
Reported: 2010-12-05 12:34 UTC by Martin Pitt
Modified: 2011-02-23 06:22 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

Fix linking of polkitagenthelperprivate.c with gcc 4.5 (1.37 KB, patch)
2010-12-05 12:36 UTC, Martin Pitt
Details | Splinter Review

Description Martin Pitt 2010-12-05 12:34:49 UTC
gcc 4.5 has a stricter linking behaviour where all required libraries need to be specified explicitly, you can't rely on transitive dependencies of libraries any more.

Current 0.99/git head fails to build with

  CCLD   polkit-agent-helper-1
/usr/bin/ld.bfd.real: polkit_agent_helper_1-polkitagenthelperprivate.o: undefined reference to symbol 'g_type_init'
/usr/bin/ld.bfd.real: note: 'g_type_init' is defined in DSO /usr/lib64/libgobject-2.0.so.0 so try adding it to the linker command line
/usr/lib64/libgobject-2.0.so.0: could not read symbols: Invalid operation
collect2: ld returned 1 exit status

with gcc 4.5. Indeed polkitagenthelperprivate.c calls g_type_init() which is in libgobject, but the Makefile misses the linking to this.
Comment 1 Martin Pitt 2010-12-05 12:36:45 UTC
Created attachment 40813 [details] [review]
Fix linking of polkitagenthelperprivate.c with gcc 4.5

Tested patch.
Comment 2 Martin Pitt 2010-12-06 07:13:26 UTC
Sorry, this only happens with -Wl,--as-needed (our compiler does that by default now, to reduce/eliminate unnecessary library dependencies).
Comment 3 David Zeuthen (not reading bugmail) 2011-02-23 06:22:02 UTC
Looks like a dupe of bug 29871 (which was recently resolved).

*** This bug has been marked as a duplicate of bug 29871 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.