Porting fails due to a linker error: cc -dynamiclib -o libavcodec.so common.o utils.o mem.o allcodecs.o mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o motion_est.o imgconvert.o imgresample.o mpeg12.o mpegaudiodec.o pcm.o simple_idct.o ratecontrol.o adpcm.o eval.o dv.o error_resilience.o fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o flac.o vp3dsp.o integer.o h263.o h261.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o a52dec.o liba52/bit_allocate.o liba52/bitstream.o liba52/downmix.o liba52/imdct.o liba52/parse.o liba52/crc.o liba52/resample.o faad.o faac.o libpostproc/postprocess.o mp3lameaudio.o oggvorbis.o ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o -lz -lfaac -lmp3lame -lvorbis -lvorbisenc -Wl,-d /usr/bin/libtool: unknown option character `d' in: -d Usage: /usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] Usage: /usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load] make[1]: *** [libavcodec.so] Error 1 make: *** [lib] Error 2 Reproducible: Always Steps to Reproduce: 1. ekeyword ~ppc-macos /usr/portage/media-video/ffmpeg/ffmpeg-0.4.9_pre1.ebuild 2. emerge -av ffmpeg 3. Expected Results: compile cleanly - it prevents me from porting vlc !!! Relying on the shell to locate gcc, this may break !!! DISTCC, installing gcc-config and setting your current gcc !!! profile will fix this Portage 2.0.51-r8 (default-macos/ppc/10.3, gcc-3.3, libsystem-7.1-r0, 7.6.0 Power Macintosh) ================================================================= System uname: 7.6.0 Power Macintosh powerpc macos-20041118 Python: dev-lang/python-2.3.3 [2.3 (#1, Sep 13 2003, 00:49:11)] distcc 2.0.1-zeroconf powerpc-apple-darwin7.0 (protocol 1) (default port 3632) [disabled] dev-lang/python: 2.3.3 sys-devel/autoconf: 2.57, 2.59-r5 sys-devel/automake: 1.6.3, 1.8.5-r1 sys-devel/binutils: [Not Present] sys-devel/libtool: [Not Present] virtual/os-headers: [Not Present] ACCEPT_KEYWORDS="ppc-macos ~ppc-macos" AUTOCLEAN="yes" CFLAGS="-O3 -pipe -mcpu=G5 -mtune=G5 -mpowerpc64 -funroll-loops -flat_namespace -mpowerpc-gpopt" CHOST="powerpc-apple-darwin" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-O3 -pipe -mcpu=G5 -mtune=G5 -mpowerpc64 -funroll-loops -flat_namespace -mpowerpc-gpopt" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache collision-protect cvs distlocks keepwork" GENTOO_MIRRORS="http://gentoo.osuosl.org/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="ppc X altivec berkdb debug dts dvd encode faac faad ggi gif hbci jpeg justify makecheck matroska multilib ncurses nls nptl odbc ofx oggvorbis opengl png ppc-macos quotes recode ssl threads tiff truetype unicode usb zlib"
This depends on a newer version of automake than is available for ppc-macos's default collision-protect profile. Will revisit after pathspec implementation.
Any updates on this?
For some reason it's calling /usr/bin/libtool. This is bad. It needs to call "libtool" so that the alias can change that to "glibtool". I don't have a fix for it since I can't figure out why it's misbehaving like that.
Ok, I'll have a look at it tommorow and see what I can do to get it working for you guys. Re-assigning for now.
questions: 1 ffmpeg does not use any autotools/libtools. 2 why CC -Wl,-d does call libtool? 3 could you attach the generated config.mak ? till now the possible solution is put -Wl,-dynamic as LDFLAGS and/or set CC as gcc
append-ldflags -Wl,-dynamic fixes the libtool error. Good to know. New error: cc -shared -Wl,-soname,libpostproc.so.0 \ -o libpostproc.so postprocess_pic.o cc: unrecognized option `-shared' ld: unknown flag: -soname make[2]: *** [libpostproc.so] Error 1 make[1]: *** [libavcodec.so] Error 2 make: *** [lib] Error 2 !!! ERROR: media-video/ffmpeg-0.4.9_p20050226-r1 failed. !!! Function src_install, Line 119, Exitcode 2 !!! Install Failed !!! If you need support, post the topmost build error, NOT this status message.
after configure sed the config.mak and set CC=gcc should help
*bump* still needs some attention.
Please try with CC=gcc SLIBSUF=".dylib"
Even with CC=gcc and the .dylib, I get the following error with pre1: gcc -dynamiclib -o libavcodec.dylib common.o utils.o mem.o allcodecs.o mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o motion_est.o imgconvert.o imgresample.o mpeg12.o mpegaudiodec.o pcm.o simple_idct.o ratecontrol.o adpcm.o eval.o dv.o error_resilience.o fft.o mdct.o mace.o huffyuv.o cyuv.o opts.o raw.o h264.o golomb.o vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o flac.o vp3dsp.o integer.o h263.o h261.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o libpostproc/postprocess.o ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o -lz -Wl,-d /usr/bin/libtool: unknown option character `d' in: -d Usage: /usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] Usage: /usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load] make[1]: *** [libavcodec.dylib] Error 1 make: *** [lib] Error 2 I don't see a point trying the older versions, although I seem to remember that an older version got over this problem only to have a problem with -shared. I also tried append-ldflags -Wl,-dynamic. Same error.
Created attachment 53921 [details, diff] Possible fix Please try that patch, _should_ make everything work.
I've gotten it working. I need to do some cleanup of things in local scope and I would like to collapse my 4-5 patches into one bigger patch. Assuming I can get another program to link against this, I will be committing either tonight or tomorrow.
Once you are ready you should commit the patch upstream.
Created attachment 54021 [details, diff] ffmpeg Sources Patch I'm attaching what I have to make it build. I get the following when I try to run the binary: dyld: ffmpeg Undefined symbols: ffmpeg undefined reference to _ffm_nopts expected to be defined in libavformat.dylib ffmpeg undefined reference to _first_avcodec expected to be defined in libavcodec.dylib ffmpeg undefined reference to _first_iformat expected to be defined in libavformat.dylib ffmpeg undefined reference to _first_image_format expected to be defined in libavformat.dylib ffmpeg undefined reference to _first_oformat expected to be defined in libavformat.dylib ffmpeg undefined reference to _first_protocol expected to be defined in libavformat.dylib ffmpeg undefined reference to _loop_input expected to be defined in libavformat.dylib Trace/BPT trap Hopefully someone has some ideas as to what to try.
Created attachment 54022 [details] The revised ebuild Sorry I didn't make a patch. I don't have the original copy of that ebuild on my harddrive. There's not much different -- just look for the 2 ppc-macos lines.
I went through each of the "undefined references", and found their definitions in the C files. All of the corresponding object files link against the libraries, so I don't see a reason for that particular error. A more thorough investigation shows the following: # nm -u /usr/lib/libavcodec.dylib nm: object: /usr/lib/libavcodec.dylib malformed object (nhints in LC_TWOLEVEL_HINTS load command not the same as nundefsym in LC_DYSYMTAB load command) # nm -u /usr/lib/libavformat.dylib nm: object: /usr/lib/libavformat.dylib malformed object (nhints in LC_TWOLEVEL_HINTS load command not the same as nundefsym in LC_DYSYMTAB load command) I'm not sure why this is happening. The source code for the generated error can be found here, but unfortunately the section we need is uncommented: http://darwinsource.opendarwin.org/DevToolsApr2004/cctools-499/libstuff/ofile.c I found a similar issue with an emacs build. It was fixed by a modification of the C code. However, some of the definitions that are "undefined" are just simple declaration/initialization of variables. I don't see why they would be generating errors. I'd appreciate any votes on what we should do with this problem.
Kito and I worked on this this afternoon. Only thing that still doesn't work is USE=dvd on collision- protect (see package.mask) and USE=oggvorbis is just broken. USE=sdl would need libsdl keyworded. Please test and report back here.
Created attachment 55717 [details] Ebuild
Created attachment 55718 [details, diff] Sources/Makefile Patch
what's wrong with vorbis support? (I'll try to update the snapshot once I can make upstream merge your bits)
Here's the error with USE=oggvorbis: gcc -dynamiclib -o libavformat.dylib utils.o cutils.o os_support.o allformats.o mpeg.o mpegts.o mpegtsenc.o ffm.o crc.o img.o raw.o rm.o avienc.o avidec.o wav.o swf.o au.o gif.o mov.o mpjpeg.o dv.o yuv4mpeg.o 4xm.o flvenc.o flvdec.o movenc.o psxstr.o idroq.o ipmovie.o nut.o wc3movie.o mp3.o westwood.o segafilm.o idcin.o flic.o sierravmd.o matroska.o ../libavcodec/libavcodec.dylib asf.o asf-enc.o pnm.o yuv.o png.o jpeg.o gifdec.o sgi.o avio.o aviobuf.o file.o framehook.o udp.o tcp.o http.o rtsp.o rtp.o rtpproto.o ogg.o -lz -Wl,-dynamic /usr/bin/libtool: internal link edit command failed ld: ogg.o illegal reference to symbol: _ogg_page_serialno defined in indirectly referenced dynamic library /usr/lib/libogg.0.dylib make[1]: *** [libavformat.dylib] Error 1 make: *** [lib] Error 2 !!! ERROR: media-video/ffmpeg-0.4.9_pre1 failed. !!! Function src_compile, Line 81, Exitcode 2 Hope that helps. I haven't had the time to look at it yet.
don't kill me but you should use the latest snapshot or a current cvs snapshot... Some issues got already addressed and that one seems one of them....
-logg should fix that methinks
already present in the latest snapshot I think...
Well, my interest is in getting the current version working in the portage tree so that users can emerge ffmpeg. In the interest of not doing more work later on down the line, it would be a good idea to run my diffs against the cvs version. I'll do that as soon as I get a moment. (finals crunch time this month)
Revised ebuild that adds the -logg stuff.
Created attachment 55775 [details] Ebuild Take 3
Created attachment 55805 [details, diff] patch against the current cvs new patch against the current cvs the snapshot will be taken once it will be committed upstream (hopefully)
Just read over the patch against the current cvs. + ln -sf libavcodec-$(VERSION).so $(libdir)/libavcodec$(SLIBSUF) + ln -sf libavformat-$(VERSION).so $(libdir)/libavformat$(SLIBSUF) Darwin doesn't know about .so, so those lines won't work. -SPPLIB = $(SLIBPREF)postproc$(SLIBSUF) +SPPLIB = $(SLIBPREF)postproc I don't know why that's in there. We definitely want a suffix on libraries. If we can get those lines changed to what they should be (I'd do it myself, but i'm not sure), I'd say that has a good chance of working. :-)
change the .so to $(SLIBSUF) (I'm getting sleepy and I missed those 2) the postproc patch is correct (the $(SLIBSUF) will be used in the makefile in a different way)
Created attachment 55822 [details, diff] lu-zero's patch against the current cvs (version 2) This is what you dcc-ed me on IRC.
And the new errors: gcc -dynamiclib -o libavcodec.dylib bitstream.o utils.o mem.o allcodecs.o mpegvideo.o jrevdct.o jfdctfst.o jfdctint.o mpegaudio.o ac3enc.o mjpeg.o resample.o resample2.o dsputil.o motion_est.o imgconvert.o imgresample.o mpeg12.o mpegaudiodec.o pcm.o simple_idct.o ratecontrol.o adpcm.o eval.o dv.o error_resilience.o fft.o mdct.o mace.o huffyuv.o cyuv.o raw.o h264.o golomb.o vp3.o asv1.o 4xm.o cabac.o ffv1.o ra144.o ra288.o vcr1.o cljr.o roqvideo.o dpcm.o interplayvideo.o xan.o rpza.o cinepak.o msrle.o msvideo1.o vqavideo.o idcinvideo.o adx.o rational.o faandct.o 8bps.o smc.o parser.o flicvideo.o truemotion1.o vmdav.o lcl.o qtrle.o g726.o flac.o vp3dsp.o integer.o snow.o tscc.o sonic.o ulti.o h264idct.o qdrw.o xl.o rangecoder.o png.o pnm.o qpeg.o vc9.o h263.o h261.o msmpeg4.o h263dec.o svq1.o rv10.o wmadec.o indeo3.o shorten.o loco.o alac.o wnv1.o ws-snd1.o aasc.o faad.o faac.o libpostproc/postprocess.o mp3lameaudio.o ppc/dsputil_ppc.o ppc/mpegvideo_ppc.o ppc/dsputil_altivec.o ppc/mpegvideo_altivec.o ppc/idct_altivec.o ppc/fft_altivec.o ppc/gmc_altivec.o ppc/fdct_altivec.o ppc/dsputil_h264_altivec.o -lz -lfaac -lmp3lame -Wl,-dynamic,-search_paths_first ld: common symbols not allowed with MH_DYLIB output format with the -multi_module option msmpeg4.o definition of common _ff_msmp4_dc_chroma_vlc (size 32) msmpeg4.o definition of common _ff_msmp4_dc_luma_vlc (size 32) msmpeg4.o definition of common _ff_msmp4_mb_i_vlc (size 16) /usr/bin/libtool: internal link edit command failed make[1]: *** [libavcodec.dylib] Error 1 make: *** [lib] Error 2
Built with "Ebuild Take 3" and "Sources/Makefile Patch", USE="acc altivec debug encode oggvorbis truetype". "+dvd" fails because of masked a52dec and "+sdl" fails due to masked libsdl. Using these use flags, I can build a copy of ffmpeg which works with the test files I've thrown at it. It fails to encode ogg, but I think that's a problem with libogg rather than ffmpeg. I'm not sure if any of this is news... I assume it's lu-zero's patch which needs pushed upstream? If i'm not mistaken, it is the same changes as are present in the other patch? What additional information needs to accompany the patch when i send it upstream (hopefully tomorrow)? This one's close; let's hammer it out.
What about the issue Lina pointed out?
What needs to be done is to download the current cvs version and port my patches to that version. lu-zero's patches are a step in that direction, but they have the problem I mentioned in comment #32. So basically, work left: 1) download current cvs from project homepage 2) write ebuild for current cvs build (can modify old ebuild) 3) apply my patches to the current cvs (which will require editing the sources manually since they are slightly different now) 4) post result back here so a few people can test 5) if 4 comes back okay, send upstream.
The latest patch should apply cleanly to the current cvs. I can push it myself IF you can assure me it will work on osx
New problem: gcc -Wall -Wno-switch -fast -mcpu=7450 -pipe -fPIC -fno-common -no-cpp-precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-compare -faltivec -I. -I'/var/tmp/portage/ffmpeg-0.4.9/work/ffmpeg' -I'/var/tmp/portage/ffmpeg-0.4.9/work/ffmpeg'/libavcodec -I'/var/tmp/portage/ffmpeg-0.4.9/work/ffmpeg'/libavformat -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o output_example.o output_example.c gcc -Wl,-dynamic,-search_paths_first -g -o output_example output_example.o -L./libavformat -lavformat -L./libavcodec -lavcodec -lz make -C vhook all make[1]: *** No rule to make target `null.dylib', needed by `all'. Stop. make: *** [videohook] Error 2 Notice "null.dylib". That's definitely a problem.
ffmpeg # ./ffmpeg --help dyld: ./ffmpeg Undefined symbols: ./ffmpeg undefined reference to _av_destruct_packet_nofree expected to be defined in /usr/lib/libavformat.dylib ./ffmpeg undefined reference to _ffm_nopts expected to be defined in /usr/lib/libavformat.dylib ./ffmpeg undefined reference to _first_avcodec expected to be defined in /usr/lib/libavcodec.dylib ./ffmpeg undefined reference to _first_iformat expected to be defined in /usr/lib/libavformat.dylib ./ffmpeg undefined reference to _first_image_format expected to be defined in /usr/lib/libavformat.dylib ./ffmpeg undefined reference to _first_oformat expected to be defined in /usr/lib/libavformat.dylib ./ffmpeg undefined reference to _first_protocol expected to be defined in /usr/lib/libavformat.dylib ./ffmpeg undefined reference to _loop_input expected to be defined in /usr/lib/libavformat.dylib Trace/BPT trap
Okay - after the fixes to libavformat that were discussed between myself and Luca on IRC, it seems to build properly, with one hitch - none of the dynamic shared libraries get installed to /usr/lib. Hence when I run the ffmpeg binary "ffmpeg --help", I get undefined symbols. So - the problem is somewhere in the installation phase.
If that's the case, why is it I'm able to use the application to perform file conversions?
You're using the application from portage, or from a cvs checkout of ffmpeg?
My binary is built by portage using the ebuild attached to this bug. The ebuild downloads the sources from a sourceforge mirror and then patches using the "Sources/Makefile Patch" which I placed in the files directory.
Current working patch is inCVS here. I'll have more time next week to get it working against the CVS snapshots.
Created attachment 63084 [details, diff] changes made to ffmpeg-0.4.9_p20050226-r5.ebuild for OSX port (not complete) Sharing my today's efforts to apply Lina's patch from 0.4.8 to 0.4.9_p20050226-r5. It manages to get through the static stuff, but only when disabling the vhook. Maybe my efforts help someone else to get going.
Created attachment 63085 [details, diff] patch to apply on ffmpeg-0.4.9_p20050226 to make it more OSX compliant (not complete) This is a 'ported' patch from 0.4.8 to 0.4.9. It mainly deals with correcting the little changes that have been since and doing the patch by hand. Some extra changes by me were made to allow compilation to get somewhat further. Maybe this work saves someone else from doing the manual patch job
Created attachment 63086 [details, diff] patch to apply on ffmpeg-0.4.9_p20050226 sources (de-typo-ed version - not complete) just saw too late that there were some stupid typos in my patch, as well as new oportunities to get a bit further in the process of getting the stuff to compile.
You really might want to consider working with the current CVS snapshot. I'm not sure if they've changed much since the latest snapshot in the portage tree. When you send to upstream, they're going to want a patch against their current CVS.
Created attachment 63172 [details, diff] patches made to get it to compile on ffmpeg-0.4.9_p20050226 This from the bottom up recreated patch allows to compile static and shared. I haven't pushed my luck on any of the useflags (yet). The patch is a joint venture of me, Google, some fink inspiration and j4rg0n. I know for sure this patch is useless for upstream, since it's too hairy.
Created attachment 63173 [details, diff] patches made to the ebuild to get it to compile Note that the osx patches are applied after any other patch. With this patch I was able to compile, but it's far from the nicest solution around as it sometimes uses brute force...
Created attachment 65208 [details, diff] Sources Patch Okay, this is not my final answer, as I need to make some of my changes darwin-only. So yes, this will probably break linux installs atm. kito - the problem was twofold: 1) flat_namespace was doing funky things. 2) INSTALLSTRIP killed my dylibs. I'll pretty this up on Sunday. If anyone wants to test for me on Tiger, that would be much appreciated.
Created attachment 65209 [details] Ebuild For convenience, this is the ebuild. You can get the source I used here: http://dev.gentoo.org/~j4rg0n/ffmpeg.tgz (Just in case upstream CVS changes over the next 2 days).
Created attachment 65337 [details, diff] Arch-agnostic Patch These patches should be architecture agnostic. I'm testing them right now on ppc-macos to make sure I didn't typo anything.
Created attachment 65340 [details, diff] Arch Agnostic Patch Deleted too many lines. Fixed it in this version.
lazy verification: compiles with no extra use flags on ppc-macos (10.4) and x86 also appears to work on converting an avi to mpeg or wav.
Patches are in upstream CVS now. Closing out this bug.
*cheer* :)