Closed DoktorCranium closed 4 years ago
Make sure that the top level git commit, qemu and wine modules are up to date and remove the build directory to start with a fresh build. I recently updated the Wine version 'embedded' in hangover (or rather, git submodule linked) and due to changes in Wine qemu now needs to be linked to libwine.so. The top level makefile should take care of that and qemu has some changes to define __wine_main_argc/argv.
I have pulled the fresh source yesterday and let it build over night .. all updated accordingly to your instructions
$ git submodule init
$ git submodule update
Looking at the hangover Makefile qemu section I see that winegcc is used and lwine libraries are defined
# Build qemu
build/qemu/Makefile: build/wine-host/.built qemu/configure
@mkdir -p $(@D)
cd build/qemu ; CC="$(WINE_HOST)/tools/winegcc/winegcc --winebuild $(WINE_HOST)/tools/winebuild/winebuild -I$(WINE_HOST)/include -I$(WINE_SRC)/include --wine-objdir $(WINE_HOST) -lpthread -lwine -DWINE_NOWINSOCK -U_WIN32 -UWIN64 -UWIN32 -DNOGDI" CXX="$(WINE_HOST)/tools/winegcc/wineg++ --winebuild $(WINE_HOST)/tools/winebuild/winebuild -I$(WINE_HOST)/include -I$(WINE_SRC)/include --wine-objdir $(WINE_HOST) -lpthread -lwine -DWINE_NOWINSOCK -U_WIN32 -UWIN64 -UWIN32 -DNOGDI" ../../qemu/configure --python=/usr/bin/python2.7 --enable-windows-user $(QEMU_DISABLES); cd ../.. ; touch $@
Do I need to install first the libwine.so from the tools directory and call ldconfig on the system for the linker to know where to look for libwine.so ?
user@nanojet:~/SRC/hangover/build/wine-host$ find . | grep libwine.so
./libs/wine/libwine.so
./libs/wine/libwine.so.1.0
./libs/wine/libwine.so.1
No, the Wine in hangover does not get installed on your system, and winegcc should pick up libwine from inside build/wine-host/libs/wine. Can you run make V=1 inside build/qemu to see the exact command line? Maybe try to modify it to manually add -L/path/to/hangover/build/wine-host/libs/wine and see if it picks things up.
``make[1]: Entering directory '/home/user/SRC/hangover/build/qemu'
(printf '#define QEMU_PKGVERSION "-dirty"\n'; printf '#define QEMU_FULL_VERSION "4.1.91 (-dirty)"\n'; ) > qemu-version.h.tmp
if ! cmp -s qemu-version.h qemu-version.h.tmp; then mv qemu-version.h.tmp qemu-version.h; else rm qemu-version.h.tmp; fi
make -C /home/user/SRC/hangover/qemu/slirp BUILD_DIR="/home/user/SRC/hangover/build/qemu/slirp" PKG_CONFIG="pkg-config" CC="/home/user/SRC/hangover/build/wine-host/tools/winegcc/winegcc --winebuild /home/user/SRC/hangover/build/wine-host/tools/winebuild/winebuild -I/home/user/SRC/hangover/build/wine-host/include -I/home/user/SRC/hangover/wine/include --wine-objdir /home/user/SRC/hangover/build/wine-host -lpthread -lwine -DWINE_NOWINSOCK -U_WIN32 -UWIN64 -UWIN32 -DNOGDI" AR="ar" LD="ld" RANLIB="ranlib" CFLAGS="-pthread -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/home/user/SRC/hangover/qemu/tests -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g " LDFLAGS="-Wl,--warn-common -g "
make[2]: Entering directory '/home/user/SRC/hangover/qemu/slirp'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/user/SRC/hangover/qemu/slirp'
make BUILD_DIR=/home/user/SRC/hangover/build/qemu -C x86_64-windows-user/ V="1" TARGET_DIR="x86_64-windows-user/" all
make[2]: Entering directory '/home/user/SRC/hangover/build/qemu/x86_64-windows-user'
/home/user/SRC/hangover/build/wine-host/tools/winegcc/wineg++ --winebuild /home/user/SRC/hangover/build/wine-host/tools/winebuild/winebuild -I/home/user/SRC/hangover/build/wine-host/include -I/home/user/SRC/hangover/wine/include --wine-objdir /home/user/SRC/hangover/build/wine-host -lpthread -lwine -DWINE_NOWINSOCK -U_WIN32 -UWIN64 -UWIN32 -DNOGDI -pthread -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I../linux-headers -iquote .. -iquote /home/user/SRC/hangover/qemu/target/i386 -DNEED_CPU_H -iquote /home/user/SRC/hangover/qemu/include -I/home/user/SRC/hangover/qemu/windows-user/x86_64 -I/home/user/SRC/hangover/qemu/windows-user/host/aarch64 -I/home/user/SRC/hangover/qemu/windows-user -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -Wl,--warn-common -g -o qemu-x86_64 exec.o exec-vary.o tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o tcg/tcg-common.o tcg/optimize.o fpu/softfloat.o disas.o gdbstub-xml.o gdbstub.o thunk.o accel/stubs/hax-stub.o accel/stubs/hvf-stub.o accel/stubs/whpx-stub.o accel/stubs/kvm-stub.o accel/tcg/tcg-runtime.o accel/tcg/tcg-runtime-gvec.o accel/tcg/cpu-exec.o accel/tcg/cpu-exec-common.o accel/tcg/translate-all.o accel/tcg/translator.o accel/tcg/user-exec.o accel/tcg/user-exec-stub.o target/i386/helper.o target/i386/cpu.o target/i386/gdbstub.o target/i386/xsave_helper.o target/i386/translate.o target/i386/bpt_helper.o target/i386/cc_helper.o target/i386/excp_helper.o target/i386/fpu_helper.o target/i386/int_helper.o target/i386/mem_helper.o target/i386/misc_helper.o target/i386/mpx_helper.o target/i386/seg_helper.o target/i386/smm_helper.o target/i386/svm_helper.o target/i386/kvm-stub.o target/i386/sev-stub.o trace/generated-helpers.o trace/control-target.o windows-user/main.o windows-user/mmap.o windows-user/pe.o windows-user/win_syscall.o windows-user/signal.o ../cpus-common.o ../disas/arm-a64.o ../disas/i386.o ../disas/libvixl/vixl/utils.o ../disas/libvixl/vixl/compiler-intrinsics.o ../disas/libvixl/vixl/a64/instructions-a64.o ../disas/libvixl/vixl/a64/decoder-a64.o ../disas/libvixl/vixl/a64/disasm-a64.o ../hw/core/qdev.o ../hw/core/qdev-properties.o ../hw/core/bus.o ../hw/core/reset.o ../hw/core/irq.o ../hw/core/hotplug.o ../hw/core/cpu.o ../qom/object.o ../qom/container.o ../qom/qom-qobject.o ../qom/object_interfaces.o ../crypto/aes.o ../crypto/random-platform.o ../crypto/init.o ../libqemuutil.a -lpthread -lz -lgthread-2.0 -pthread -lglib-2.0 -lrt
/usr/bin/ld: windows-user/main.o: in function `main':
/home/user/SRC/hangover/qemu/windows-user/main.c:1291: undefined reference to `__wine_main_argv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1292: undefined reference to `__wine_main_wargv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1290: undefined reference to `__wine_main_argc'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1291: undefined reference to `__wine_main_argv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1292: undefined reference to `__wine_main_wargv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1290: undefined reference to `__wine_main_argc'
collect2: error: ld returned 1 exit status
winegcc: /usr/bin/g++ failed
make[2]: *** [Makefile:222: qemu-x86_64] Error 2
make[2]: Leaving directory '/home/user/SRC/hangover/build/qemu/x86_64-windows-user'
make[1]: *** [Makefile:491: x86_64-windows-user/all] Error 2
make[1]: Leaving directory '/home/user/SRC/hangover/build/qemu'
make: *** [Makefile:121: build/qemu/x86_64-windows-user/qemu-x86_64.exe.so] Error 2
Looks like the libdir does not get picked up
And yes the __wine* functions are present in libwine.so
user@nanojet:~/SRC/hangover/build/wine-host/libs/wine$ nm libwine.so | grep __wine
0000000000006b88 t __wine_dbg_get_channel_flags_obsolete
0000000000006b88 T __wine_dbg_get_channel_flags@WINE_1.0
0000000000006c80 t __wine_dbg_set_channel_flags_obsolete
0000000000006c80 T __wine_dbg_set_channel_flags@WINE_1.0
0000000000007040 t __wine_dbg_set_functions_obsolete
0000000000007040 T __wine_dbg_set_functions@WINE_1.0
0000000000007a90 T __wine_dll_register
0000000000007a80 t __wine_get_main_environment
0000000000183a38 B __wine_main_argc
0000000000183a30 B __wine_main_argv
0000000000183a20 B __wine_main_environ
0000000000183a28 B __wine_main_wargv
user@nanojet:~/SRC/hangover/build/wine-host/libs/wine$
No, adding the -L/home/user/SRC/hangover/build/wine-host/libs/wine does not seem to help, still getting the undefined reference errors
This is what I have used
``user@nanojet:~/SRC/hangover/build/qemu/x86_64-windows-user$ /home/user/SRC/hangover/build/wine-host/tools/winegcc/wineg++ --winebuild /home/user/SRC/hangover/build/wine-host/tools/winebuild/winebuild -I/home/user/SRC/hangover/build/wine-host/include -I/home/user/SRC/hangover/wine/include --wine-objdir /home/user/SRC/hangover/build/wine-host -L/home/user/SRC/hangover/build/wine-host/libs/wine -lpthread -L/home/user/SRC/hangover/build/wine-host/libs/wine -lwine -DWINE_NOWINSOCK -U_WIN32 -UWIN64 -UWIN32 -DNOGDI -pthread -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I../linux-headers -iquote .. -iquote /home/user/SRC/hangover/qemu/target/i386 -DNEED_CPU_H -iquote /home/user/SRC/hangover/qemu/include -I/home/user/SRC/hangover/qemu/windows-user/x86_64 -I/home/user/SRC/hangover/qemu/windows-user/host/aarch64 -I/home/user/SRC/hangover/qemu/windows-user -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -Wl,--warn-common -g -o qemu-x86_64 exec.o exec-vary.o tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o tcg/tcg-common.o tcg/optimize.o fpu/softfloat.o disas.o gdbstub-xml.o gdbstub.o thunk.o accel/stubs/hax-stub.o accel/stubs/hvf-stub.o accel/stubs/whpx-stub.o accel/stubs/kvm-stub.o accel/tcg/tcg-runtime.o accel/tcg/tcg-runtime-gvec.o accel/tcg/cpu-exec.o accel/tcg/cpu-exec-common.o accel/tcg/translate-all.o accel/tcg/translator.o accel/tcg/user-exec.o accel/tcg/user-exec-stub.o target/i386/helper.o target/i386/cpu.o target/i386/gdbstub.o target/i386/xsave_helper.o target/i386/translate.o target/i386/bpt_helper.o target/i386/cc_helper.o target/i386/excp_helper.o target/i386/fpu_helper.o target/i386/int_helper.o target/i386/mem_helper.o target/i386/misc_helper.o target/i386/mpx_helper.o target/i386/seg_helper.o target/i386/smm_helper.o target/i386/svm_helper.o target/i386/kvm-stub.o target/i386/sev-stub.o trace/generated-helpers.o trace/control-target.o windows-user/main.o windows-user/mmap.o windows-user/pe.o windows-user/win_syscall.o windows-user/signal.o ../cpus-common.o ../disas/arm-a64.o ../disas/i386.o ../disas/libvixl/vixl/utils.o ../disas/libvixl/vixl/compiler-intrinsics.o ../disas/libvixl/vixl/a64/instructions-a64.o ../disas/libvixl/vixl/a64/decoder-a64.o ../disas/libvixl/vixl/a64/disasm-a64.o ../hw/core/qdev.o ../hw/core/qdev-properties.o ../hw/core/bus.o ../hw/core/reset.o ../hw/core/irq.o ../hw/core/hotplug.o ../hw/core/cpu.o ../qom/object.o ../qom/container.o ../qom/qom-qobject.o ../qom/object_interfaces.o ../crypto/aes.o ../crypto/random-platform.o ../crypto/init.o ../libqemuutil.a -lpthread -lz -lgthread-2.0 -pthread -lglib-2.0 -lrt
/usr/bin/ld: windows-user/main.o: in function `main':
/home/user/SRC/hangover/qemu/windows-user/main.c:1291: undefined reference to `__wine_main_argv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1292: undefined reference to `__wine_main_wargv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1290: undefined reference to `__wine_main_argc'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1291: undefined reference to `__wine_main_argv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1292: undefined reference to `__wine_main_wargv'
/usr/bin/ld: /home/user/SRC/hangover/qemu/windows-user/main.c:1290: undefined reference to `__wine_main_argc'
collect2: error: ld returned 1 exit status
winegcc: /usr/bin/g++ failed
But by adding lwine to the end it compiled
user@nanojet:~/SRC/hangover/build/qemu/x86_64-windows-user$
/home/user/SRC/hangover/build/wine-host/tools/winegcc/wineg++ --winebuild /home/user/SRC/hangover/build/wine-host/tools/winebuild/winebuild -I/home/user/SRC/hangover/build/wine-host/include -I/home/user/SRC/hangover/wine/include --wine-objdir /home/user/SRC/hangover/build/wine-host -L/home/user/SRC/hangover/build/wine-host/libs/wine -lpthread -L/home/user/SRC/hangover/build/wine-host/libs/wine -lwine -DWINE_NOWINSOCK -U_WIN32 -UWIN64 -UWIN32 -DNOGDI -pthread -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -std=gnu99 -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I../linux-headers -iquote .. -iquote /home/user/SRC/hangover/qemu/target/i386 -DNEED_CPU_H -iquote /home/user/SRC/hangover/qemu/include -I/home/user/SRC/hangover/qemu/windows-user/x86_64 -I/home/user/SRC/hangover/qemu/windows-user/host/aarch64 -I/home/user/SRC/hangover/qemu/windows-user -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g -Wl,--warn-common -g -o qemu-x86_64 exec.o exec-vary.o tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o tcg/tcg-common.o tcg/optimize.o fpu/softfloat.o disas.o gdbstub-xml.o gdbstub.o thunk.o accel/stubs/hax-stub.o accel/stubs/hvf-stub.o accel/stubs/whpx-stub.o accel/stubs/kvm-stub.o accel/tcg/tcg-runtime.o accel/tcg/tcg-runtime-gvec.o accel/tcg/cpu-exec.o accel/tcg/cpu-exec-common.o accel/tcg/translate-all.o accel/tcg/translator.o accel/tcg/user-exec.o accel/tcg/user-exec-stub.o target/i386/helper.o target/i386/cpu.o target/i386/gdbstub.o target/i386/xsave_helper.o target/i386/translate.o target/i386/bpt_helper.o target/i386/cc_helper.o target/i386/excp_helper.o target/i386/fpu_helper.o target/i386/int_helper.o target/i386/mem_helper.o target/i386/misc_helper.o target/i386/mpx_helper.o target/i386/seg_helper.o target/i386/smm_helper.o target/i386/svm_helper.o target/i386/kvm-stub.o target/i386/sev-stub.o trace/generated-helpers.o trace/control-target.o windows-user/main.o windows-user/mmap.o windows-user/pe.o windows-user/win_syscall.o windows-user/signal.o ../cpus-common.o ../disas/arm-a64.o ../disas/i386.o ../disas/libvixl/vixl/utils.o ../disas/libvixl/vixl/compiler-intrinsics.o ../disas/libvixl/vixl/a64/instructions-a64.o ../disas/libvixl/vixl/a64/decoder-a64.o ../disas/libvixl/vixl/a64/disasm-a64.o ../hw/core/qdev.o ../hw/core/qdev-properties.o ../hw/core/bus.o ../hw/core/reset.o ../hw/core/irq.o ../hw/core/hotplug.o ../hw/core/cpu.o ../qom/object.o ../qom/container.o ../qom/qom-qobject.o ../qom/object_interfaces.o ../crypto/aes.o ../crypto/random-platform.o ../crypto/init.o ../libqemuutil.a -lpthread -lz -lgthread-2.0 -pthread -lglib-2.0 -lrt -lwine
yay, I have seen the "you have to add libs at the end" behavior in some places, but not related to hangover and I never tracked it down. We'll need some other way than adding it to CC/CXX to add it at the end of qemu's build command.
thanks for your input, I will keep you posted how the build went .. Im really curious how it will perform on the Nvidia Jetson Nano (aarch64)
Don't expect too much, this is just a weekend fun project :-) . If the x86 build of Wine's notepad runs that's already a success.
I am also aware of a pile of problems resulting from the last Wine update that I did not get around to fix yet, so even the open/save dialog is broken at the moment due to a new style of printf functions in ucrtbase.dll...
Yes it does :) just ran the PE32 notepad and it works
user@nanojet:~/SRC/hangover$ file build/wine-guest32/programs/notepad/notepad.exe build/wine-guest32/programs/notepad/notepad.exe: PE32 executable (GUI) Intel 80386, for MS Windows
Thank you for this project :)
After fixing Dockerfile I get the same link error in the docker build. So I'll have to go fix it either way :-)
The linking problem should be fixed by 05aa6f3960bf99f9cf206296030c16e1de63b3d7.
Hello, building current hangover on aarch64 Ubuntu 20.04 (gcc 9.3.0)
Im getting the following linking errors when building qemu after wine builds finish
Is it possible these changes are causing it ? https://github.com/AndreRH/qemu/commit/7fbefaa0ad4f4dd3e0abe8fa761e91a907c5c28a#diff-c3cc0edfb3e3c0661b365e665bdc9aea
This is affecting the hangover/qemu/windows-user/main.c