I plan to make some modifications to the android emulator, but I haven't made any yet. Right now I'm just trying to get it to compile. I've followed the instructions
on two different windows PCs, once with a fresh install of windows, and ran into the same problem both times.
Running under Python 3.9.4, Platform: Windows-10-10.0.19041-SP0
Clearing out C:\Users\Andrew\src\emu-master-dev\external\qemu\objs
Considering Visual Studio Community 2019
Accepted, setting env with "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
variable 'VSINSTALLDIR' is not set, but was required to be available.
variable 'VCTOOLSINSTALLDIR' is not set, but was required to be available.
Traceback (most recent call last):
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\cmake.py", line 20, in <module>
cmake.launch()
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\cmake.py", line 357, in launch
main(args)
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\cmake.py", line 154, in main
configure(args)
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\cmake.py", line 130, in configure
run(cmake_cmd, args.out)
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\process.py", line 105, in run
local_env = get_system_env()
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\process.py", line 81, in get_system_env
raise Exception("Missing required environment variable")
Exception: Missing required environment variable
Obviously, the problem is that vcvars64.bat isn't setting the appropriate env variables, but I'm not sure why it isn't. I've tried using the official Visual Studio installer and selecting all of the tools required in the windows development document, and I've tried using the provided chocolatey script to get all of the dependencies.
One thing I did try was to run the rebuild script in the "Developer Command Prompt for VS 2019" from the start menu, and apparently this provided the required env variables, but then I ran into another problem. Here is the log of rebuild.cmd:
Running under Python 3.9.4, Platform: Windows-10-10.0.19041-SP0
Clearing out C:\Users\Andrew\src\emu-master-dev\external\qemu\objs
Considering Visual Studio Community 2019
Accepted, setting env with "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
Running: cmake.exe -BC:\Users\Andrew\src\emu-master-dev\external\qemu\objs -DCMAKE_TOOLCHAIN_FILE=C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\cmake\toolchain-windows_msvc-x86_64.cmake -DOPTION_CRASHUPLOAD=NONE -DCMAKE_BUILD_TYPE=Release -DQTWEBENGINE=True -DOPTION_SDK_TOOLS_REVISION=30.6.5 -G Ninja C:\Users\Andrew\src\emu-master-dev\external\qemu in C:\Users\Andrew\src\emu-master-dev\external\qemu\objs
-- Configuring native windows build using clang-cl: clang-r416183b
-- Configuring native windows build using clang-cl: clang-r416183b
-- The C compiler identification is Clang 12.0.5 with MSVC-like command-line
-- The CXX compiler identification is Clang 12.0.5 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Users/Andrew/src/emu-master-dev/external/qemu/objs/clang_cl.cmd
-- Check for working C compiler: C:/Users/Andrew/src/emu-master-dev/external/qemu/objs/clang_cl.cmd - broken
CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.19/Modules/CMakeTestCCompiler.cmake:66 (message):
The C compiler
"C:/Users/Andrew/src/emu-master-dev/external/qemu/objs/clang_cl.cmd"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Andrew/src/emu-master-dev/external/qemu/objs/CMakeFiles/CMakeTmp
Run Build Command(s):C:/PROGRA~2/MICROS~2/2019/COMMUN~1/Common7/IDE/COMMON~1/MICROS~1/CMake/Ninja/ninja.exe cmTC_38377 && [1/2] Building C object CMakeFiles\cmTC_38377.dir\testCCompiler.c.obj
[2/2] Linking C executable cmTC_38377.exe
FAILED: cmTC_38377.exe
cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_38377.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x86\mt.exe --manifests -- C:\Users\Andrew\src\emu-master-dev\prebuilts\clang\host\windows-x86\clang-r416183b\bin\lld-link.exe /nologo CMakeFiles\cmTC_38377.dir\testCCompiler.c.obj /out:cmTC_38377.exe /implib:cmTC_38377.lib /pdb:cmTC_38377.pdb /version:0.0 /IGNORE:4099 /DEBUG /NODEFAULTLIB:LIBCMT /MANIFEST:NO /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK: command "C:\Users\Andrew\src\emu-master-dev\prebuilts\clang\host\windows-x86\clang-r416183b\bin\lld-link.exe /nologo CMakeFiles\cmTC_38377.dir\testCCompiler.c.obj /out:cmTC_38377.exe /implib:cmTC_38377.lib /pdb:cmTC_38377.pdb /version:0.0 /IGNORE:4099 /DEBUG /NODEFAULTLIB:LIBCMT /MANIFEST:NO /debug /INCREMENTAL /subsystem:console kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib" failed (exit code 1) with the following output:
lld-link: error: <root>: undefined symbol: mainCRTStartup
ninja: build stopped: subcommand failed.
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
-- Configuring incomplete, errors occurred!
CMakeLists.txt:1 (project)
See also "C:/Users/Andrew/src/emu-master-dev/external/qemu/objs/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Andrew/src/emu-master-dev/external/qemu/objs/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\cmake.py", line 20, in <module>
cmake.launch()
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\cmake.py", line 357, in launch
main(args)
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\cmake.py", line 154, in main
configure(args)
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\cmake.py", line 130, in configure
run(cmake_cmd, args.out)
File "C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\python\aemu\process.py", line 122, in run
raise Exception("Failed to run %s - %s" % (" ".join(cmd), proc.returncode))
Exception: Failed to run cmake.exe -BC:\Users\Andrew\src\emu-master-dev\external\qemu\objs -DCMAKE_TOOLCHAIN_FILE=C:\Users\Andrew\src\emu-master-dev\external\qemu\android\build\cmake\toolchain-windows_msvc-x86_64.cmake -DOPTION_CRASHUPLOAD=NONE -DCMAKE_BUILD_TYPE=Release -DQTWEBENGINE=True -DOPTION_SDK_TOOLS_REVISION=30.6.5 -G Ninja C:\Users\Andrew\src\emu-master-dev\external\qemu - 1
If you can tell me how to compile the emulator it would be much appreciated. Most of my experience is in Java, not C/C++ so apologies if there is an obvious solution to my problem.