Dave,

I have been having some difficulties building the latest ffmpeg with gcc-4.3.2-2; the build would complete but the resulting binaries wouldn't launch due to the dreaded, ever-so-helpful C0000005 initialization error. Building with gcc-3.4 worked just fine, as it has for some time on 1.5.

So after rebuilding ffmpeg dozens of times (literally) to eliminate possible causes one-by-one, I finally found that -O2 was the cause. Odd, since -O2 is generally safe, and ffmpeg even adds -O3 by default. So I went through all the flags which -O2 turns on, and the winner (loser?) is -freorder-functions.

Attached is a .cygport and patch which builds ffmpeg with minimal dependencies (libbz2 and zlib), and adds -fno-reorder-functions to CFLAGS (my default is "-O2 -march=i686 -pipe"), which produces working executables. If I remove -fno-reorder-functions, no such luck.

I know it's not exactly a STC, but hopefully I've narrowed this down enough that you can help me figure this out.


Yaakov
DESCRIPTION="FFmpeg Audio/video codecs library"
HOMEPAGE="http://ffmpeg.org/";
SRC_URI="http://ffmpeg.org/releases/${P}.tar.bz2";
#SVN_URI="svn://svn.mplayerhq.hu/ffmpeg"
#SVN_REV=${PV}
#inherit svn

PATCH_URI="r17736-cygwin.patch"
#           r17736-headers-install.patch
#           r17736-vhook-install.patch"

PKG_NAMES="${PN}"
ffmpeg_CONTENTS='--exclude=html usr/bin/*.exe usr/lib/vhook/ usr/share/'

for l in avcodec:52 avdevice:52 avfilter:0 avformat:52 avutil:49 postproc:51 
swscale:0
do
        n=${l%:*}
        v=${l##*:}
        PKG_NAMES+=" lib${n}${v} lib${n}-devel"
        declare lib${n}${v}_CONTENTS="usr/bin/cyg${n}-${v}.dll"
        declare lib${n}_devel_CONTENTS="usr/include/lib${n}/
                                        usr/lib/lib${n}.*
                                        usr/lib/pkgconfig/lib${n}.pc"
done

unset l n v

src_compile() {
        cd ${B}
        # -freorder-functions (on with -O2) causes C0000005 initialization 
errors
        CFLAGS+=" -fno-reorder-functions -fomit-frame-pointer"
        ${S}/configure \
                --source-path=${S} \
                --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/bin \
                --incdir=/usr/include --mandir=/usr/share/man \
                --enable-static --enable-shared \
                --enable-gpl \
                --enable-postproc --enable-swscale --enable-avfilter \
                --disable-pthreads \
                --disable-libdirac \
                --disable-libfaac --disable-libfaad \
                --disable-libgsm \
                --disable-libmp3lame \
                --disable-libnut \
                --disable-libopenjpeg \
                --disable-libschroedinger \
                --disable-libspeex \
                --disable-libtheora --disable-libvorbis \
                --disable-libx264 \
                --disable-libxvid \
                --disable-libamr-nb \
                --disable-libamr-wb \
                --disable-libdc1394 \
                --disable-x11grab \
                --disable-debug \
                --disable-optimizations \
                --disable-yasm \
                --disable-mmx \
                --disable-mmx2 \
                --disable-ssse3 \
                --disable-altivec \
                --disable-amd3dnow \
                --disable-amd3dnowext \
                --disable-armv5te \
                --disable-armv6 \
                --disable-armv6t2 \
                --disable-armvfp \
                --disable-iwmmxt \
                --disable-mmi \
                --disable-stripping \
                --disable-vhook \
                || error "configure failed"
        # workaround bug in parallel make
        cygmake version.h
        cygmake CC="${CC}"
}
--- origsrc/ffmpeg/configure	2009-03-02 14:05:36.000000000 -0600
+++ src/ffmpeg/configure	2009-03-02 14:14:27.062500000 -0600
@@ -1591,11 +1591,12 @@ case $target_os in
         fi
         SLIBPREF="cyg"
         SLIBSUF=".dll"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
+        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
-        SHFLAGS='-shared -Wl,--enable-auto-image-base'
+        SHFLAGS='-shared -Wl,--enable-auto-image-base -Wl,--out-implib,lib$(NAME)/lib$(NAME).dll.a'
+        SLIB_INSTALL_EXTRA_CMD='mkdir -p "$(LIBDIR)"; install -m 644 lib$(NAME)/lib$(NAME).dll.a $(LIBDIR)/lib$(NAME).dll.a'
+        LDCONFIG=""
         objformat="win32"
-        enable dos_paths
         ;;
     *-dos|freedos|opendos)
         disable ffplay ffserver vhook
@@ -2430,7 +2431,7 @@ get_version LIBAVFILTER libavfilter/avfi
 
 if enabled shared; then
     echo "BUILD_SHARED=yes" >> config.mak
-    echo "PIC=-fPIC -DPIC" >> config.mak
+    echo "PIC=-DPIC -DDLL_EXPORT" >> config.mak
     echo "LIBTARGET=${LIBTARGET}" >> config.mak
     echo "SLIBNAME=${SLIBNAME}" >> config.mak
     echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
--- origsrc/ffmpeg/subdir.mak	2009-03-02 14:05:36.000000000 -0600
+++ src/ffmpeg/subdir.mak	2009-03-02 14:14:52.390625000 -0600
@@ -41,10 +41,12 @@ install-lib$(NAME)-shared: $(SUBDIR)$(SL
 	install -d "$(SHLIBDIR)"
 	install -m 755 $(SUBDIR)$(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
 	$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
+ifneq ($(OS), Windows_NT)
 	cd "$(SHLIBDIR)" && \
 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
 	cd "$(SHLIBDIR)" && \
 		$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
+endif
 	$(SLIB_INSTALL_EXTRA_CMD)
 
 install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to