[PATCH] Enable compiling with --as-needed

Matthias Schwarzott <[email protected]>
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
Hi!

There is a patch needed to compile/link mjpegtools with 
LDFLAGS="-Wl,-O1,--as-needed"

Else linking will fail like this:

Creating yuvplay
i686-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I/usr/include -I../utils    -O2 -march=athlon-xp -fomit-frame-pointer -pipe -fno-strict-aliasing -pthread -Wall -Wunused -MT 
lavrec.o -MD -MP -MF .deps/lavrec.Tpo -c -o lavrec.o lavrec.c
mv -f .deps/lavrec.Tpo .deps/lavrec.Po
/bin/sh ../libtool --tag=CC   --mode=link 
i686-pc-linux-gnu-gcc  -O2 -march=athlon-xp -fomit-frame-pointer -pipe -fno-strict-aliasing -pthread -Wall -Wunused  -Wl,-O1,--as-needed -o 
lavrec lavrec.o ../utils/libmjpegutils.la  liblavrec.la liblavfile.la 
liblavjpeg.la  -lm
i686-pc-linux-gnu-gcc -O2 -march=athlon-xp -fomit-frame-pointer -pipe -fno-strict-aliasing -pthread -Wall -Wunused -Wl,-O1 -Wl,--as-needed -o .libs/lavrec 
lavrec.o  ../utils/.libs/libmjpegutils.so ./.libs/liblavrec.so ./.libs/liblavfile.so ./.libs/liblavjpeg.so /usr/lib/libjpeg.so /var/tmp/portage/media-video/mjpegtools-1.9.0_rc1/work/mjpegtools-1.9.0rc1/utils/.libs/libmjpegutils.so -lm
./.libs/liblavrec.so: undefined reference to `lav_fileno'
./.libs/liblavrec.so: undefined reference to `lav_query_polarity'
./.libs/liblavrec.so: undefined reference to `lav_strerror'
./.libs/liblavrec.so: undefined reference to `lav_query_APP_marker'
./.libs/liblavrec.so: undefined reference to `lav_write_audio'
./.libs/liblavrec.so: undefined reference to `lav_query_APP_length'
./.libs/liblavrec.so: undefined reference to `lav_open_output_file'
./.libs/liblavrec.so: undefined reference to `encode_jpeg_raw'
./.libs/liblavrec.so: undefined reference to `lav_close'
./.libs/liblavrec.so: undefined reference to `lav_write_frame'
collect2: ld returned 1 exit status
make[2]: *** [lavrec] Error 1
make[2]: Leaving directory 
`/var/tmp/portage/media-video/mjpegtools-1.9.0_rc1/work/mjpegtools-1.9.0rc1/lavtools'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory 
`/var/tmp/portage/media-video/mjpegtools-1.9.0_rc1/work/mjpegtools-1.9.0rc1'
make: *** [all] Error 2


Matthias

--
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Mjpeg-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mjpeg-developer
mjpegtools-1.9.0_rc1-as-needed.patch (text/x-diff, 1015 B)
diff -ru mjpegtools-1.8.0-orig/lavtools/Makefile.am mjpegtools-1.8.0/lavtools/Makefile.am
--- mjpegtools-1.8.0-orig/lavtools/Makefile.am	2006-08-25 15:09:51.542109878 +0200
+++ mjpegtools-1.8.0/lavtools/Makefile.am	2006-08-25 15:11:37.920337695 +0200
@@ -51,10 +51,17 @@
 liblavrec_la_SOURCES = liblavrec.c audiolib.c frequencies.c
 liblavrec_la_CPPFLAGS = $(AM_CPPFLAGS) # so automake doesn't complain about audiolib & frequencies
 liblavrec_la_LDFLAGS = $(LAV_ALL_LIB_OPTS)
+liblavrec_la_LIBADD = -llavfile -llavjpeg
+liblavrec_la_DEPENDENCIES = liblavfile.la liblavjpeg.la
 
 liblavplay_la_SOURCES = liblavplay.c audiolib.c
 liblavplay_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBDV_CFLAGS) $(X_CFLAGS)
 liblavplay_la_LDFLAGS = $(LAV_ALL_LIB_OPTS)
+liblavplay_la_LIBADD = -llavfile $(SDL_LIBS) -llavjpeg
+liblavplay_la_DEPENDENCIES = liblavfile.la liblavjpeg.la
+if HAVE_X
+  liblavplay_la_LIBADD += $(X_LIBS) -lX11
+endif
 
 # *********************************************************************
 # The tools themselves
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.