New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #28935 (closed enhancement: fixed)

Opened 2 years ago

Last modified 22 months ago

ffmpeg: +universal variant

Reported by: dtakahashi42@… Owned by: devans@…
Priority: Normal Milestone:
Component: ports Version: 1.9.2
Keywords: universal haspatch Cc: fran6co@…, n.a.hawes@…, cal@…, ryandesign@…
Port: ffmpeg

Description

Missing universal variant of ffmpeg prevents universal build of dependent ports (e.g., gimp2 depends on gegl). To solve this problem, I attached a patch that enables +universal variant of ffmpeg. I tested only a case when universal_archs is i386 x86_64, however, I think this patch will work for other architecture combinations.

Attachments

ffmpeg-Portfile.diff (898 bytes) - added by dtakahashi42@… 2 years ago.
main.log (957.6 KB) - added by fran6co@… 2 years ago.
Full log
ffmpeg-Portfile.2.diff (2.5 KB) - added by dtakahashi42@… 2 years ago.
Update platform darwin 10
ffmpeg-asflags-Portfile.diff (1.8 KB) - added by dtakahashi42@… 2 years ago.
add ASFLAGS to configure environment
main.2.log (1.5 MB) - added by fran6co@… 2 years ago.
Different log with the last patch, but it's weird because it's not stopping at the first error found.
ffmpeg-i386-no-inline-Portfile.diff (3.1 KB) - added by dtakahashi42@… 2 years ago.
disable inlining for intel 32bit architecture (darwin 10)
ffmpeg-asflags-mmx_patch-Portfile.diff (1.9 KB) - added by fran6co@… 2 years ago.
The Portfile that worked for me
patch-ffmpeg-0.6-PIC_fix.diff (1.8 KB) - added by fran6co@… 2 years ago.
And the patch
ffmpeg-0.6.3_1-asflags-mmx_patch-Portfile.diff (1.9 KB) - added by dtakahashi42@… 2 years ago.
proposed patch (updated for ffmpeg 0.6.3_1)
ffmpeg-Portfile.0.7.1.diff (1.7 KB) - added by dtakahashi42@… 23 months ago.

Change History

Changed 2 years ago by dtakahashi42@…

comment:1 Changed 2 years ago by ryandesign@…

  • Owner changed from macports-tickets@… to devans@…
  • Cc devans@… removed
  • Summary changed from +universal variant of ffmpeg 0.6.1 to ffmpeg: +universal variant

comment:2 Changed 2 years ago by fran6co@…

It's not working for me:

:info:build /usr/bin/gcc-4.2 -I. -I"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_multimedia_ffmpeg/work/ffmpeg-0.6.1-i386" -I/opt/local/include -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -DHAVE_AV_CONFIG_H -pipe -O2 -DHAVE_LRINTF -I/opt/local/include -arch i386   -std=c99 -fomit-frame-pointer -fPIC -I/opt/local/include/dirac -I/opt/local/include/schroedinger-1.0 -I/opt/local/include/orc-0.4 -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wundef -Wmissing-prototypes -O3 -fno-math-errno -fno-tree-vectorize -Werror=implicit -Werror=missing-prototypes          -MMD -MF libavcodec/h264_cavlc.d -MT libavcodec/h264_cavlc.o -c -o libavcodec/h264_cavlc.o libavcodec/h264_cavlc.c
:info:build libavcodec/h264_cavlc.c: In function 'decode_residual':
:info:build libavcodec/h264_cavlc.c:411: warning: suggest parentheses around comparison in operand of &
:info:build libavcodec/cabac.h: In function 'get_cabac_noinline':
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h: In function 'decode_cabac_mb_ref':
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h: In function 'decode_cabac_residual_nondc':
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/x86/h264_i386.h:97: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/x86/h264_i386.h:44: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h: In function 'decode_cabac_residual_dc':
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/x86/h264_i386.h:97: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/x86/h264_i386.h:44: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h: In function 'decode_cabac_mb_mvd':
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:527: error: PIC register '%ebx' clobbered in 'asm'
:info:build libavcodec/cabac.h:641: error: PIC register '%ebx' clobbered in 'asm'
:info:build gmake: *** [libavcodec/h264_cabac.o] Error 1
:info:build gmake: *** Waiting for unfinished jobs....

comment:4 Changed 2 years ago by fran6co@…

I think the problem is when compiling something in 32bits when using a 64bit system.

comment:5 Changed 2 years ago by dtakahashi42@…

Could you post the whole build-log? I would like to see ./configure arguments.

Changed 2 years ago by fran6co@…

Full log

comment:6 Changed 2 years ago by fran6co@…

  • Cc fran6co@… added

Cc Me!

comment:7 Changed 2 years ago by dtakahashi42@…

Workaround at platform darwine 10 was needed to adapt universal variant. Updated patch will solve the problem.

Changed 2 years ago by dtakahashi42@…

Update platform darwin 10

comment:8 Changed 2 years ago by fran6co@…

That way it disables mmx from the 32bit build. The compilation error seems to be a know issue with gcc when doing cross compilation with assembly code. Not sure if disabling mmx is the correct patch.

comment:9 Changed 2 years ago by dtakahashi42@…

Your problem may come from the ignorance of target arch at the usability check of ebx resister. The new patch will solve a clobbering problem (mmx workaround is disabled to confirm that this is a separate problem).

Changed 2 years ago by dtakahashi42@…

add ASFLAGS to configure environment

Changed 2 years ago by fran6co@…

Different log with the last patch, but it's weird because it's not stopping at the first error found.

comment:10 Changed 2 years ago by dtakahashi42@…

Thank you for testing. Your log shows the first error (libavcodec/h264_cavlc.c compilation) is fixed, so the second problem is a different one (may relate to #20938). In my environment (OSX 10.5.8 Core2Duo), not gcc-4.0 but gcc-4.2 reproduced similar problem.

/usr/bin/gcc-4.2 -I. -I"/opt/local/var/macports/build/_LocalPort_port_multimedia_ffmpeg/work/ffmpeg-0.6.1" -I/opt/local/include -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -DHAVE_AV_CONFIG_H -pipe -O2 -DHAVE_LRINTF -I/opt/local/include -arch i386   -std=c99 -fomit-frame-pointer -fPIC -I/opt/local/include/dirac -I/opt/local/include/schroedinger-1.0 -I/opt/local/include/orc-0.4 -g -Wdeclaration-after-statement -Wall -Wno-switch -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wcast-qual -Wwrite-strings -Wundef -Wmissing-prototypes -O3 -fno-math-errno -fno-tree-vectorize          -MMD -MF libavcodec/x86/dsputil_mmx.d -MT libavcodec/x86/dsputil_mmx.o -c -o libavcodec/x86/dsputil_mmx.o libavcodec/x86/dsputil_mmx.c
/dsputil_mmx.clibavcodec/x86/h264dsp_mmx.c: In function `h264_h_loop_filter_luma_mmx2':
libavcodec/x86/dsputil_mmx.c:727: error: can't find a register in class `GENERAL_REGS' while reloading `asm'
libavcodec/x86/dsputil_mmx.c:727: error: can't find a register in class `GENERAL_REGS' while reloading `asm'
libavcodec/x86/dsputil_mmx.c:727: error: can't find a register in class `GENERAL_REGS' while reloading `asm'
libavcodec/x86/dsputil_mmx.c:727: error: `asm' operand has impossible constraints
... long error messages

The problem was avoided by the suppression of inlining (-fno-inline or -finline-limit=small integer, possibly generates slow binary). I hope this can be applicable for 10.6 environment. The updated portfile includes this fix.

Changed 2 years ago by dtakahashi42@…

disable inlining for intel 32bit architecture (darwin 10)

comment:11 Changed 2 years ago by dtakahashi42@…

I also think that the patch posted on https://roundup.ffmpeg.org/issue2088 can be helpful.

comment:12 Changed 2 years ago by fran6co@…

I'm testing your patch because I'm trying to build opencv as a universal binary and ffmpeg is a strong dependency.

With the -fno-inline change it managed to compile, didn't try it if it works.

It also works using the patch to dsputil_mmx.c. I like that solution better because it doesn't disable inlining for 386 build. I think it needs to be tested on a 32bit environment, because this could be a fix for ticket #20938.

Changed 2 years ago by fran6co@…

The Portfile that worked for me

Changed 2 years ago by fran6co@…

And the patch

comment:13 Changed 2 years ago by fran6co@…

If this portfile gets accepted in Macports it should have a comment explaining that this is a gcc bug, not of ffmpeg.

comment:14 Changed 2 years ago by dtakahashi42@…

Your updated patch works without any problems (OSX 10.5, i386/x86_64 universal), thank you very much.

For future reference: the link I posted here has been 404 since this morning, but the message can be found at mail-archive.

comment:15 Changed 2 years ago by n.a.hawes@…

  • Cc n.a.hawes@… added

Cc Me!

comment:16 follow-up: ↓ 17 Changed 2 years ago by dtakahashi42@…

Changes discussed here seems to be safely applicable for updated (0.6.2) ffmpeg port (snow leopard 64bit host, i386/x86_64). Could someone test updated port (with above changes) if it works?

comment:17 in reply to: ↑ 16 Changed 2 years ago by fran6co@…

Works for me! (Snow Leopard 10.6.7 64bit)

comment:18 Changed 2 years ago by devans@…

  • Status changed from new to assigned

comment:19 Changed 2 years ago by devans@…

I have applied this most recent set of patches and have confirmed that it builds properly in the following cases:

Snow Leopard 10.6.7 x86_64 both universal and not Leopard 10.5.8 ppc not universal (universal is still building)

I've lost track of who's tested what where. If someone can verify that it works on i386 platforms (both Snow Leopard and Leopard would be good) then I'm ready to commit these changes.

comment:20 Changed 2 years ago by dtakahashi42@…

No problem was found on leopard machine (32bit Core2 Duo, for both i386 and i386/x86_64 universal).

comment:21 Changed 2 years ago by dtakahashi42@…

I confirmed that the newest ffmpeg 0.6.3 built fine with above patches (Snow leopard 10.6.7, Macbook Pro early 2011, i386/x86_64 universal).

comment:22 Changed 2 years ago by cal@…

  • Cc cal@… added

Cc Me!

Changed 2 years ago by dtakahashi42@…

proposed patch (updated for ffmpeg 0.6.3_1)

comment:23 Changed 2 years ago by dtakahashi42@…

Although a small change is needed to adapt ffmpeg-0.6.3_1 (above patch), patches uploaded on this thread work fine with current ffmpeg port (Snow leopard 10.6.7, Macbook Pro early 2011, i386/x86_64 universal).

comment:24 Changed 2 years ago by ryandesign@…

This ticket is long and I haven't read everything in it. Is this patch still needed for ffmpeg @0.7.1? What about ffmpeg-devel @20110628? If so, do the patches need to be refreshed for those versions, and if so, can someone do that?

comment:25 follow-up: ↓ 26 Changed 23 months ago by dtakahashi42@…

As far as I tested, ffmpeg @0.7.1 does not require any of those patches (x86_64 and i386/x86_64 universal, OS X 10.6.8). I attach the patch to Portfile below.

Changed 23 months ago by dtakahashi42@…

comment:26 in reply to: ↑ 25 Changed 22 months ago by mroman@…

@dtakahashi42 Your path compiled ok in 32-bit 10.6 with gcc 4.5. Thanks!

comment:27 Changed 22 months ago by ryandesign@…

  • Keywords haspatch added
  • Cc ryandesign@… added
  • Status changed from assigned to closed
  • Resolution set to fixed

I committed a version of this latest patch in r82651. It allowed me to build ffmpeg for x86_64, i386, and both (universal), on Snow Leopard with Xcode 3.2.6, where before I was only able to build for x86_64. Hopefully this works on other configurations as well.

Note: See TracTickets for help on using tickets.