wine-devel  

Re: heads up: wine 20020605 broken on FreeBSD, workaround included

Gerald Pfeifer
Mon, 01 Jul 2002 08:00:09 -0700

[ I'm now also Cc:ing this to the Wine developers, thus the full-quote.
  In fact, all non-GLIBC platforms seem to be affected by this bug! ]

Based on your pointer, I believe I found the problem. In aclocal.m4 we
have:

  AC_DEFUN([WINE_CHECK_ERRNO],
  [AC_CACHE_CHECK([for reentrant libc: $1],[wine_cv_libc_r_$1],
    [AC_TRY_RUN([int myerrno = 0;
  char buf[256];
  int *$1(){return &myerrno;}
  main(){connect(0,buf,255); exit(!myerrno);}],
    wine_cv_libc_r_$1=yes, wine_cv_libc_r_$1=no,
    wine_cv_libc_r_$1=yes)])
  AS_IF([test "$wine_cv_libc_r_$1" = "yes"],[$2],[$3])])

which, in configure, becomes:

  int myerrno = 0;
  char buf256;
  int *__error(){return &myerrno;}
  main(){connect(0,buf,255); exit(!myerrno);}

That is, instead of an array of 256 characters, we have one character,
and the invocation of connect() is definitely incorrect.

Could someone more familiar with autoconf please have a look at this?

Gerald

On Mon, 1 Jul 2002, Scott Bolte wrote:

>       Over the weekend I tried to get wine 20020605 to run on a
>       new installation of FreeBSD 4.6. It took a while, I haven't
>       tried wine since 1997 after all, but I determined that my
>       problems were due to configure's reentrant libc test failing
>       when building the port.
>
>       The wine_cv_libc_reentrant test in configure.ac first checks
>       for Linux (__errno_location) and then tests for FreeBSD
>       (__error).  I don't have more time to figure out why, but
>       nesting the FreeBSD test that way results in a false
>       negative. The configuration will continue, as will the
>       build, but the resulting non-reentrant code goes into an
>       endless loop when trying to spawn threads.
>
>       A crude workaround, for FreeBSD users at least, is to
>       replace the Linux test with the FreeBSD one. This needs to
>       be done before configure is run. I did it by hand, but I
>       expect the following code would do the trick.
>
>   % cd /usr/ports/emulators/wine
>   % make patch
>   % perl -i -pe 's/__errno_location/__error/' work/wine-20020605/configure.ac
>   % make
>   % make install
>
>       Below is the autoconf test script that demonstrates the
>       problem. It needs to be run in
>       /usr/ports/emulators/wine/work/wine-20020605/configure.ac
>
>               Scott
>
>       P.S. I'm not on the freebsd-emulators mailing list, but I
>            see from freebsd-questions that at least one other
>            person got wine to compile on 4.6. I can't explain
>            why it worked for him and not for me. However, I
>            installed a brand new copy of 4.6 from the standard
>            ISO images just to run wine.
>
> ---- testconf.ac
> dnl Process this file with autoconf to produce a configure script.
> dnl Original author: Michael Patra
> dnl See ChangeLog file for detailed change history.
>
> m4_define(WINE_VERSION,regexp(m4_include(VERSION),[version \([-.0-9A-Za-z]+\)],[\1]))
>
> AC_PREREQ(2.53)
> AC_INIT([Wine],WINE_VERSION)
> AC_CONFIG_SRCDIR(server/atom.c)
> AC_CONFIG_AUX_DIR(tools)
>
> dnl **** Check for some programs ****
>
> AC_PROG_CC
>
> dnl **** Check for reentrant libc ****
>
> wine_cv_libc_reentrant=no
>
> dnl   #####
> dnl   ##### There is a problem if the FreeBSD test is nested
> dnl   ##### after the Linux test. In that instance, it fails.
> dnl   ##### If, on the other hand, it is tested first, it works.
> dnl   #####
> dnl   ##### Swap the order of two following test case to see
> dnl   ##### how they differ. (Ignore the second case since it
> dnl   ##### will use cached data.)
> dnl   #####
>
> dnl FreeBSD style errno location
> WINE_CHECK_ERRNO([__error], [wine_cv_libc_reentrant=__error])
>
> dnl Linux style errno location
> WINE_CHECK_ERRNO([__errno_location], [wine_cv_libc_reentrant=__errno_location],
>   dnl FreeBSD style errno location
>   WINE_CHECK_ERRNO([__error], [wine_cv_libc_reentrant=__error]
> ))
>

-- 
Gerald "Jerry" [EMAIL PROTECTED] http://www.dbai.tuwien.ac.at/~pfeifer/