delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/07/14/12:19:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_63,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4A5CB013.4050804@users.sourceforge.net>
Date: Tue, 14 Jul 2009 11:19:31 -0500
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: gcc4: ffmpeg vs. -freorder-functions
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------040103020506010100000202
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------040103020506010100000202
Content-Type: text/plain;
 name="ffmpeg-0.5-1.cygport"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ffmpeg-0.5-1.cygport"

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}"
}

--------------040103020506010100000202
Content-Type: text/x-patch;
 name="r17736-cygwin.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="r17736-cygwin.patch"

--- 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)


--------------040103020506010100000202
Content-Type: text/plain; charset=us-ascii

--
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
--------------040103020506010100000202--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019