[Ffmpeg-devel] Patch to allow cross-compile with MacOS X

Måns Rullgård mru
Mon Jul 10 22:33:51 CEST 2006


Graham Booker <ffmpeglist at cod3r.com> writes:

> I sent this patch before, but it received no response.  It was
> neither rejected nor commented on, so I must assumed it was missed.
>
> The problem:
> In order to do cross development on MacOS X, one has to tell gcc to
> use a different set of libraries, headers, etc...  In Apple's gcc,
> this is done by the -isysroot option.
> The configure command we use on ppc to build for i368 is:
> configure" --cross-compile --cpu=x86 --enable-pp --enable-gpl --extra-
> cflags='-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' --extra-
> ldflags='-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386'
>
> And the config.err file ends with:
>
> BEGIN /tmp/ffmpeg-conf-13958-3900-1136.c
>       1	int main(){
>       2	    return 0;
>       3	}
> END /tmp/ffmpeg-conf-13958-3900-1136.c
> cc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -no-cpp-
> precomp -pipe -fomit-frame-pointer -force_cpusubtype_ALL -Wno-sign-
> compare -Wl,-dynamic,-search_paths_first -isysroot /Developer/SDKs/
> MacOSX10.4u.sdk -arch i386 -o /tmp/ffmpeg-conf-23951-3900-23211 /tmp/
> ffmpeg-conf-13958-3900-1136.c
> /usr/bin/ld: -syslibroot: multiply specified
> collect2: ld returned 1 exit status
> C compiler test failed.
>
> The problem is that the -isysroot must be given to both the compile
> and link stages, but the configure tests doing both in the same
> stage.  The error message "-syslibroot: multiply specified" clearly
> indicates that this option can only be specified once (even if it is
> the same).  The solution is to separate the compile and link stages
> in the configure, which is all that the following patch does.

No changes needed to makefiles?

> It was created against svn 5649, but still applies to svn 5706.  I am
> including the text of the patch here because it is short and the list
> stripped the attachment the first time I tried to send it:
>
> Index: configure
> ===================================================================
> --- configure	(revision 5649)
> +++ configure	(working copy)
> @@ -226,8 +226,10 @@
>       log check_ld "$@"
>       cat >$TMPC
>       log_file $TMPC
> -    log $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs
> -    $cc $CFLAGS $LDFLAGS "$@" -o $TMPE $TMPC $extralibs >>$logfile 2>&1
> +    log $cc $CFLAGS "$@" -c -o $TMPO $TMPC >>$logfile 2>&1
> +    $cc $CFLAGS "$@" -c -o $TMPO $TMPC >>$logfile 2>&1
> +    log $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs >>$logfile 2>&1
> +    $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs >>$logfile 2>&1
> }
> check_cflags(){

The problem with this is that some tests pass linker flags to the
check_ld function, and passing linker flags when only compiling (as
this would do) makes the compiler complain.

Use --cc='gcc -isysroot whatever' until we think of something better.

Visiting whoever designed that option handling with a large cluebat
would be something to start with.

-- 
M?ns Rullg?rd
mru at inprovide.com




More information about the ffmpeg-devel mailing list