Even after patches by Michael Cronenworth and me, cf. https://www.winehq.org/pipermail/wine-devel/2020-January/157945.html https://www.winehq.org/pipermail/wine-devel/2020-January/158454.html Wine still fails to build with GCC 10 development snapshots.
This is due to a change of defaults in GCC, from -fcommon to -fno-common, cf. the following from http://gcc.gnu.org/gcc-10/porting_to.html :
A common mistake in C is omitting extern when declaring a global variable in a header file. If the header is included by several files it results in multiple definitions of the same variable. In previous GCC versions this error is ignored. GCC 10 defaults to -fno-common, which means a linker error will now be reported. To fix this, use extern in header files when declaring global variables, and ensure each global is defined in exactly one C file. As a workaround, legacy C code can be compiled with -fcommon.
The failure left is
gmake[1]: Entering directory '/home/gerald/wine/dlls/schedsvc/tests' ../../../tools/winegcc/winegcc -o schedsvc_test-stripped.exe.so --wine-objdir ../../.. -fno-PIC -fasynchronous-unwind-tables \ -s -Wb,-F,schedsvc_test.exe -mno-cygwin atsvcapi.o rpcapi.o atsvc_c.o schrpc_c.o testlist.o \ -lrpcrt4 -lole32 -L/home/gerald/11-i386/lib schrpc_c.o:(.bss+0x0): multiple definition of `rpc_handle' atsvc_c.o:(.bss+0x0): first defined here winebuild: /home/gerald/11-i386/bin/ld failed with status 1 winegcc: ../../../tools/winebuild/winebuild failed gmake[1]: *** [Makefile:367: schedsvc_test-stripped.exe.so] Error 2 gmake[1]: Leaving directory '/home/gerald/wine/dlls/schedsvc/tests' gmake: *** [Makefile:8961: dlls/schedsvc/tests] Error 2
atsvc_c.c and schrpc_c.c are auto-generated from atsvc.idl and schrpc.idl, so I'm not sure how to tackle this.
Anyone who can help and take this?
Thank you, Gerald
On Fri, Feb 14, 2020 at 10:44 AM Gerald Pfeifer gerald@pfeifer.com wrote:
Even after patches by Michael Cronenworth and me, cf. https://www.winehq.org/pipermail/wine-devel/2020-January/157945.html https://www.winehq.org/pipermail/wine-devel/2020-January/158454.html Wine still fails to build with GCC 10 development snapshots.
This is due to a change of defaults in GCC, from -fcommon to -fno-common, cf. the following from http://gcc.gnu.org/gcc-10/porting_to.html :
A common mistake in C is omitting extern when declaring a global variable in a header file. If the header is included by several files it results in multiple definitions of the same variable. In previous GCC versions this error is ignored. GCC 10 defaults to -fno-common, which means a linker error will now be reported. To fix this, use extern in header files when declaring global variables, and ensure each global is defined in exactly one C file. As a workaround, legacy C code can be compiled with -fcommon.
The failure left is
gmake[1]: Entering directory '/home/gerald/wine/dlls/schedsvc/tests' ../../../tools/winegcc/winegcc -o schedsvc_test-stripped.exe.so --wine-objdir ../../.. -fno-PIC -fasynchronous-unwind-tables \ -s -Wb,-F,schedsvc_test.exe -mno-cygwin atsvcapi.o rpcapi.o atsvc_c.o schrpc_c.o testlist.o \ -lrpcrt4 -lole32 -L/home/gerald/11-i386/lib schrpc_c.o:(.bss+0x0): multiple definition of `rpc_handle' atsvc_c.o:(.bss+0x0): first defined here winebuild: /home/gerald/11-i386/bin/ld failed with status 1 winegcc: ../../../tools/winebuild/winebuild failed gmake[1]: *** [Makefile:367: schedsvc_test-stripped.exe.so] Error 2 gmake[1]: Leaving directory '/home/gerald/wine/dlls/schedsvc/tests' gmake: *** [Makefile:8961: dlls/schedsvc/tests] Error 2
You can probably try to use different names for variables defined with implicit_handle() attribute.
atsvc_c.c and schrpc_c.c are auto-generated from atsvc.idl and schrpc.idl, so I'm not sure how to tackle this.
Anyone who can help and take this?
Thank you, Gerald
On Fri, 14 Feb 2020, Nikolay Sivov wrote:
schrpc_c.o:(.bss+0x0): multiple definition of `rpc_handle' atsvc_c.o:(.bss+0x0): first defined here gmake: *** [Makefile:8961: dlls/schedsvc/tests] Error 2
You can probably try to use different names for variables defined with implicit_handle() attribute.
rpc_handle comes from both include/wine/atsvc.idl included by dlls/schedsvc/tests/atsvc.idl and include/wine/schrpc.idl included by dlls/schedsvc/tests/schrpc.idl.
I'm not sure what global effects (and API/ABI changes) renaming one of those occurrences will have and already had a look for an hour. Better something for one of the experts?
Gerald
On Fri, 14 Feb 2020, Nikolay Sivov wrote:
On Fri, Feb 14, 2020 at 10:44 AM Gerald Pfeifer gerald@pfeifer.com wrote: The failure left is
gmake[1]: Entering directory '/home/gerald/wine/dlls/schedsvc/tests' ../../../tools/winegcc/winegcc -o schedsvc_test-stripped.exe.so --wine-objdir ../../.. -fno-PIC -fasynchronous-unwind-tables \ -s -Wb,-F,schedsvc_test.exe -mno-cygwin atsvcapi.o rpcapi.o atsvc_c.o schrpc_c.o testlist.o \ -lrpcrt4 -lole32 -L/home/gerald/11-i386/lib schrpc_c.o:(.bss+0x0): multiple definition of `rpc_handle' atsvc_c.o:(.bss+0x0): first defined here winebuild: /home/gerald/11-i386/bin/ld failed with status 1 winegcc: ../../../tools/winebuild/winebuild failed gmake[1]: *** [Makefile:367: schedsvc_test-stripped.exe.so] Error 2 gmake[1]: Leaving directory '/home/gerald/wine/dlls/schedsvc/tests' gmake: *** [Makefile:8961: dlls/schedsvc/tests] Error 2
You can probably try to use different names for variables defined with implicit_handle() attribute.
FWIW, I just ran into the same as well (with a Clang 11 build).
It works (at least building, haven't tried running tests) if renaming e.g. the one in include/wine/atsvc.idl - but one can't rename both that one and the one in include/wine/schrpc.idl, as there's other source files that expect to access it e.g. like this:
dlls/schedsvc/tests/rpcapi.c:extern handle_t rpc_handle; dlls/schedsvc/tests/rpcapi.c: hr = RpcBindingFromStringBindingA(binding_str, &rpc_handle); dlls/schedsvc/tests/rpcapi.c: hr = RpcBindingFree(&rpc_handle);
// Martin
On Fri, 14 Feb 2020, Nikolay Sivov wrote: FWIW, I just ran into the same as well (with a Clang 11 build).
It works (at least building, haven't tried running tests) if renaming e.g. the one in include/wine/atsvc.idl - but one can't rename both that one and the one in include/wine/schrpc.idl, as there's other source files that expect to access it e.g. like this:
dlls/schedsvc/tests/rpcapi.c:extern handle_t rpc_handle; dlls/schedsvc/tests/rpcapi.c: hr = RpcBindingFromStringBindingA(binding_str, &rpc_handle); dlls/schedsvc/tests/rpcapi.c: hr = RpcBindingFree(&rpc_handle);
It would be great could you give it a try and submit a patch. Both current/future versions of clang and GCC being unable to build Wine without uncommon options (no pun intended) is unfortunate.
Thanks, Gerald