This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc4: ffmpeg vs. -freorder-functions


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

Attachment: ffmpeg-0.5-1.cygport
Description: Text document

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]