[MPlayer-cygwin] Not sure what's causing this..MinGW Compilation problems.
Marc Schulz
schulz.marc at gmail.com
Thu Mar 23 20:08:11 CET 2006
Corey Hickey wrote:
> Marc Schulz wrote:
>> I'm attempting to compile mencoder. I have downloaded all the
>> necessary files from cvs. I also downloaded the libavcodec stuff and
>> moved the 3 folders into the right dir. I use the following configure
>> file unsuccessfully:
>>
>> ./configure \
>> --prefix=/usr \
>> --language=all \
>> --disable-win32 \
>> --disable-gui \
>> --disable-png \
>> --disable-real \
>> --disable-qtx \
>> --disable-jpeg \
>> --disable-gif \
>> --disable-tga \
>> --disable-mad \
>> --disable-freetype \
>> --disable-sdl \
>> --disable-menu \
>> --disable-directx \
>> --disable-gl \
>> --disable-win32waveout \
>> --disable-ftp \
>> --disable-network \
>> --disable-winsock2 \
>> --disable-liblzo \
>> --disable-tv \
>> --disable-dvb \
>> --disable-vidix \
>> --disable-pthreads \
>> --disable-edl \
>> --disable-internal-matroska \
>> --disable-mpdvdkit \
>> --disable-internal-faad \
>> --disable-faac \
>> --disable-libmpeg2 \
>> --disable-libdts \
>> --disable-liba52 \
>> --disable-mp3lib \
>> --disable-theora \
>> --disable-speex \
>> --disable-internal-tremor \
>> --disable-twolame \
>> --disable-md5sum \
>> --disable-pnm \
>> --disable-x264 \
>> --disable-vorbis \
>> --enable-largefiles \
>> --enable-runtime-cpudetection \
>> --enable-static="-mconsole -lwinmm"
>>
>> It produces the following error:
>>
>> c:\MinGW\bin\ar.exe: creating libaf.a
>> ranlib libaf.a
>> make[1]: Leaving directory `/home/ChronoCross/main/libaf'
>> windres -o osdep/mplayer-rc.o osdep/mplayer.rc
>> gcc -I../libvo -I../../libvo -fno-PIC -O4 -march=i486 -mtune=i686
>> -pipe -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE
>> -D_FILE_OFFSET_BITS=64 -I. -I./libavutil -I./libavcodec
>> -o mplayer.exe mplayer.o m_property.o mp_msg.o asxparser.o
>> codec-cfg.o cpudetect.o edl.o find_sub.o m_config.o m_option.o
>> m_struct.o parser-cfg.o playtree.o playtreeparser.o spudec.o sub_cc.o
>> subreader.o vobsub.o unrarlib.o mixer.o parser-mpcmd.o
>> subopt-helper.o osdep/mplayer-rc.o libvo/libvo.a libao2/libao2.a
>> libmpcodecs/libmpcodecs.a libaf/libaf.a libmpdemux/libmpdemux.a
>> input/libinput.a postproc/libswscale.a osdep/libosdep.a
>> libavcodec/libavcodec.a libavformat/libavformat.a
>> libavutil/libavutil.a libavcodec/libpostproc/libpostproc.a
>> -lmp3lame -lxvidcore -static -mconsole -lwinmm
>> -lz -static -mconsole
>> -lwinmm -static -mconsole -lwinmm -liconv -lm
>> libavcodec/libavcodec.a(xvid_rc.o):xvid_rc.c:(.text+0x1e): undefined
>> reference to `mkstemp'
>> libavcodec/libavcodec.a(xvid_rc.o):xvid_rc.c:(.text+0x284): undefined
>> reference to `mkstemp'
>> make: *** [mplayer.exe] Error 1
>>
>> Only compiling xvid and libavcodec.
>>
>> Doesn't work when just using ./compile with no params. Thanks in
>> advance.
>
> Please test the attached libavcodec patch. For reference, I wrote it
> for this thread:
>
> http://www1.mplayerhq.hu/pipermail/mplayer-users/2006-March/059088.html
>
> -Corey
> ------------------------------------------------------------------------
>
> Index: avcodec.h
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/avcodec.h,v
> retrieving revision 1.458
> diff -u -r1.458 avcodec.h
> --- avcodec.h 21 Mar 2006 17:27:46 -0000 1.458
> +++ avcodec.h 23 Mar 2006 06:01:48 -0000
> @@ -2598,6 +2598,8 @@
>
> extern unsigned int av_xiphlacing(unsigned char *s, unsigned int v);
>
> +int av_tempfile(char *prefix, char **filename);
> +
> #ifdef __cplusplus
> }
> #endif
> Index: utils.c
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/utils.c,v
> retrieving revision 1.178
> diff -u -r1.178 utils.c
> --- utils.c 6 Mar 2006 15:09:04 -0000 1.178
> +++ utils.c 23 Mar 2006 06:01:49 -0000
> @@ -33,6 +33,9 @@
> #include <stdarg.h>
> #include <limits.h>
> #include <float.h>
> +#ifdef CONFIG_WIN32
> +#include <fcntl.h>
> +#endif
>
> const uint8_t ff_reverse[256]={
> 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
> @@ -1349,3 +1352,39 @@
> n++;
> return n;
> }
> +
> +/* Wrapper to work around the lack of mkstemp() on mingw/cygin.
> + * Also, tries to create file in /tmp first, if possible.
> + * *prefix can be a character constant; *filename will be allocated internally.
> + * Returns file descriptor of opened file (or -1 on error)
> + * and opened file name in **filename. */
> +int av_tempfile(char *prefix, char **filename) {
> + int fd=-1;
> +#ifdef CONFIG_WIN32
> + *filename = tempnam(".", prefix);
> +#else
> + size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */
> + *filename = av_malloc(len * sizeof(char));
> +#endif
> + /* -----common section-----*/
> + if (*filename == NULL) {
> + av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
> + return -1;
> + }
> +#ifdef CONFIG_WIN32
> + fd = open(*filename, _O_RDWR | _O_BINARY | _O_CREAT, 0444);
> +#else
> + snprintf(*filename, len, "/tmp/%sXXXXXX", prefix);
> + fd = mkstemp(*filename);
> + if (fd < 0) {
> + snprintf(*filename, len, "./%sXXXXXX", prefix);
> + fd = mkstemp(*filename);
> + }
> +#endif
> + /* -----common section-----*/
> + if (fd < 0) {
> + av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
> + return -1;
> + }
> + return fd; /* success */
> +}
> Index: xvid_rc.c
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/xvid_rc.c,v
> retrieving revision 1.3
> diff -u -r1.3 xvid_rc.c
> --- xvid_rc.c 19 Mar 2006 11:49:37 -0000 1.3
> +++ xvid_rc.c 23 Mar 2006 06:01:49 -0000
> @@ -37,11 +37,10 @@
>
> //xvid_debug=-1;
>
> - tmp_name= av_strdup("/tmp/xvidrc.XXXXXX");
> - fd = mkstemp(tmp_name);
> - if(fd < 0){
> - strcpy(tmp_name, "./xvidrc.XXXXXX");
> - fd = mkstemp(tmp_name);
> + fd=av_tempfile("xvidrc.", &tmp_name);
> + if (fd == -1) {
> + av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n");
> + return -1;
> }
>
> for(i=0; i<s->rc_context.num_entries; i++){
> Index: xvidff.c
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/xvidff.c,v
> retrieving revision 1.8
> diff -u -r1.8 xvidff.c
> --- xvidff.c 18 Mar 2006 02:46:39 -0000 1.8
> +++ xvidff.c 23 Mar 2006 06:01:49 -0000
> @@ -27,9 +27,6 @@
> #include <unistd.h>
> #include "common.h"
> #include "avcodec.h"
> -#ifdef CONFIG_WIN32
> -#include <fcntl.h>
> -#endif
>
> /**
> * Buffer management macros.
> @@ -229,39 +226,7 @@
> rc2pass2.version = XVID_VERSION;
> rc2pass2.bitrate = avctx->bit_rate;
>
> -#ifdef CONFIG_WIN32 /* Ugly work around */
> - {
> - char *tempname;
> -
> - tempname = tempnam(".", "xvidff");
> - fd = -1;
> - if( tempname &&
> - (fd = open(tempname, _O_RDWR | _O_BINARY)) != -1 ) {
> - x->twopassfile = av_strdup(tempname);
> -#undef free
> - free(tempname);
> -#define free please_use_av_free
> - if( x->twopassfile == NULL ) {
> - av_log(avctx, AV_LOG_ERROR,
> - "XviD: Cannot allocate 2-pass buffer\n");
> - return -1;
> - }
> - }
> - }
> -#else
> - x->twopassfile = av_malloc(BUFFER_SIZE);
> - if( x->twopassfile == NULL ) {
> - av_log(avctx, AV_LOG_ERROR,
> - "XviD: Cannot allocate 2-pass buffer\n");
> - return -1;
> - }
> - strcpy(x->twopassfile, "/tmp/xvidff.XXXXXX");
> - fd = mkstemp(x->twopassfile);
> - if(fd < 0){
> - strcpy(x->twopassfile, "./xvidff.XXXXXX");
> - fd = mkstemp(x->twopassfile);
> - }
> -#endif
> + fd = av_tempfile("xvidff.", &(x->twopassfile));
> if( fd == -1 ) {
> av_log(avctx, AV_LOG_ERROR,
> "XviD: Cannot write 2-pass pipe\n");
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> MPlayer-cygwin mailing list
> MPlayer-cygwin at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-cygwin
>
Doesn't seem to work with today's CVS. I manually applied the patch but
opening each file and making the changes. Still gives this error
make[1]: Leaving directory `/home/ChronoCross/main/libaf'
windres -o osdep/mplayer-rc.o osdep/mplayer.rc
gcc -I../libvo -I../../libvo -fno-PIC -O4 -march=i486 -mtune=i686 -pipe
-ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I. -I./libavutil -I./libavcodec -o
mplayer.exe mplayer.o m_property.o mp_msg.o asxparser.o codec-cfg.o
cpudetect.o edl.o find_sub.o m_config.o m_option.o m_struct.o
parser-cfg.o playtree.o playtreeparser.o spudec.o sub_cc.o subreader.o
vobsub.o unrarlib.o mixer.o parser-mpcmd.o subopt-helper.o
osdep/mplayer-rc.o libvo/libvo.a libao2/libao2.a
libmpcodecs/libmpcodecs.a libaf/libaf.a libmpdemux/libmpdemux.a
input/libinput.a postproc/libswscale.a osdep/libosdep.a
libavcodec/libavcodec.a libavutil/libavutil.a
libavcodec/libpostproc/libpostproc.a -lmp3lame -lxvidcore
-static -mconsole -lwinmm -lz -static -mconsole
-lwinmm -static -mconsole -lwinmm -liconv -lm
libavcodec/libavcodec.a(utils.o):utils.c:(.text+0x1363): undefined
reference to `mkstemp'
libavcodec/libavcodec.a(utils.o):utils.c:(.text+0x13a1): undefined
reference to `mkstemp'
collect2: ld returned 1 exit status
make: *** [mplayer.exe] Error 1
however now it's in a different file.
More information about the MPlayer-cygwin
mailing list