Building 32 bit wine with clang: checkinstall errors and workaround

Questions about Wine on Linux
Post Reply
andrew.smart
Level 2
Level 2
Posts: 25
Joined: Thu Dec 15, 2016 3:08 am

Building 32 bit wine with clang: checkinstall errors and workaround

Post by andrew.smart » Mon Apr 26, 2021 10:48 am

So, I'm making 32-bit wine in a schroot. Then using checkinstall to get a .deb I can install in the 64-bit system. `make` succeeds, but `make install` seems to fail. `make install` is wrapped in checkinstall, which makes a .deb.

I'm getting a couple errors when running checkinstall:

Code: Select all

$ mkdir wine32-tools
$ cd wine32-tools
$ export CCACHE_CPP2=1
$ export CCACHE_DIR=/tmp/ccache
$ mkdir -p $CCACHE_DIR
$ export CC="ccache clang-8 -Qunused-arguments -fcolor-diagnostics"
$ export CXX="ccache clang++-8 -Qunused-arguments -fcolor-diagnostics"
$ export CFLAGS="-std=gnu89 -Og"
$ ../configure --prefix=/opt/wine-git
$ time make -j5
$ checkinstall --strip=no --stripso=no --pkgversion=6.7.0 --pkgarch=i386
[...removed output for brevity...]
tools/winebuild/winebuild -w --def -o dlls/mprapi/libmprapi.def --export ../dlls/mprapi/mprapi.spec
../tools/install-sh -m 644  dlls/mprapi/libmprapi.def /opt/wine-git/lib/wine/libmprapi.def
../tools/install-sh -m 644  dlls/msacm32/libmsacm32.def /opt/wine-git/lib/wine/libmsacm32.def
../tools/install-sh -m 644  dlls/msasn1/libmsasn1.def /opt/wine-git/lib/wine/libmsasn1.def
tools/winebuild/winebuild -w --def -o dlls/mscms/libmscms.def --export ../dlls/mscms/mscms.spec
../tools/install-sh -m 644  dlls/mscms/libmscms.def /opt/wine-git/lib/wine/libmscms.def
../tools/install-sh -m 644  dlls/msdmo/libmsdmo.def /opt/wine-git/lib/wine/libmsdmo.def
../tools/install-sh -m 644  dlls/mshtml/libmshtml.def /opt/wine-git/lib/wine/libmshtml.def
../tools/install-sh -m 644  dlls/msi/libmsi.def /opt/wine-git/lib/wine/libmsi.def
../tools/install-sh -m 644  dlls/msimg32/libmsimg32.def /opt/wine-git/lib/wine/libmsimg32.def
../tools/install-sh -m 644  dlls/mspatcha/libmspatcha.def /opt/wine-git/lib/wine/libmspatcha.def
../tools/install-sh -m 644  dlls/msvcr100/libmsvcr100.a /opt/wine-git/lib/wine/libmsvcr100.a
../tools/install-sh -m 644  dlls/msvcr110/libmsvcr110.a /opt/wine-git/lib/wine/libmsvcr110.a
../tools/install-sh -m 644  dlls/msvcr120/libmsvcr120.a /opt/wine-git/lib/wine/libmsvcr120.a
../tools/install-sh -m 644  dlls/msvcr70/libmsvcr70.a /opt/wine-git/lib/wine/libmsvcr70.a
../tools/install-sh -m 644  dlls/msvcr71/libmsvcr71.a /opt/wine-git/lib/wine/libmsvcr71.a
../tools/install-sh -m 644  dlls/msvcr80/libmsvcr80.a /opt/wine-git/lib/wine/libmsvcr80.a
../tools/install-sh -m 644  dlls/msvcr90/libmsvcr90.a /opt/wine-git/lib/wine/libmsvcr90.a
../tools/install-sh -m 644  dlls/msvcrt/libmsvcrt.a /opt/wine-git/lib/wine/libmsvcrt.a
ccache clang-8 -Qunused-arguments -fcolor-diagnostics -c -o dlls/msvcrtd/iob.o ../dlls/msvcrt/iob.c -Idlls/msvcrtd -I../dlls/msvcrtd -I../dlls/msvcrt -Iinclude \
  -I../include -I../include/msvcrt -D__WINESRC__ -D_CRTIMP= -D_MSVCR_VER=0 -D_REENTRANT -fno-PIC \
  -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -Wall -pipe -fcf-protection=none \
  -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body \
  -Wignored-qualifiers -Winit-self -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla \
  -Wwrite-strings -Wpointer-arith -fno-omit-frame-pointer -std=gnu89 -Og
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Stack dump:
0.      Program arguments: /usr/bin/clang-8 -Qunused-arguments -fcolor-diagnostics -c -o dlls/msvcrtd/iob.o ../dlls/msvcrt/iob.c -Idlls/msvcrtd -I../dlls/msvcrtd -I../dlls/msvcrt -Iinclude -I../include -I../include/msvcrt -D__WINESRC__ -D_CRTIMP= -D_MSVCR_VER=0 -D_REENTRANT -fno-PIC -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -Wall -pipe -fcf-protection=none -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Winit-self -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla -Wwrite-strings -Wpointer-arith -fno-omit-frame-pointer -std=gnu89 -Og 
free(): invalid pointer
make: *** [Makefile:98603: dlls/msvcrtd/iob.o] Aborted

****  Installation failed. Aborting package creation.

Cleaning up...rm: cannot remove '/var/tmp/tmp.UZGfyHTEC6/BACKUP/proc/self/exe': Permission denied
OK

Bye.

$
The cleanup of '/var/tmp/tmp.UZGfyHTEC6/BACKUP/proc/self/exe is just because write permissions are missing (I think a bug in checkinstall), and it is not the problem I'm writing this post about:

Code: Select all

$ ls -l /var/tmp/tmp.UZGfyHTEC6/BACKUP/proc/
dr-xr-xr-x 2 browser browser 60 Apr 26 09:28 self
But, if I manually run the command that failed, it succeeds, and I'm able to re-run checkinstall and it doesn't get an error in the same place and it goes further:

Code: Select all

$ ccache clang-8 -Qunused-arguments -fcolor-diagnostics -c -o dlls/msvcrtd/iob.o ../dlls/msvcrt/iob.c -Idlls/msvcrtd -I../dlls/msvcrtd -I../dlls/msvcrt -Iinclude \
  -I../include -I../include/msvcrt -D__WINESRC__ -D_CRTIMP= -D_MSVCR_VER=0 -D_REENTRANT -fno-PIC \
  -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -Wall -pipe -fcf-protection=none \
  -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body \
  -Wignored-qualifiers -Winit-self -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla \
  -Wwrite-strings -Wpointer-arith -fno-omit-frame-pointer -std=gnu89 -Og
$ echo $?
0
$ checkinstall --strip=no --stripso=no --pkgversion=6.7.0 --pkgarch=i386
[...removed output for brevity...]
../tools/install-sh -m 644  dlls/mpr/libmpr.def /opt/wine-git/lib/wine/libmpr.def
../tools/install-sh -m 644  dlls/mprapi/libmprapi.def /opt/wine-git/lib/wine/libmprapi.def
../tools/install-sh -m 644  dlls/msacm32/libmsacm32.def /opt/wine-git/lib/wine/libmsacm32.def
../tools/install-sh -m 644  dlls/msasn1/libmsasn1.def /opt/wine-git/lib/wine/libmsasn1.def
../tools/install-sh -m 644  dlls/mscms/libmscms.def /opt/wine-git/lib/wine/libmscms.def
../tools/install-sh -m 644  dlls/msdmo/libmsdmo.def /opt/wine-git/lib/wine/libmsdmo.def
../tools/install-sh -m 644  dlls/mshtml/libmshtml.def /opt/wine-git/lib/wine/libmshtml.def
../tools/install-sh -m 644  dlls/msi/libmsi.def /opt/wine-git/lib/wine/libmsi.def
../tools/install-sh -m 644  dlls/msimg32/libmsimg32.def /opt/wine-git/lib/wine/libmsimg32.def
../tools/install-sh -m 644  dlls/mspatcha/libmspatcha.def /opt/wine-git/lib/wine/libmspatcha.def
../tools/install-sh -m 644  dlls/msvcr100/libmsvcr100.a /opt/wine-git/lib/wine/libmsvcr100.a
../tools/install-sh -m 644  dlls/msvcr110/libmsvcr110.a /opt/wine-git/lib/wine/libmsvcr110.a
../tools/install-sh -m 644  dlls/msvcr120/libmsvcr120.a /opt/wine-git/lib/wine/libmsvcr120.a
../tools/install-sh -m 644  dlls/msvcr70/libmsvcr70.a /opt/wine-git/lib/wine/libmsvcr70.a
../tools/install-sh -m 644  dlls/msvcr71/libmsvcr71.a /opt/wine-git/lib/wine/libmsvcr71.a
../tools/install-sh -m 644  dlls/msvcr80/libmsvcr80.a /opt/wine-git/lib/wine/libmsvcr80.a
../tools/install-sh -m 644  dlls/msvcr90/libmsvcr90.a /opt/wine-git/lib/wine/libmsvcr90.a
../tools/install-sh -m 644  dlls/msvcrt/libmsvcrt.a /opt/wine-git/lib/wine/libmsvcrt.a
ccache clang-8 -Qunused-arguments -fcolor-diagnostics -c -o dlls/msvcrtd/onexit.o ../dlls/msvcrt/onexit.c -Idlls/msvcrtd -I../dlls/msvcrtd -I../dlls/msvcrt -Iinclude \
  -I../include -I../include/msvcrt -D__WINESRC__ -D_CRTIMP= -D_MSVCR_VER=0 -D_REENTRANT -fno-PIC \
  -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -Wall -pipe -fcf-protection=none \
  -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body \
  -Wignored-qualifiers -Winit-self -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla \
  -Wwrite-strings -Wpointer-arith -fno-omit-frame-pointer -std=gnu89 -Og
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Stack dump:
0.      Program arguments: /usr/bin/clang-8 -Qunused-arguments -fcolor-diagnostics -c -o dlls/msvcrtd/onexit.o ../dlls/msvcrt/onexit.c -Idlls/msvcrtd -I../dlls/msvcrtd -I../dlls/msvcrt -Iinclude -I../include -I../include/msvcrt -D__WINESRC__ -D_CRTIMP= -D_MSVCR_VER=0 -D_REENTRANT -fno-PIC -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -Wall -pipe -fcf-protection=none -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body -Wignored-qualifiers -Winit-self -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla -Wwrite-strings -Wpointer-arith -fno-omit-frame-pointer -std=gnu89 -Og 
free(): invalid pointer
make: *** [Makefile:98760: dlls/msvcrtd/onexit.o] Aborted

****  Installation failed. Aborting package creation.

Cleaning up...rm: cannot remove '/var/tmp/tmp.j4YrtJPJzM/BACKUP/proc/self/exe': Permission denied
OK

Bye.

$
Both are errors in the dlls/msvcrt/libmsvcrt.a target:

Code: Select all

../tools/install-sh -m 644  dlls/msvcrt/libmsvcrt.a /opt/wine-git/lib/wine/libmsvcrt.a
Again I run the command that failed, and re-run checkinstall, and checkinstall succeeds all the way to the end with no more errors!:

Code: Select all

$ ccache clang-8 -Qunused-arguments -fcolor-diagnostics -c -o dlls/msvcrtd/onexit.o ../dlls/msvcrt/onexit.c -Idlls/msvcrtd -I../dlls/msvcrtd -I../dlls/msvcrt -Iinclude \
  -I../include -I../include/msvcrt -D__WINESRC__ -D_CRTIMP= -D_MSVCR_VER=0 -D_REENTRANT -fno-PIC \
  -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -Wall -pipe -fcf-protection=none \
  -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body \
  -Wignored-qualifiers -Winit-self -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla \
  -Wwrite-strings -Wpointer-arith -fno-omit-frame-pointer -std=gnu89 -Og
$ checkinstall --strip=no --stripso=no --pkgversion=6.7.0 --pkgarch=i386
[...removed output for brevity...]
======================== Installation successful ==========================

Copying files to the temporary directory...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

NOTE: The package will not be installed

Erasing temporary files...OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been saved to

 /tmp/dev/wine/wine32-tools/wine32_6.7.0-1_i386.deb
 You can install it in your system anytime using: 

      dpkg -i wine32_6.7.0-1_i386.deb

**********************************************************************
The .deb works great, I'm a happy camper. But I'd thought I'd let you know about this quirk and workaround of having to run checkinstall 3 times.

I've tried not using ccache, with no change. I don't know if it is a bug in the `make install` script, something to do with clang, or checkinstall. I have no idea. configure and make both work, but not `make install` wrapped in `checkinstall`. The same behaviour exists as I've built WINE 6.5, 6.6, and 6.7 from git.

Post Reply