Re: Compilation under Cygwin

"Steven M. Schultz" <[email protected]> Thu, 11 Oct 2007 21:00:52 -0700 (PDT)
Newsgroups gmane.comp.video.mjpeg.devel
Message-ID <[email protected]>
On Wed, 10 Oct 2007, martyCZ wrote:

> I recently managed to compile mjpegtools-1.9.0rc2.tar.gz tarball under 
> actual Cygwin. I found few issues and tried to solve them...

> 	/mpeg2enc/ontheflyratectl.cc:880: error: no matching function for call to `min(int32_t&, int)'
> New code:
> 	target_bits = min( target_bits, (int32_t)(encparams.video_buffer_size*3/4) );

> Reported error:
> 	/mpeg2enc/pass2ratectl.cc:244: error: no matching function for call to `min(int32_t&, int)'
> 	/mpeg2enc/pass2ratectl.cc
> New code:
> 	target_bits = min( target_bits, (int32_t)(encparams.video_buffer_size*3/4) );

	I really do not like using casts to hide/mask problems.  It seems
	that Cygwin's implementation of min() is somewhat broken ;(   Most
	other systems I looked at use a macro like

	   #define min(a,b) ((a) <= (b) ? (a) : (b))

	which won't generate a call to a function as Cygwin seems to be
	doing.

	For the errors above the better fix, I think, is to change the 2nd
	definition of 'target_bits' from 'int32_t' to simply 'int' in the
	file 'ontheflyratectl.hh'.  Once that's done then Cygwin should see
	'int' for both arguments to min().     That change has been checked
	in to CVS.

	But I wouldn't worry too much about mpeg2enc - the artifacting/corruption
	has not been fixed yet.
	

> Reported errors:
> 	/y4mdenoise/ReferenceFrame.hh:384: undefined reference to `Limits<unsigned int>::Log2Bits'
> 	/y4mdenoise/ReferenceFrame.hh:438: undefined reference to `Limits<unsigned int>::Bits'
> 	/y4mdenoise/BitmapRegion2D.hh
> Original code:
> 	... Limits<unsigned int> ...
> New code:
> 	... Limits<uint32_t> ...

	It seems that Cygwin assumes that all the world is 32bit and that
	'sizeof (unsigned in)' == 'sizeof (uint32_t)'.  This is not 
	always true - there are 64 bit systems out there.  Does Cygwin work
	on 64bit systems?  What effect would the suggested change have for
	those systems?  

	I believe the intent of the Limits templating code was to determine
	the number of bits in a word - NOT to force the word size to be 32bits

	Steven Schultz


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/