[Ffmpeg-devel] [PATCH] Cygwin vhook, always static avformat
Víctor Paesa
wzrlpy
Mon May 8 00:26:27 CEST 2006
Hi,
>Please try the attached patch, it's untested, but i'm confident it
>should work.
I tested your patch, but if configured as:
$ ./configure --disable-static --enable-shared; make
then the build stops here:
make -C libavcodec all
make[1]: Entering directory
`/home/Inma/src/FFMpeg-20060428/ffmpeg/libavcodec'
gcc -shared -Wl,-soname,libavcodec.so.51 -Wl,--warn-common -o libavcodec.so
bitstream.o
utils.o mem.o allcodecs.o mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o
mpegaudio.o ac3enc.o
mjpeg.o resample.o resample2.o dsputil.o motion_est.o imgconvert.o
imgresample.o mpeg12.o
mpegaudiodec.o pcm.o simple_idct.o ratecontrol.o adpcm.o eval.o
error_resilience.o fft.o
mdct.o raw.o golomb.o cabac.o dpcm.o adx.o faandct.o parser.o g726.o
vp3dsp.o h264idct.o
rangecoder.o pnm.o h263.o msmpeg4.o h263dec.o opt.o aasc.o alac.o asv1.o
avs.o cinepak.o
cook.o cljr.o cyuv.o dvbsubdec.o dvbsub.o dvdsub.o dvdsubenc.o dv.o 8bps.o
ffv1.o flac.o
flicvideo.o 4xm.o fraps.o h261.o h264.o huffyuv.o idcinvideo.o indeo2.o
indeo3.o
interplayvideo.o kmvc.o lcl.o loco.o mace.o msrle.o msvideo1.o png.o qdm2.o
qdrw.o qpeg.o
qtrle.o ra144.o ra288.o roqvideo.o rpza.o rv10.o shorten.o smacker.o smc.o
snow.o sonic.o
svq1.o truemotion1.o truemotion2.o truespeech.o tta.o tscc.o cscd.o lzo.o
nuv.o rtjpeg.o
ulti.o vc9.o vcr1.o vmdav.o vorbis.o vp3.o vqavideo.o wmadec.o wnv1.o
ws-snd1.o xan.o
xl.o bmp.o mmvideo.o zmbv.o i386/fdct_mmx.o i386/cputest.o
i386/dsputil_mmx.o
i386/mpegvideo_mmx.o i386/idct_mmx.o i386/motion_est_mmx.o
i386/simple_idct_mmx.o
i386/fft_sse.o i386/vp3dsp_mmx.o i386/vp3dsp_sse2.o i386/fft_3dn.o
i386/fft_3dn2.o
i386/snowdsp_mmx.o -L../libavutil -lavutil -lz
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot
find -lavutil
collect2: ld returned 1 exit status
make[1]: *** [libavcodec.so] Error 1
make[1]: Leaving directory
`/home/Inma/src/FFMpeg-20060428/ffmpeg/libavcodec'
make: *** [lib] Error 2
It fails because the shared library avutil is named "libavutil.so", and the
suffix ".so"
is not recognized by Cygwin as a shared library.
>>(The import libraries and static libraries should be into $(libdir) in
>>Cygwin)
>Could you point me at a relevant section of the Cygwin documentation or
>explain again what goes where on Cygwin?
I found an authoritative source for the names and locations of Cygwin
libraries,
the info for the GNU linker ld, section "Machine Dependent", subsection
"WIN32":
http://sourceware.org/binutils/docs-2.16/ld/WIN32.html#WIN32
The generic cygwin/mingw path layout uses a `bin' directory for
applications and dll's and a `lib' directory for the import
libraries (using cygwin nomenclature):
bin/
cygxxx.dll
lib/
libxxx.dll.a (in case of dll's)
libxxx.a (in case of static archive)
Below is my second patch attempt, now it uses the SHFLAGS recommended by
Cygwin User's Guide,
and installs both the .dll and the .dll.a (previous one only installed the
.dll).
Here is a link to it:
http://usuarios.arsystel.com/wzrlpy/ffmpeg/ffmpeg.cygwin.vhook.2.patch
Here is its content:
diff -Nur ffmpeg-old/common.mak ffmpeg/common.mak
--- ffmpeg-old/common.mak 2006-04-28 18:40:29.000000000 +0200
+++ ffmpeg/common.mak 2006-05-07 23:52:16.578125000 +0200
@@ -10,6 +10,13 @@
LDFLAGS =
-Wl,--output-def,$(@:.dll=.def),--out-implib,lib$(SLIBNAME:$(SLIBSUF)=.dll.a)
endif
+#FIXME: This should be in configure/config.mak
+ifeq ($(TARGET_OS),CYGWIN)
+ ifeq ($(BUILD_SHARED),yes)
+ EXTRALIBS := -Wl,--no-whole-archive $(EXTRALIBS)
+ endif
+endif
+
ifeq ($(TARGET_GPROF),yes)
CFLAGS+=-p
LDFLAGS+=-p
@@ -75,12 +82,19 @@
ifeq ($(CONFIG_WIN32),yes)
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) "$(prefix)"
else
+ ifeq ($(TARGET_OS),CYGWIN)
+ install -d "$(bindir)"
+ install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
+ $(bindir)/$(SLIBNAME)
+ install -m 755 lib$(NAME).dll.a $(libdir)
+ else
install $(INSTALLSTRIP) -m 755 $(SLIBNAME) \
$(libdir)/$(SLIBNAME_WITH_VERSION)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME_WITH_MAJOR)
ln -sf $(SLIBNAME_WITH_VERSION) \
$(libdir)/$(SLIBNAME)
+ endif
endif
install-lib-static: $(LIB)
diff -Nur ffmpeg-old/configure ffmpeg/configure
--- ffmpeg-old/configure 2006-04-28 18:40:29.000000000 +0200
+++ ffmpeg/configure 2006-05-07 01:32:54.312500000 +0200
@@ -377,10 +377,13 @@
v4l2="no"
audio_oss="yes"
dv1394="no"
-vhook="no"
+vhook="yes"
extralibs=""
cygwin="yes"
EXESUF=".exe"
+SLIBPREF="cyg"
+SLIBSUF=".dll"
+SHFLAGS='-shared
-Wl,--out-implib=lib$(NAME).dll.a,--export-all-symbols,--enable-auto-import,--whole-archive'
;;
Linux)
LDFLAGS="$LDFLAGS -rdynamic"
diff -Nur ffmpeg-old/vhook/Makefile ffmpeg/vhook/Makefile
--- ffmpeg-old/vhook/Makefile 2006-03-31 17:47:35.000000000 +0200
+++ ffmpeg/vhook/Makefile 2006-05-07 02:15:44.109375000 +0200
@@ -5,6 +5,15 @@
CFLAGS=-fPIC $(SHCFLAGS) -I.. -I$(SRC_PATH) -I$(SRC_PATH)/libavformat
-I$(SRC_PATH)/libavcodec -I$(SRC_PATH)/libavutil -DHAVE_AV_CONFIG_H
#FIXME: This needs to be in configure/config.mak
+ifeq ($(TARGET_OS),CYGWIN)
+ EXTRALIBS := -L../libavformat -lavformat$(BUILDSUF) -L../libavcodec
-lavcodec$(BUILDSUF) -L../libavutil -lavutil$(BUILDSUF) $(EXTRALIBS)
+ ifeq ($(BUILD_SHARED),yes)
+ EXTRALIBS := -Wl,--no-whole-archive $(EXTRALIBS)
+ SHFLAGS=-shared
-Wl,--out-implib,$(@:$(SLIBSUF)=.dll.a),--export-all-symbols,--enable-auto-import,--whole-archive
+ endif
+endif
+
+#FIXME: This needs to be in configure/config.mak
ifeq ($(CONFIG_DARWIN),yes)
SHFLAGS = -dynamiclib -Wl,-single_module -flat_namespace -undefined
suppress -Wl,-install_name,$(libdir)/vhook/$@
endif
@@ -31,13 +40,13 @@
install -m 755 $(HOOKS) "$(libdir)/vhook"
imlib2$(SLIBSUF): imlib2.o
- $(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< -lImlib2
+ $(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< -lImlib2 $(EXTRALIBS)
drawtext$(SLIBSUF): drawtext.o
- $(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< `freetype-config --libs`
+ $(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< `freetype-config --libs`
$(EXTRALIBS)
%$(SLIBSUF): %.o
- $(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $<
+ $(CC) $(LDFLAGS) -g -o $@ $(SHFLAGS) $< $(EXTRALIBS)
clean:
rm -f *.o *.d *~ *.a *.lib *.so *.dylib *.dll
Regards,
V?ctor
More information about the ffmpeg-devel
mailing list