Issue
To come somewhat close to the experience Parallels Desktop for Mac offers, I would like to run a Windows 10 virtual machine with the QXL graphics driver and SPICE support on a macOS host machine. Unfortunately neither the QEMU binary on Homebrew nor on MacPorts offers SPICE support.
QEMU needs the spice-protocol and spice-server library to compile with SPICE support. While the spice-protocol package is available for macOS, I can't seem to find a precompiled package of spice-server. As I tried to compile spice-0.14.2 under macOS I encountered the following error:
/Library/Developer/CommandLineTools/usr/bin/make all-recursiveMaking all in .
CC red-stream.lo
CC red-worker.lo
red-worker.c:1164:40: error: too many arguments to function call, expected 1, have 2
pthread_setname_np(worker->thread, "SPICE Worker");
~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:512:1: note: 'pthread_setname_np' declared here
__API_AVAILABLE(macos(10.6), ios(3.2))
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/Availability.h:496:162: note: expanded from macro '__API_AVAILABLE'
...__API_AVAILABLE6, __API_AVAILABLE5, __API_AVAILABLE4, __API_AVAILABLE3, __API_AVAILABLE2, __API_AVAILABLE1, 0)(__VA_ARGS__)
^
1 error generated.
Solution
After doing some research, it appears that on macOS pthread_setname_np
can only be used to change the name of the calling thread.
From what I can tell this is only needed for debug purposes, and you can safely comment out the line when compiling for macOS. (You can also use conditional compilation, but there's no reason to if you're just trying to compile QEMU with SPICE support.)
Edit server/red-worker.c
and comment out the following line:
pthread_setname_np(worker->thread, "SPICE Worker");
(I used nano. You can use CTRL + W to search for pthread_setname_np(
.)
Additional changes required to compile SPICE server for macOS (as of 0.14.3)
If you get the following error when running
./autogen.sh
:configure: error: Package requirements (openssl >= 1.0.0) were not met: No package 'openssl' found
Then set the following environment variables:
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig" export LDFLAGS="-L/usr/local/opt/[email protected]/lib" export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
Add the following line somewhere near the top of
server/red-stream.c
andserver/tests/test-websocket.c
:#define MSG_NOSIGNAL 0x2000 /* don't raise SIGPIPE */
In
server/tools/reds_stat.c
replace the following line:reds_stat = mremap(reds_stat, shm_old_size, shm_size, MREMAP_MAYMOVE);
with:
munmap(reds_stat, shm_old_size); reds_stat = mmap(0, shm_old_size, PROT_READ | PROT_WRITE, MAP_SHARED, -1, 0);
If I didn't forget anything, all other errors can be "solved" by removing all occurrences of
-Werror
from theMakefile
s.
Answered By - Benjy Wiener
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.