Mailing List Archive

[PATCH] Fix build with gold
Hi,

Tarun Kumar Mall filed this patch (as a diff of a diff no less) in a
bug[0] against the Debian package of ivtv-utils based on a report in
LaunchPad[1]. Details are pretty much non-existent but I infer that it
has something to do with Ubuntu Natty using gold instead of the
tradition GNU ld and that the underlying issue is to do with the
ordering of the .o files and the libraries on the link line,
specifically libraries need to come second.

It looks plausible enough to me.

Ian.

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=615989
[1] https://bugs.launchpad.net/ubuntu/+source/ivtv-utils/+bug/725933

#! /bin/sh /usr/share/dpatch/dpatch-run
## From: Tarun Kumar Mall <c2tarun@gmail.com>
## Description: Fixes FTBFS problem on natty machine by moving libraries to the end in ivtv-utils-1.4.1/test/Makefile and ivtv-utils-1.4.1/utils/Makefile
## Bug: https://launchpad.net/bugs/725933

## 04_fix_ftbfs_binutils-gold.dpatch by Tarun Kumar Mall <c2tarun@gmail.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' ivtv-utils-1.4.1~/test/Makefile ivtv-utils-1.4.1/test/Makefile
--- ivtv-utils-1.4.1~/test/Makefile 2010-04-03 20:04:39.000000000 +0000
+++ ivtv-utils-1.4.1/test/Makefile 2011-03-01 15:26:30.643718001 +0000
@@ -9,7 +9,10 @@

CFLAGS = -I../utils -D_GNU_SOURCE -O2 -Wall
CXXFLAGS = $(CFLAGS)
-LDFLAGS = -lm
+LIBS = -lm
+
+ivtv-pcm-tester: ivtv-pcm-tester.o
+ $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)

all: $(EXES)

diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' ivtv-utils-1.4.1~/utils/Makefile ivtv-utils-1.4.1/utils/Makefile
--- ivtv-utils-1.4.1~/utils/Makefile 2011-03-01 15:24:45.859718001 +0000
+++ ivtv-utils-1.4.1/utils/Makefile 2011-03-01 15:28:31.351718001 +0000
@@ -20,22 +20,22 @@
$(MAKE) CFLAGS="$(CFLAGS)" -C cx25840ctl

ivtv-ctl: ivtv-ctl.o
- $(CC) -lm -o $@ $^
+ $(CC) -o $@ $^ -lm

v4l2-ctl: v4l2-ctl.o
- $(CXX) -lm -o $@ $^
+ $(CXX) -o $@ $^ -lm

v4l2-dbg: v4l2-dbg.o v4l2-driverids.o v4l2-chipids.o
- $(CXX) -lm -o $@ $^
+ $(CXX) -o $@ $^ -lm

ivtvplay: ivtvplay.cc
- $(CXX) $(CXXFLAGS) -lm -lpthread -o $@ $^
+ $(CXX) $(CXXFLAGS) -o $@ $^ -lm -lpthread

encoder.o: encoder.c
$(CC) $(CFLAGS) -DVIDEO_PORT=0 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -c $^

ivtv-encoder: enc_mindex.o enc_chann.o encoder.o
- $(CC) -lpthread -o $@ $^
+ $(CC) -o $@ $^ -lpthread

install: all
install -d $(DESTDIR)/$(BINDIR)

--
Ian Campbell

"There is nothing new under the sun, but there are lots of old things
we don't know yet."
-- Ambrose Bierce