unable to build tests without implicit DSO linking

Bug #918570 reported by Tuomo Tanskanen
This bug report is a duplicate of:  Bug #1088863: tests should link to -lrt explicitly. Edit Remove
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
upstart
New
Undecided
Unassigned

Bug Description

Version: 1.4

With gcc 4.6 toolchain, some of the Upstart tests fail to build. Each of the tests in init/tests is missing "-lrt".

Patch proposal attached.

description: updated
affects: upstart (Ubuntu) → upstart
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

I would think this would cause the package to fail to build on Ubuntu 12.04, but it builds just fine. Can you provide a way to reproduce the problem?

Changed in upstart:
status: New → Incomplete
Revision history for this message
Tuomo Tanskanen (tuomotanskanen) wrote :

I'm a bit out of my comfort zone here, but little digging suggests it has something to do with --as-needed of ld/binutils, not gcc 4.6. For Ubuntu default seems different than in e.g. SUSE. Sorry for confusion.

Demonstration of failure here in openSUSE build system:
https://build.opensuse.org/package/live_build_log?arch=i586&package=upstart&project=home%3Atuomotanskanen&repository=openSUSE_12.1_standard_x86_64_i586

---clip---
make check-am
make[2]: Entering directory `/home/abuild/rpmbuild/BUILD/upstart-1.4/init'
make test_system test_environ test_process test_job_class test_job_process test_job test_log test_event test_event_operator test_blocked test_parse_job test_parse_conf test_conf test_control
make[3]: Entering directory `/home/abuild/rpmbuild/BUILD/upstart-1.4/init'
  CC test_system.o
  CCLD test_system
  CC test_environ.o
  CCLD test_environ
  CC test_process.o
  CCLD test_process
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: job_process.o: undefined reference to symbol 'clock_gettime@@GLIBC_2.2'
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld: note: 'clock_gettime@@GLIBC_2.2' is defined in DSO /lib/librt.so.1 so try adding it to the linker command line
/lib/librt.so.1: could not read symbols: Invalid operation

To me, it only makes sense Upstart should explicitly list the required libraries for the linker.

Revision history for this message
Tuomo Tanskanen (tuomotanskanen) wrote :

Removed the git patch (hello bzr!) and updated bzr branch with fix.

Revision history for this message
Tuomo Tanskanen (tuomotanskanen) wrote :

This document seems to cover it: https://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking

Ubuntu hasn't switched the default like SUSE and Fedora I guess, but since this bug is aimed at upstream Upstart, the fix is in order.

Changed in upstart:
status: Incomplete → New
summary: - unable to build tests with gcc 4.6
+ unable to build tests without implicit DSO linking
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.