Page 1 of 7

Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 10:24 am
by Dietmar
Hi all,
after small time of 15 hours :D
I succeed to compile full wine-1.5.9 with gcc instruction -marm
without any errors on the Raspberry Pi.
Now funs starts, this is a nice day today

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 12:30 pm
by bredman
This is very ambitious.

As far as I know, Wine only emulates the Windows system call interface. What will you use to execute the x86 binaries on the ARM processor?

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 1:05 pm
by Dietmar
Hi bredman,
first I want to test notepad.exe.

This is a really funny thing now. Raspi waits for applications, written for Win8 for ARM.

I think, nearly ALL will run. And with nearly the same speed as in original, because now it makes use of the compiled Dll's for ARM. But until now, I do have notepad.exe only for i386, mips, sparc, alpha but not arm.
So I make a test with Reactos. In this moment, I compile Reactos 3.1.14 for arm.
Reactos can no handle all windows applcations, but it would be a nice test for the dll's compiled for ARM from WINE.
I am not so good in this this. Would you think, that invoking gcc on Raspi with
make ARCH=arm for the Reactos source
is enough for to produce ARM-code, that raspi understands? Or should there be more switches after
make ARCH=arm -?
Any help is welcome, this is really cool :mrgreen: ,

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 3:02 pm
by Dietmar
Now I make a try to compile the source for Notepad from reactos for Raspberry Pi alone as a first step.
My head is whirling around :mrgreen: .
Notepad.exe depends on user32.dll gdi32.dll comctl32.dll comdlg32.dll advapi32.dll shell32.dll msvcrt.dll and kernel32.dll
Wine knows all about those dlls.
So, if in Raspis commandline wine notepad.exe
opens notepad, wine must make use of all those dlls. But until now I do not succeed to compile notepad for Raspi, even I have all the source files from reactos, because I do not know the syntax for the gcc-compiler, how to make notice of the contens of CMakelists.txt (for Notepad)



add_executable(notepad ${SOURCE})

set_module_type(notepad win32gui UNICODE)
add_importlibs(notepad user32 gdi32 comctl32 comdlg32 advapi32 shell32 msvcrt kernel32)
add_pch(notepad notepad.h)
add_cd_file(TARGET notepad DESTINATION reactos/system32 FOR all)


EDIT: Aha, gcc cries for a makefile, so I try to build one with the informations above.

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 4:09 pm
by Dietmar
Hm, now I not sure if any compiler on the market today can do this. May be we need to wait for a compiler for Win8 on ARM.
Until now we have Wine on Raspi, which works, for example just type wine -version.
This Wine knows most of the dlls from any Windows-version. They can be called by their name and do the same as in Windows, but in machine-language of ARM.
But when you tell a compiler to produce code for ARM,
can the compiler produce ARM code for Windows or this this not important at all??
It is just as if the compiler just changes the machinelangue in notepad.exe for i386 against
for ARM. This should be even possible, when you do NOT know the C-sourcecode,
as long as there are not absolute jumps in the machine code,

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 5:36 pm
by Dietmar
I just noticed,
that Wine builds an own notepad.exe and this works on Raspi!!!
So, it can be done.
Also works, Wine sets up a whole Windows directory with some working *.exe files on raspi,

PS: Now, the "only" question is, how to make your own *.exe files,
that work like this notepad.exe on raspi.


Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 7:15 pm
by Dietmar
Yeeah it is really true,
Ida Pro Disassembler shows

File Name : C:\notepad.exe
.text:10001000 ; Format : Portable executable for ??? (PE)
.text:10001000 ; Imagebase : 10000000
.text:10001000 ; Section 1. (virtual address 00001000)
.text:10001000 ; Virtual size : 00001000 ( 4096.)
.text:10001000 ; Section size in file : 00000008 ( 8.)
.text:10001000 ; Offset to raw data for section: 00000200
.text:10001000 ; Flags 60000020: Text Executable Readable
.text:10001000 ; Alignment : 16 bytes ?
.text:10001000 ; Processor : ARM
.text:10001000 ; Target assembler: Generic assembler for ARM
.text:10001000 ; Byte sex : Little endian

So, this is the first *.exe file from Windows, that works in realtime without any emulation on Raspi.
And it is fast................................................... :mrgreen:

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 7:38 pm
by Dietmar
Hm, something
is strange in this notepad.exe from Wine for ARM.
I compared it with a notepad.exe for WinCE, which is also ARM.
The notepad.exe from Wine is not real assembler language,
it looks like a dummy, which only links to Wine, that you can see in hexcode,

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 8:18 pm
by Dietmar
Does something like
./configure --cross-prefix="arm-pc-mingw32-"
exist? It would do a crosscompile for a Windows on ARM,

EDIT: Something like this must exist, because the people from Wine on ARM needed it.
Also seems to exist some hidden switches in reactos, to compile it for an ARM machine (NOT WinCE).
But I need more information how to do this.

Re: Wine on Raspberry Pi

Posted: Sat Jul 28, 2012 9:10 pm
by Dietmar
Has Wine an own compiler winegcc?
Take a look at ... ure=relmfu

What do you think,

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 10:03 am
by twocvbloke
I think there should be a Raspberry-specific version of WINE, just so it could be called RaspberryWINE.... :D

Last time I attempted to use WINE (I think that was under Linux Mint or Kubuntu, it's been a while), I never really had much success at running programs that require Winders, then later I fond that WINE was as unsecure as WindowsXP was when it was brand spankin' as it emulated a windows environment right down to the security flaws and exploit holes, so, that put me off it completely.... :shock:

I'm sure it's been fixed now though, but I haven't a spare computer that would happily take a Linux distribution to play with WINE on... :lol:

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 10:41 am
by Dietmar
Hi all,
I have a question:
How can I set up a crosscompiler, most easy on Raspi Raspbian itself,
that compiles a simple hello.c textfile

#include <stdio.h>
int main(void)
printf("Hello world!\n");
return 0;

to that I can start this on Raspi with
wine hello.exe
from command line in Raspi?
I make some tests: I can build hello.exe nearly on every platform.
But none of them starts in Wine on Raspi,
thanks Dietmar

PS: In the simple hello.c file is no other dll from Windows.
So, is the problem that stdio.h from Windows has to be used?

EDIT: "Wine on ARM already get's packaged in Maemo and Fedora."
But where is sense, when there is no compiler for :mrgreen: ?

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 11:41 am
by Dietmar
Ok, next try. Wine comes with the compiler winegcc.
So I make try in commandline from Raspi

wingcc --version
gcc (Debian) 4.6.3

Ok, nice I think.
But then next in commandline from Raspi
winegcc -o hello hello.c
produces an hello.exe file, where call with
wine hello.exe
tells "bad exe format"


PS: Without error is build hello.o

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 12:02 pm
by Dietmar
I take a look at this hello.exe,
produced via winegcc on raspi.
C:\>file hello.exe
gives answer from gcc compiler on my windows desktop computer
POSIX shell script text executable

Ok, this means, like notepad.exe, that wine builds only a dummy.
But the problem MAY be, that this winegcc produces something like
i386 machinecode, even if it is compiled for ARM :?

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 12:45 pm
by Dietmar
I tested the files in Fedora i386 Wine :mrgreen: .
The notepad.exe from installed Raspi Wine starts as normal :? .
A test with file notepad.exe tells
PE 32 executable (GUI) Unknown processor type 0x1c4 for MS Windows


My with winegcc on Raspi builded hello.exe does not work.
The same message as in raspi Wine: Wrong exe format.
And file hello.exe shows also
POSIX shell script text executable


Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 12:57 pm
by bredman
I think that you don't understand how big this problem is. A Windows program will be compiled for x86, not for ARM.

To be able to execute x86 code on an ARM processor, you need a processor emulator (for example QEMU) to execute the x86 code on an ARM processor. Wine is not a processor emulator.

This is why Wine works properly on Fedora i386 but not on Fedora ARM.

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 1:21 pm
by Dietmar
Hi bredman,
I do not understand all,
but I got my hello.exe to start on raspberry pi wine
with commandline in Raspi
wine ./hello.exe
Crazy, but now I know,
that you can start something own in wine on Raspberry Pi,
Correction: No, I cant start my hello.exe in wine. This starts only in commandline without wine
./hello.exe. This is really strange for me, this means the winegcc compiler produces only code,
that can be executed on Raspi Raspbian itself and not as a windows executable :(

PS: I did also vice versa a test, if the notepad.exe from fedora i386 wine can start in
Raspi wine. But this file is even not recogniced by raspi:-).
Strange is for me only, HOW can Fedora Wine start a working .exe file from Raspi Wine???

EDIT: "A Windows program will be compiled for x86, not for ARM"
Yes, this is a BIG problem until now. But the people from Wine succeded with this, they just compile for ARM, doesnt matter if there was Windows in it. This I understand now: Because the dlls call each other,
there is no need for to tell the compiler, that it has to be compiled for Windows on ARM.

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 6:28 pm
by bredman
Please do some research. Wine will not allow you you to run x86 code on an ARM processor.

Just compiling an ARM version of Wine will not help you in any way. You are wasting your time.

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 7:23 pm
by Dietmar
This is very clear for me,
that you cannot run direkt i386 code on an ARM processor.
But when you have the source files of an application, it SHOULD be posible to compile them for ARM and run them on Wine. But may be Reactos in future would be a better choice than wine,
because until now I do not succeed to awake a simple Hello world program with the winegcc compiler,

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 8:04 pm
by Joe Schmoe
I think I see what is going on here.

Dietmar is saying that if you have source code for a Windows program, you should be able to compile it (into ARM code) and run it under a Windows-like environment (i.e., Wine) and have it at least sort of look like the regular thing running under regular Windows on a regular PC.

This is an admirable goal - although one that is pretty much academic from most people's (but not all! - and certainly not from Dietmar's) point of view.

Andrew, OTOH, is talking about the usual case - where you have Windows (x86) software but no source code (and no way to recompile). This is the case that most people care about and the one that is not possible (in any "normal" sense) to solve.

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 8:44 pm
by Dietmar
Hi Joe,
you are right. The problem is, how to compile the source code for windows programm to ARM.
The own winegcc compiler seems not, that he can do this.
I tested also winemaker --lower-all -DSTRICT
for to compile Quake2 (for windows) for ARM. But after it starts,
there comes a lot of error messages and I give up after half of the files of Quake2 are compiled.
So, I decided to start with a more easy program.
I do not succeed with a Hello World program (its source code works in windows^^).
This is, because I have no idea, what I should tell to the compiler, that he does not make a Hello world programm, that run on Rasbian Linux but in Wine on Raspberry Pi.
The people from Wine compiled their program just with the gcc Compiler on real Raspi.
But I have some doubts, what is going on there, because I look at their notepad.exe.
It is a dummy, not a real ARM machinecode, running in a pseudo Windows environment,

PS: I make a try with the source files from reactos for their notepad. But still remains the question,
what should be told to the compiler. I make a test on raspi with gcc -O2 -g -marm
which worked for Wine. I think, this notepad will run, but again ONLY in Raspbian Linux and not in Wine.

EDIT: "In order to do this, we can use the ARM cross compiler & linker for C/C++ that Microsoft included within Visual Studio 11 Developer Preview.
On a machine with Dev11 installed, you can find the command-line tools themselves in the following folder:"

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_arm\

Re: Wine on Raspberry Pi

Posted: Sun Jul 29, 2012 9:21 pm
by Dietmar

Re: Wine on Raspberry Pi

Posted: Mon Jul 30, 2012 10:52 am
by Dietmar
Yeaaaahh :D :D :D
I succeed to compile and run my Hello world program in Wine on Raspi!
Now, this is really fun...
This simple means, that programs with source written for any Windows can run in Wine on Raspi.
Little strange thing for me is, that Wine always generates a dummy of the exe file,

Ok, small tutorial how this can be done

1. get wine, unzip it on Raspi Rasbian
2. go to its folder
3. type ./configure --prefix=/usr
4. type make
Time for this is 15 hours,
no errors should be seen.

5. Write a hello world program with a texteditor, I wrote

#include <stdio.h>
int main(void)
printf("Hello World\n");

6. name it hello.c and store it in an own folder with name hello
(I used for this vm-0.57a-20080616.exe because it generates makefile, but no need for)

7. go to that folder hello (Be carefull, if you are not in this folder, winemaker "repairs" ALL)

8. Write in commandline winemaker --lower-all -DSTRICT /home/pi/hello (This is your full path to this folder hello)

9. type make

10. in the folder hello are now (after some error messages) hello.o hello.exe Makefile

11. type wine

You should see famous
Hello World


Re: Wine on Raspberry Pi

Posted: Mon Jul 30, 2012 11:49 am
by Dietmar



Re: Wine on Raspberry Pi

Posted: Mon Jul 30, 2012 2:54 pm
by rvalles
Hm, what about qemu-user (to x86 or amd64) + wine?