Bug 32114

Summary: Fails to build with gcc 4.5
Product: PolicyKit Reporter: Martin Pitt <martin.pitt>
Component: daemonAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED DUPLICATE QA Contact: David Zeuthen (not reading bugmail) <zeuthen>
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
i915 platform: i915 features:
Attachments: Fix linking of polkitagenthelperprivate.c with gcc 4.5

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.