Hi all
This is a brief indicator on what parts of wine compile successfully under cygwin and what give errors. Almost all the source code compiles successfully, but lots of things have linking problems. Note that I haven't yet tested the resulting parts that did link successfully.
The significant compilation problem is in server/context_i386.c: You must implement get/set_thread_context for your platform. Basically there's some code that does the threading stuff which is platform-specific. There are Linux and BSD and Sun variants, none of which work under cygwin ... Basically sys/ptrace.h is what's missing. This lets the process interrupt a child process and get/set its registers. Does anyone have any idea what the best way to write a replacement for cygwin would be? Maybe I need to ask the cygwin list.
My plan is to go through each one that doesn't link, look at all the errors, and categorize them (many are the same problem spread accross various dlls), so that we can tackle the more widespread problems first... Any help with this appreciated :-)
David
dlls/ advapi32 has errors avicap32 has errors avifil32 has errors cabinet has errors comcat links comctl32 links commdlg has errors crtdll has errors crypt32 links d3d8 has errors dciman32 links ddraw has errors devenum links dinput links dinput8 links dplay links dplayx links dsound has errors gdi has errors glu32 links icmp links imagehlp links imm32 links kernel has errors lzexpand has errors mapi32 links mpr links msacm has errors msdmo links msimg32 links msisys has errors msnet32 links msvcrt has errors msvcrt20 has errors msvideo has errors netapi32 links ntdll has errors odbc32 links ole32 has errors oleaut32 has errors olecli has errors oledlg links olepro32 links olesvr has errors opengl32 has errors psapi has errors qcap links quartz links rasapi32 links richedit has errors rpcrt4 links serialui links setupapi has errors shdocvw links shell32 has errors shfolder links shlwapi links snmpapi links sti links tapi32 links ttydrv has errors twain has errors url links urlmon has errors user has errors version has errors win32s has errors winaspi has errors winedos has errors wineps has errors wininet has errors winmm has errors winnls has errors winsock has errors winspool has errors wintrust links wow32 links wsock32 links x11drv has errors library/ libwine.dll links successfully miscemu/ requires ntdll.dll ole/ libwine_uuid.a links successfully programs/ avitools/aviinfo.exe links avitools/aviplay.exe links clock/clock.exe links cmdlgtst/cmdlgtst.exe links control/control.exe links expand/expand.exe links osversioncheck/osversioncheck.exe links progman/progman.exe links regapi.exe/regapi.exe links regsvr32/regsvr32.exe links regtest/regtest.exe links uninstaller/uninstaller.exe links view/view.exe links wcmd/wcmd.exe links winefile/winefile.exe links winemine/winemine.exe links winepath/winepath.exe links winhelp/winhelp.exe links winhelp/hlp2sgml.exe links winver/winver.exe links winhelp.exe links server/ context_i386.c has compile error (You must implement get/set_thread_context for your platform) tools/ bin2res.exe links fnt2bdf.exe links makedep.exe links widl/widl.exe links winebuild/winebuild.exe links winedump/winedump.exe links wmc/wmc.exe links wpp/libwpp.a links wrc/wrc.exe links unicode/ libwine_unicode.dll links libwine_unicode.a links
David Fraser wrote:
The significant compilation problem is in server/context_i386.c: You must implement get/set_thread_context for your platform. Basically there's some code that does the threading stuff which is platform-specific. There are Linux and BSD and Sun variants, none of which work under cygwin ... Basically sys/ptrace.h is what's missing. This lets the process interrupt a child process and get/set its registers. Does anyone have any idea what the best way to write a replacement for cygwin would be? Maybe I need to ask the cygwin list.
After some more investigating ... Dimi added a request for ptrace support in cygwin in November 2000: http://cygwin.com//cgi-bin/cygwin-todo.cgi?20001120.094813 But I can't see anything that's been done about it. So I thought I would clarify here exactly what should be done before trying to do it...
The platform-specific bits define the functions get_thread_context and set_thread_context which each use ptrace (in the existing platforms) to get / set registers for that thread. The requests given to ptrace are: PTRACE_PEEKUSER / PTRACE_POKEUSER (for getting / setting debugging registers) PTRACE_GETREGS / PTRACE_SETREGS (for getting / setting general registers) PTRACE_GETFPREGS (for getting / setting floating point registers) so it's fairly simple... As far as I can see the only places get_thread_context and set_thread_context are used is in scheduler/thread.c, to implement WINAPI GetThreadContext and SetThreadContext
Now from reading through the sources Wine uses clone() to create threads, using its own implementation of clone for linux if not available that looks like it wouldn't work with cygwin... Cygwin has a pthreads implementation that maps onto the Windows Thread functions.
So part of the question is, in order to get Wine to function properly on Cygwin, what is the right threading approach to take? Am I right in thinking that the current code wouldn't work on Cygwin?
Approach 1 would be to simply call the Windows Thread functions from Wine if compiled on Cygwin That would involve the nastiness of including the w32api headers...
Approach 2 would be to just use the Windows GetThreadContext/SetThreadContext functions, since they're just looking at registers etc. These could then be wrapped up in an (incomplete) ptrace implementation for cygwin, which we would call.
Approach 3 would be to reimplement the appropriate parts of ptrace for cygwin in some other way.
I'm guessing Approach 2 is right. Anyway any advice would be appreciated
David
On November 28, 2002 09:51 am, David Fraser wrote:
So part of the question is, in order to get Wine to function properly on Cygwin, what is the right threading approach to take? Am I right in thinking that the current code wouldn't work on Cygwin?
I say, let's get the compiling and linking working, and then worry about actually running it... :)
As far as I can see the only places get_thread_context and set_thread_context are used is in scheduler/thread.c, to implement WINAPI GetThreadContext and SetThreadContext
So actually a first approximation for [sg]et_thread_context for Cygwin would be one that does nothing. Then we can try submitting patches to Cygwin (Approach 2), so that other apps can make use of ptrace, if necessary.
Dimitrie O. Paun wrote:
On November 28, 2002 09:51 am, David Fraser wrote:
So part of the question is, in order to get Wine to function properly on Cygwin, what is the right threading approach to take? Am I right in thinking that the current code wouldn't work on Cygwin?
I say, let's get the compiling and linking working, and then worry about actually running it... :)
As far as I can see the only places get_thread_context and set_thread_context are used is in scheduler/thread.c, to implement WINAPI GetThreadContext and SetThreadContext
So actually a first approximation for [sg]et_thread_context for Cygwin would be one that does nothing. Then we can try submitting patches to Cygwin (Approach 2), so that other apps can make use of ptrace, if necessary.
OK, done that. So now wineserver.exe actually links :-) And it runs too! However can't yet see whether its going to do anything as in order to actually run programs it looks like we need tolink miscemu/main.c Problem here being that it wants to link with ntdll, which doesn't build yet. That still needs a lot more work... In the mean time a very simple patch that does nothing for context_i386.c is below in case anyone else wants to try... David
Index: server/context_i386.c =================================================================== RCS file: /home/wine/wine/server/context_i386.c,v retrieving revision 1.24 diff -u -r1.24 context_i386.c --- server/context_i386.c 8 Nov 2002 18:55:31 -0000 1.24 +++ server/context_i386.c 28 Nov 2002 15:48:01 -0000 @@ -76,7 +76,24 @@ #define PTRACE_SETDBREGS PT_SETDBREGS #endif
-#ifdef linux +#if defined(__CYGWIN__) + +/* retrieve a thread context */ +static void get_thread_context( struct thread *thread, unsigned int flags, CONTEXT *context ) +{ + /* FIXME: implement this */ + file_set_error(); +} + + +/* set a thread context */ +static void set_thread_context( struct thread *thread, unsigned int flags, const CONTEXT *context ) +{ + /* FIXME: implement this */ + file_set_error(); +} + +#elif defined(linux) #ifdef HAVE_SYS_USER_H # include <sys/user.h> #endif