Bug 188424 - emulators/wine build with gcc47 fails
Summary: emulators/wine build with gcc47 fails
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Gerald Pfeifer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-10 16:00 UTC by Lena
Modified: 2015-01-24 20:33 UTC (History)
2 users (show)

See Also:


Attachments
Proposed patch (4.65 KB, patch)
2014-12-28 13:45 UTC, Gerald Pfeifer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lena 2014-04-10 16:00:00 UTC
While trying to update the port emulators/wine from 1.6.1,1 to 1.6.2,1:

...
gmake[1]: Entering directory `/usr/ports/emulators/wine/work/wine-1.6.2/dlls/acledit'
gcc47 -c -I. -I. -I../../include -I../../include  -D__WINESRC__  -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wwrite-strings -Wpointer-arith -Wlogical-op -fno-omit-frame-pointer -I/usr/local/include -O2 -pipe -march=athlon-mp -Wl,-rpath=/usr/local/lib/gcc47 -fno-strict-aliasing  -o main.o main.c
../../tools/winegcc/winegcc  -B../../tools/winebuild --sysroot=../.. -fasynchronous-unwind-tables -shared ./acledit.spec main.o           -o acledit.dll.so    ../../libs/port/libwine_port.a  -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc47 -L/usr/local/lib/gcc47
local symbol 0: discarded in section `.text.__x86.get_pc_thunk.bx' from ../../dlls/winecrt0/libwinecrt0.a(dll_entry.o)
local symbol 1: discarded in section `.text.__x86.get_pc_thunk.bx' from ../../dlls/winecrt0/libwinecrt0.a(init.o)
winebuild: /usr/bin/ld failed with status 1
winegcc: ../../tools/winebuild/winebuild failed
gmake[1]: *** [acledit.dll.so] Error 2
gmake[1]: Leaving directory `/usr/ports/emulators/wine/work/wine-1.6.2/dlls/acledit'
gmake: *** [dlls/acledit] Error 2
*** Error code 1

How-To-Repeat: 
# cd /usr/ports/emulators/wine
# make clean
# MAKE_JOBS_UNSAFE=yes LANG=C make
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-04-10 16:00:07 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gerald

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Tijl Coosemans freebsd_committer freebsd_triage 2014-04-10 18:14:52 UTC
On Thu, 10 Apr 2014 17:24:14 +0200 (CEST) Gerald Pfeifer wrote:
> It looks like you are using lang/gcc47.  Can you please go 
> with lang/gcc instead, which is the default/canonical version
> of GCC?
> 
> What looks odd is that GCC should imply the use of binutils,
> and I just confirmed that via reading Mk/Uses/compiler.mk and
> Mk/bsd.gcc.mk (which has USE_BINUTILS=yes).
> 
> Tijl, do you have an idea?
> 
> Lena, can you share the output of "make test-gcc"?

If there's CC=gcc47 in /etc/make.conf that would explain it.
compiler.mk doesn't set USE_GCC in that case because.
Comment 3 Lena 2014-04-15 19:09:03 UTC
I didn't receive these emails, found them in GNATS.

> From:   Tijl Coosemans <tijl@FreeBSD.org>
> To:     Gerald Pfeifer <gerald@pfeifer.com>
> Date:   Thu, 10 Apr 2014 19:14:52 +0200
>
> On Thu, 10 Apr 2014 17:24:14 +0200 (CEST) Gerald Pfeifer wrote:
> > It looks like you are using lang/gcc47.  Can you please go
> > with lang/gcc instead,

How?  I just issue `make`, or `portupgrade`. Port lang/gcc47 is
installed as a dependency for mplayer, libxul, vlc.

> > which is the default/canonical version
> > of GCC?
> >
> > What looks odd is that GCC should imply the use of binutils,
> > and I just confirmed that via reading Mk/Uses/compiler.mk and
> > Mk/bsd.gcc.mk (which has USE_BINUTILS=yes).

binutils-2.24 is installed as a dependency for gcc47-4.7.4.20140412 .

> > Tijl, do you have an idea?
> >
> > Lena, can you share the output of "make test-gcc"?

/usr/ports/emulators/wine # make test-gcc
USE_GCC=4.7+
Port can use later versions.
GCC version: 4.2 (base) - OSVERSION from 700042 to 9999999
GCC version: 4.6 - OSVERSION from 0 to 0
GCC version: 4.7 (port) - OSVERSION from 0 to 0
GCC version: 4.8 - OSVERSION from 0 to 0
GCC version: 4.9 - OSVERSION from 0 to 0
Using GCC version 4.7
CC=gcc47 - CXX=g++47 - CPP=cpp47 - CFLAGS="-O2 -pipe -march=athlon-mp -Wl,-rpath=/usr/local/lib/gcc47 -fno-strict-aliasing"
LDFLAGS=" -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc47 -L/usr/local/lib/gcc47"
BUILD_DEPENDS=/usr/local/bin/flex:/usr/ports/textproc/flex bison:/usr/ports/devel/bison gmake:/usr/ports/devel/gmake gcc47:/usr/ports/lang/gcc /usr/local/bin/as:/usr/ports/devel/binutils       /usr/local/libdata/pkgconfig/glproto.pc:/usr/ports/x11/glproto /usr/local/libdata/pkgconfig/dri2proto.pc:/usr/ports/x11/dri2proto /usr/local/libdata/pkgconfig/xcursor.pc:/usr/ports/x11/libXcursor /usr/local/libdata/pkgconfig/xi.pc:/usr/ports/x11/libXi /usr/local/libdata/pkgconfig/xpm.pc:/usr/ports/x11/libXpm /usr/loc al/libdata/pkgconfig/xrandr.pc:/usr/ports/x11/libXrandr /usr/local/libdata/pkgconfig/xrender.pc:/usr/ports/x11/libXrender
RUN_DEPENDS=gcc47:/usr/ports/lang/gcc  /usr/local/libdata/pkgconfig/xcursor.pc:/usr/ports/x11/libXcursor /usr/local/libdata/pkgconfig/xi.pc:/usr/ports/x11/libXi /usr/local/libdata/pkgconfig/xpm.pc:/usr/ports/x11/libXpm /usr/local/libdata/pkgconfig/xrandr.pc:/usr/ports/x11/libXrandr /usr/local/libdata/pkgconfig/xrender.pc:/usr/ports/x11/libXrender

> If there's CC=gcc47 in /etc/make.conf that would explain it.
> compiler.mk doesn't set USE_GCC in that case because.

~ $ grep -i GCC /etc/make.conf
FAVORITE_COMPILER=gcc
~ $
Comment 4 Lena 2014-04-18 20:53:59 UTC
P.S. I reinsalled all ports which depended on lang/gcc47,
deinsalled lang/gcc47, then tried to upgrade wine -
the build installed lang/gcc, then failed:

...
gmake[1]: Entering directory `/usr/ports/emulators/wine/work/wine-1.6.2/dlls/acledit'
gcc47 -c -I. -I. -I../../include -I../../include  -D__WINESRC__  -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wwrite-strings -Wpointer-arith -Wlogical-op -fno-omit-frame-pointer -I/usr/local/include -O2 -pipe -march=athlon-mp -Wl,-rpath=/usr/local/lib/gcc47 -fno-strict-aliasing  -o main.o main.c
../../tools/winegcc/winegcc  -B../../tools/winebuild --sysroot=../.. -fasynchronous-unwind-tables -shared ./acledit.spec main.o           -o acledit.dll.so    ../../libs/port/libwine_port.a  -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc47 -L/usr/local/lib/gcc47
local symbol 0: discarded in section `.text.__x86.get_pc_thunk.bx' from ../../dlls/winecrt0/libwinecrt0.a(dll_entry.o)
local symbol 1: discarded in section `.text.__x86.get_pc_thunk.bx' from ../../dlls/winecrt0/libwinecrt0.a(init.o)
winebuild: /usr/bin/ld failed with status 1
winegcc: ../../tools/winebuild/winebuild failed
gmake[1]: *** [acledit.dll.so] Error 2
gmake[1]: Leaving directory `/usr/ports/emulators/wine/work/wine-1.6.2/dlls/acledit'
gmake: *** [dlls/acledit] Error 2
*** Error code 1
Stop in /usr/ports/emulators/wine.
*** Error code 1

/usr/ports/emulators/wine # make test-gcc
USE_GCC=4.7+
Port can use later versions.
GCC version: 4.2 (base) - OSVERSION from 700042 to 9999999
GCC version: 4.6 - OSVERSION from 0 to 0
GCC version: 4.7 (port) - OSVERSION from 0 to 0
GCC version: 4.8 - OSVERSION from 0 to 0
GCC version: 4.9 - OSVERSION from 0 to 0
Using GCC version 4.7
CC=gcc47 - CXX=g++47 - CPP=cpp47 - CFLAGS="-O2 -pipe -march=athlon-mp -Wl,-rpath=/usr/local/lib/gcc47 -fno-strict-aliasing"
LDFLAGS=" -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc47 -L/usr/local/lib/gcc47"
BUILD_DEPENDS=/usr/local/bin/flex:/usr/ports/textproc/flex bison:/usr/ports/devel/bison gmake:/usr/ports/devel/gmake gcc47:/usr/ports/lang/gcc /usr/local/bin/as:/usr/ports/devel/binutils       /usr/local/libdata/pkgconfig/glproto.pc:/usr/ports/x11/glproto /usr/local/libdata/pkgconfig/dri2proto.pc:/usr/ports/x11/dri2proto /usr/local/libdata/pkgconfig/xcursor.pc:/usr/ports/x11/libXcursor /usr/local/libdata/pkgconfig/xi.pc:/usr/ports/x11/libXi /usr/local/libdata/pkgconfig/xpm.pc:/usr/ports/x11/libXpm /usr/loc al/libdata/pkgconfig/xrandr.pc:/usr/ports/x11/libXrandr /usr/local/libdata/pkgconfig/xrender.pc:/usr/ports/x11/libXrender
RUN_DEPENDS=gcc47:/usr/ports/lang/gcc  /usr/local/libdata/pkgconfig/xcursor.pc:/usr/ports/x11/libXcursor /usr/local/libdata/pkgconfig/xi.pc:/usr/ports/x11/libXi /usr/local/libdata/pkgconfig/xpm.pc:/usr/ports/x11/libXpm /usr/local/libdata/pkgconfig/xrandr.pc:/usr/ports/x11/libXrandr /usr/local/libdata/pkgconfig/xrender.pc:/usr/ports/x11/libXrender

~ $ grep -i gcc /etc/make.conf
FAVORITE_COMPILER=gcc
~ $
Comment 5 Tijl Coosemans freebsd_committer freebsd_triage 2014-04-18 21:07:31 UTC
On Fri, 18 Apr 2014 22:53:59 +0300 Lena@lena.kiev.ua wrote:
> P.S. I reinsalled all ports which depended on lang/gcc47,
> deinsalled lang/gcc47, then tried to upgrade wine -
> the build installed lang/gcc, then failed:
> 
> ...
> gmake[1]: Entering directory `/usr/ports/emulators/wine/work/wine-1.6.2/dlls/acledit'
> gcc47 -c -I. -I. -I../../include -I../../include  -D__WINESRC__  -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wwrite-strings -Wpointer-arith -Wlogical-op -fno-omit-frame-pointer -I/usr/local/include -O2 -pipe -march=athlon-mp -Wl,-rpath=/usr/local/lib/gcc47 -fno-strict-aliasing  -o main.o main.c
> ../../tools/winegcc/winegcc  -B../../tools/winebuild --sysroot=../.. -fasynchronous-unwind-tables -shared ./acledit.spec main.o           -o acledit.dll.so    ../../libs/port/libwine_port.a  -L/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc47 -L/usr/local/lib/gcc47
> local symbol 0: discarded in section `.text.__x86.get_pc_thunk.bx' from ../../dlls/winecrt0/libwinecrt0.a(dll_entry.o)
> local symbol 1: discarded in section `.text.__x86.get_pc_thunk.bx' from ../../dlls/winecrt0/libwinecrt0.a(init.o)
> winebuild: /usr/bin/ld failed with status 1
> winegcc: ../../tools/winebuild/winebuild failed
> gmake[1]: *** [acledit.dll.so] Error 2
> gmake[1]: Leaving directory `/usr/ports/emulators/wine/work/wine-1.6.2/dlls/acledit'
> gmake: *** [dlls/acledit] Error 2
> *** Error code 1
> Stop in /usr/ports/emulators/wine.
> *** Error code 1
> 
> /usr/ports/emulators/wine # make test-gcc

What does "make -V LD" print?
Comment 6 Lena 2014-04-18 21:11:14 UTC
> What does "make -V LD" print?

/usr/ports/emulators/wine # make -V LD
/usr/local/bin/ld
/usr/ports/emulators/wine # pkg_which /usr/local/bin/ld
binutils-2.24

~ $ pkg_tree
...
gcc-4.7.3
|\__ gmp-5.1.3_1
|\__ mpfr-3.1.2_1
|\__ mpc-1.0.2
|\__ binutils-2.24
 \__ libiconv-1.14_3
...
Comment 7 Tijl Coosemans freebsd_committer freebsd_triage 2014-04-18 21:46:05 UTC
On Fri, 18 Apr 2014 23:11:14 +0300 Lena@lena.kiev.ua wrote:
>> What does "make -V LD" print?
> 
> /usr/ports/emulators/wine # make -V LD
> /usr/local/bin/ld
> /usr/ports/emulators/wine # pkg_which /usr/local/bin/ld
> binutils-2.24
> 
> ~ $ pkg_tree
> ...
> gcc-4.7.3
> |\__ gmp-5.1.3_1
> |\__ mpfr-3.1.2_1
> |\__ mpc-1.0.2
> |\__ binutils-2.24
>  \__ libiconv-1.14_3
> ...

I think the problem is in winegcc.  It would have to run winebuild with
--ld-cmd=/usr/local/bin/ld.  Without that winebuild simply searches PATH
for "ld" and finds /usr/bin/ld.

In tools/winegcc/Makefile.in the DEFS variable contains CPP, CC and CXX.
LD could be added there.  Then tools/winegcc/winegcc.c needs to be
modified to add "--ld-cmd=" + build_tool_name(..., "ld", LD) to the
winebuild command line.  Maybe Gerald or a Wine developer can pick up
from here.  I currently don't have the time to look into this in more
detail.
Comment 8 Gerald Pfeifer freebsd_committer freebsd_triage 2014-12-28 10:54:09 UTC
I have been looking into it, alas this appears more involved than it
seemed at first glance.

So I'll ask upstream Wine for help based on my non-functional patch,
but don't hold your breath. :-(
Comment 9 Gerald Pfeifer freebsd_committer freebsd_triage 2014-12-28 13:45:40 UTC
Created attachment 151034 [details]
Proposed patch

Actually, I managed to devise a patch that _seem_s to work. :-)

Can you please let me know whether it works for you?  (Put this
attachment into emulators/wine-devel/files .  When/if it works
for that, I'll look into applying it for emulators/wine as well.)
Comment 10 Tijl Coosemans freebsd_committer freebsd_triage 2014-12-28 14:51:07 UTC
(In reply to Gerald Pfeifer from comment #9)
> Created attachment 151034 [details]
> Proposed patch
> 
> Actually, I managed to devise a patch that _seem_s to work. :-)
> 
> Can you please let me know whether it works for you?  (Put this
> attachment into emulators/wine-devel/files .  When/if it works
> for that, I'll look into applying it for emulators/wine as well.)

I have not tested it but this patch looks good to me.  I thought that --ld-cmd had to be added to the other cases where winegcc runs winebuild, but winebuild only runs ld when generating a .spec.o file so your patch is correct.

The extra printf is for debugging right?
Comment 11 Gerald Pfeifer freebsd_committer freebsd_triage 2014-12-29 10:23:26 UTC
(In reply to Tijl Coosemans from comment #10)
> The extra printf is for debugging right?

Yep.  And thanks for checking the patch, Tijl!  I'll submit upstream
now.

Lena, if you still can give this a try that will be great.  If there
is anything missing, I'll try to address it.
Comment 12 Lena 2014-12-29 16:42:45 UTC
> (Put this
> attachment into emulators/wine-devel/files .

I had to erase "b/" in filenames in the patch. Then wine-devel builds with gcc48 and works.
Comment 13 commit-hook freebsd_committer freebsd_triage 2015-01-10 09:04:26 UTC
A commit references this bug:

Author: gerald
Date: Sat Jan 10 09:03:28 UTC 2015
New revision: 376677
URL: https://svnweb.freebsd.org/changeset/ports/376677

Log:
  Support building with alternate toolchains that require LD to be
  honored.  This is a bit invasive in that it touches several parts
  of Wine, and has not been accepted upstream yet, so I am adding it
  locally for now.

  PR:		188424
  Suggested by:	tijl
  Reviewed by:	tijl
  Tested by:	Lena@lena.kiev.ua

Changes:
  head/emulators/wine-devel/files/patch-alternate-toolchain
Comment 14 Gerald Pfeifer freebsd_committer freebsd_triage 2015-01-10 09:11:26 UTC
Thank you, Lena, and thank you, Tijl!

This is now addressed in the wine-devel port, I'll keep pushing
upstream, and if there is a need/report, I can also look into 
making this change for the wine port (though someone using that
may not be using other toolchains, which is why I am not making
this change initially).
Comment 15 commit-hook freebsd_committer freebsd_triage 2015-01-24 20:33:02 UTC
A commit references this bug:

Author: gerald
Date: Sat Jan 24 20:32:17 UTC 2015
New revision: 377820
URL: https://svnweb.freebsd.org/changeset/ports/377820

Log:
  Update to Wine 1.7.35.  This includes the following changes:
   - Beginnings of support for OpenGL core contexts.
   - Initial support for glyph placement in DirectWrite.
   - Some more WBEM objects.
   - Various bug fixes.

  My fix for PR 188424 is now upstream, so files/patch-alternate-toolchain
  is not applicable any more; remove it.

  PR:		188424

Changes:
  head/emulators/wine-devel/Makefile
  head/emulators/wine-devel/distinfo
  head/emulators/wine-devel/files/patch-alternate-toolchain
  head/emulators/wine-devel/pkg-plist