Permalink
Browse files

Compile ffmpeg with -O3 on mac..

After pulling my hair for hours... Here is the principal reason why h264 kept crashing on my box... The SSE code in libavcodec/x86/cabac.h becomes buggy when compiled without optimisation.
This required modifying mythtranscode/replex and filters/greedyhdeint , as they, on the other hand will not compile with -O3 (get undefined symbols)
  • Loading branch information...
jyavenard committed May 22, 2012
1 parent 08e8883 commit 375d12e3f4ae916e26f982b3ecee0ced462767ce
View
@@ -3297,6 +3297,8 @@ case $target_os in
CPPFLAGS=`echo $CPPFLAGS | sed 's/-D_POSIX_C_SOURCE=200112//'`
# Workaround compile errors from missing ru_maxrss
add_cppflags -D_DARWIN_C_SOURCE
+ # weird non-working h264 without it when compiling with llvm without -O3
+ add_cflags -O3
# Prevent linker problems on default Intel 10.5 XCode:
ldver=$(ld -v 2>&1 | sed -e s/^[^-]*-//)
osxver=$(uname -r | cut -c 1)
@@ -6,4 +6,5 @@ INCLUDEPATH += ../../libs/libmythtv ../../libs/libavcodec ../..
# Input
SOURCES += filter_greedyhdeint.c color.c
-macx : QMAKE_LFLAGS += -read_only_relocs warning
+# llvm/xcode doesn't compile if -O3 is enabled (or any other -O for that matter)
+macx: QMAKE_CFLAGS -= -O3 -O2 -O1 -Os
@@ -12,6 +12,9 @@ INSTALLS = target
QMAKE_CLEAN += $(TARGET)
QMAKE_CFLAGS += -w
+# llvm/xcode doesn't compile if -O3 is enabled (or any other -O for that matter)
+macx: QMAKE_CFLAGS -= -O3 -O2 -O1 -Os
+
# Input
SOURCES += main.cpp transcode.cpp mpeg2fix.cpp helper.c
SOURCES += commandlineparser.cpp
@@ -34,6 +34,9 @@ isEmpty(QMAKE_EXTENSION_SHLIB) {
QMAKE_EXTENSION_SHLIB=so
}
+# llvm/xcode doesn't compile if -O3 is enabled (or any other -O for that matter)
+macx: QMAKE_CFLAGS -= -O3 -O2 -O1 -Os
+
POST_TARGETDEPS += ../../../external/FFmpeg/libavutil/$$avLibName(avutil)
POST_TARGETDEPS += ../../../external/FFmpeg/libavcodec/$$avLibName(avcodec)
POST_TARGETDEPS += ../../../external/FFmpeg/libavformat/$$avLibName(avformat)

0 comments on commit 375d12e

Please sign in to comment.