Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2002 16:20:03 -0700 (PDT)
From:      Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
To:        freebsd-ports@FreeBSD.org
Subject:   Re: ports/43877: Ogle port broken on STABLE
Message-ID:  <200210092320.g99NK3Ve082461@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/43877; it has been noted by GNATS.

From: Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
To: Jose Marques <noway@nohow.demon.co.uk>
Cc: freebsd-gnats-submit@FreeBSD.ORG,
	Jon Noack <noackjr@compgeek.com>,
	Kim Scarborough <sluggo@unknown.nu>, mbr@FreeBSD.org,
	eivind@FreeBSD.org
Subject: Re: ports/43877: Ogle port broken on STABLE
Date: Wed, 9 Oct 2002 20:06:39 -0300

 Hi,
 
 	Your reported problem seems to be have been reported by at
 least 2 others.
 	However, I cannot reproduce your problem.
 
 	FreeBSD "does not have" native swap32 routines.
 How is that?
 
 	Well, we do have ntohl() in <machine/endian.h> IF you're
 running a i386 arch later than or equal to a 486. Hence, the patch
 files/extra-patch-include:ogle_endian.h inside the ogle port.
 
 	Also, there is a bswap32() in <stand.h> IF __i386__ is
 defined. And, you have to link against libstand. Anyone care
 to elaborate on this one?
 
 	However, NONE of you should be having this problem AFAIK.
 Check file ogle-0.8.5/include/ogle_endian.h
 
 ---------------------------
 
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
 
 #ifdef WORDS_BIGENDIAN
 #  define FROM_BE_32(x) (x)
 #else
 
 
 #if defined(HAVE_BYTESWAP_H)
 #  include <byteswap.h>
 #  define FROM_BE_32(x) (bswap_32(x))
 #elif defined(HAVE_SYS_BSWAP_H)
 #  include <sys/bswap.h>
 #  define FROM_BE_32(x) (bswap32(x))
 #elif defined(HAVE_SYS_ENDIAN_H)
 #  include <sys/endian.h>
 #  define FROM_BE_32(x) (swap32(x))
 #else
 #  warning "No accelerated byte swap found. Using slow c version."
 #  include <inttypes.h>
 static inline uint32_t FROM_BE_32(uint32_t x)
 {
   return (((x & 0xff000000) >> 24) |
           ((x & 0x00ff0000) >>  8) |  
           ((x & 0x0000ff00) <<  8) |
           ((x & 0x000000ff) << 24));
 }
 
 #endif /* INCLUDE TESTS */
 
 #endif /* WORDS_BIGENDIAN */
 
 #endif /* ENDIAN_H_INCLUDED */
 
 ---------------------------
 
 	FreeBSD has neither WORDS_BIGENDIAN, HAVE_BYTESWAP_H,
 HAVE_SYS_BSWAP_H nor HAVE_SYS_ENDIAN_H. Therefore, it will fallback
 to defining the macro FROM_BE_32(x) as
 
 static inline uint32_t FROM_BE_32(uint32_t x)
 {
   return (((x & 0xff000000) >> 24) |
           ((x & 0x00ff0000) >>  8) |
           ((x & 0x0000ff00) <<  8) |
           ((x & 0x000000ff) << 24));
 }
 
 	It should never have any references to swap32(). The only situation
 where that happens is IF you have <sys/endian.h> which DOES NOT EXIST
 under FreeBSD. Under FreeBSD we have <machine/endian.h>,
 
 $ find /usr/src /usr/include /usr/X11R6/include /usr/local/include/ -name endian.h
 /usr/src/sys/alpha/include/endian.h
 /usr/src/sys/i386/boot/dosboot/endian.h
 /usr/src/sys/i386/include/endian.h
 /usr/src/sys/netatalk/endian.h
 /usr/src/sys/sys/endian.h
 /usr/src/sys-altq/alpha/include/endian.h
 /usr/src/sys-altq/i386/boot/dosboot/endian.h
 /usr/src/sys-altq/i386/include/endian.h
 /usr/src/sys-altq/netatalk/endian.h
 /usr/src/sys-altq/sys/endian.h
 /usr/include/machine/endian.h
 /usr/include/netatalk/endian.h
 
 	That's why we do the WITH_OPTIMIZED_BYTESWAP trick which does
 
  #elif defined(HAVE_SYS_ENDIAN_H)
  #  include <sys/endian.h>
 +#elif defined(__FreeBSD__)
 +#  define _KERNEL
 +#  define I486_CPU     /* Will crash unless 486+ */
 +#  include <machine/endian.h>
 +#  undef _KERNEL
 +#  undef I486_CPU
 +#  define FROM_BE_32(x) (ntohl(x))
  #else
  #  warning "No accelerated byte swap found. Using slow c version."
  #  include <inttypes.h>
 
 	Which means, we will be using optimized ntohl() instead of
 the inline code.
 
 	I really want to understand how are your systems trying
 to use swap32().
 	Any ideas?
 
 On Wed, Oct 09, 2002 at 02:42:45PM -0700, Jose Marques wrote:
 > 
 > >Description:
 > Ogle port build fails due to missing swap32 function.  Still fails if
 > WITH_OPTIMIZED_BYTESWAP section of Makefile is commented out.
 > >How-To-Repeat:
 > cd /usr/ports/graphics/ogle
 > make
 > 
 > Results in:
 > [Snip]
 > cc -O -pipe -march=pentiumpro -Wall -fomit-frame-pointer -funroll-loops -O -pipe -march=pentiumpro -Wall -fomit-frame-pointer -funroll-loops -march=i586 -mcpu=pentiumpro -o .libs/ogle_mpeg_vs video_stream.o video_mpeg1.o video_mpeg2.o video_motion.o c_getbits.o video_tables.o yuv2rgb_mmx.o idct_mmx.o mmx_mlib.o  ../common/libcommon.a ../ogle/.libs/libmsgevents.so -Wl,--rpath -Wl,/usr/local/lib/ogle
 > video_stream.o: In function `get_vlc':
 > video_stream.o(.text+0x1c5): undefined reference to `swap32'
 > video_stream.o: In function `next_start_code':
 > video_stream.o(.text+0x50d): undefined reference to `swap32'
 > video_stream.o(.text+0x5a5): undefined reference to `swap32'
 > video_stream.o: In function `resync':
 > video_stream.o(.text+0x61d): undefined reference to `swap32'
 > video_stream.o: In function `drop_to_next_picture':
 > video_stream.o(.text+0x695): undefined reference to `swap32'
 > video_stream.o(.text+0xb51): more undefined references to `swap32' follow
 > gmake[1]: *** [ogle_mpeg_vs] Error 1
 > gmake[1]: Leaving directory `/usr/ports/graphics/ogle/work/ogle-0.8.5/mpeg2_video'
 > gmake: *** [all-recursive] Error 1
 > *** Error code 2
 
 -- 
 Mario S F Ferreira - DF - Brazil - "I guess this is a signature."
 Computer Science Undergraduate | FreeBSD Committer | CS Developer
 flames to beloved devnull@someotherworldbeloworabove.org
 feature, n: a documented bug | bug, n: an undocumented feature

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210092320.g99NK3Ve082461>