Cross Compiling Linux to Windows ( Debian )

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

I would like to cross compile 0.4 from my Linux so that I may be able to compile 0.4 for an windows version of Armagetron Advanced

I was following this tutorial.
http://wiki.armagetronad.org/index.php? ... from_Linux

First, I installed the dependencies ( sudo apt-get install mingw-w64 xml2)
And ran the usual commands I use to compile Armagetron Advanced on my Linux but this time with the correct configure for cross compiling

Code: Select all

make clean
./bootstrap
./configure --host=i686-w64-mingw32 --prefix=/usr/i686-w64-mingw32 --with-python=no
I got this error code every time I tried to compile, but I thought I downloaded xml2 successfully.

Code: Select all

checking for xmlParseMemory in -lxml2... no
configure: error: You need the library xml2 to compile Armagetron Advanced. Read the file doc/installation.txt.
xml2 shows it was installed successfully.

Code: Select all

root@John:~/Downloads/xml2-0.4# apt-get install  xml2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
xml2 is already the newest version.
The following packages were automatically installed and are no longer required:
  libseccomp2 torsocks
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@John:~/Downloads/xml2-0.4# 
Although it tells me to read the file doc/installation.txt I can not find the directory 'doc' in 0.4 anywhere. Help would be much appreciated, I don't know what could be the issue I have tried to reinstall xml2 several times.
User avatar
aP|Nelg
Match Winner
Posts: 621
Joined: Wed Oct 22, 2014 10:22 pm
Contact:

Re: Cross Compiling Linux to Windows ( Debian )

Post by aP|Nelg »

I'd suggest actually using windows to compile, whether its in a VM or dual-boot.
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

aP|Nelg wrote:I'd suggest actually using windows to compile, whether its in a VM or dual-boot.
Thats what I was planning to do in case no one actually had a solution for this problem but I feel like that is far too complex when there is an option like this (cross compiling) and wouldn't be as convenient.
User avatar
Z-Man
God & Project Admin
Posts: 11585
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne
Contact:

Re: Cross Compiling Linux to Windows ( Debian )

Post by Z-Man »

No need for a full VM; Code::Blocks inside Wine works just as well. I personally use that path via the shell script win32/fromunix.sh; it guarantees the build is the same thing you get with a native Windows build. Which means that in case of problems, I can then switch to Windows and debug the problem.

Proper cross compilation always was too complicated and annoying for me, so I can't help there.
User avatar
Light
Reverse Outside Corner Grinder
Posts: 1667
Joined: Thu Oct 20, 2011 2:11 pm

Re: Cross Compiling Linux to Windows ( Debian )

Post by Light »

It's asking for the libxml development package.

Code: Select all

sudo apt-get install libxml2-dev
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

Z-Man wrote:No need for a full VM; Code::Blocks inside Wine works just as well. I personally use that path via the shell script win32/fromunix.sh; it guarantees the build is the same thing you get with a native Windows build. Which means that in case of problems, I can then switch to Windows and debug the problem.

Proper cross compilation always was too complicated and annoying for me, so I can't help there.
The wine options sounds promising. Ill have to try it and see how it goes.
Light wrote:It's asking for the libxml development package.

Code: Select all

sudo apt-get install libxml2-dev
I installed anything with libxml2 as its name after I couldn't get it to work so I already had libxml2-dev.

Code: Select all

root@Nick:~# sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxml2-dev is already the newest version.
The following packages were automatically installed and are no longer required:
  libseccomp2 torsocks
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Last edited by LittleSteps on Thu Aug 13, 2015 11:13 pm, edited 1 time in total.
User avatar
kyle
Reverse Outside Corner Grinder
Posts: 1876
Joined: Thu Jun 08, 2006 3:33 pm
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
Contact:

Re: Cross Compiling Linux to Windows ( Debian )

Post by kyle »

Light wrote:It's asking for the libxml development package.

Code: Select all

sudo apt-get install libxml2-dev
he needs libxml compiled for mingw to use, that is what those instructions are referring to, compiling libxml2 from source with those options, but I agree with z-man for this one
Image
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

While trying to compile on an actual windows machine, I got a syntax error on src\win32\armagetron.rc LINE 70. Code blocks doesn't seem to tell me much information just says I got a syntax error.

Code: Select all

64/////////////////////////////////////////////////////////////////////////////
65//
66// Version
67//
68
69VS_VERSION_INFO VERSIONINFO
70 FILEVERSION MAJOR_VERSION
71 PRODUCTVERSION MAJOR_VERSION
72 FILEFLAGSMASK 0x3fL
73#ifdef _DEBUG
74 FILEFLAGS VS_FF_PRERELEASE | VS_FF_DEBUG//0x1L
75#else
76 FILEFLAGS 0x0L
77#endif
78 FILEOS VOS_NT_WINDOWS32 //0x40004L
79 FILETYPE VFT_APP //0x2L
80 FILESUBTYPE 0x0L
81BEGIN
82    BLOCK "StringFileInfo"
83    BEGIN
84        BLOCK "040904b0"
85        BEGIN
86            VALUE "CompanyName", "\0"
87            VALUE "FileDescription", "Armagetron Advanced\0"
88            VALUE "FileVersion", TRUE_ARMAGETRONAD_VERSION
89            VALUE "InternalName", "ArmagetronAd\0"
90            VALUE "LegalCopyright", "GNU Public License\0"
91            VALUE "License", "GPL\0"
92            VALUE "Homepage", "http://www.armagetronad.net\0"
93            VALUE "OriginalFilename", "ArmagetronAd.exe\0"
94            VALUE "ProductName", "Armagetron Advanced\0"
95            VALUE "ProductVersion", TRUE_ARMAGETRONAD_VERSION
96        END
97    END
98    BLOCK "VarFileInfo"
99    BEGIN
100        VALUE "Translation", 0x409, 1200
101    END
102END
103
104#endif    // !_MAC
105
106#ifdef APSTUDIO_INVOKED

Also when trying code block with wine i got this error

Code: Select all

root@Nick:~/Desktop/my0.4/win32# sh fromunix.sh 
fromunix.sh: 9: fromunix.sh: pushd: not found
ls: cannot access *.pb.cc: No such file or directory
ls: cannot access *.pb.h: No such file or directory
wine: cannot find '../../../winlibs/protobuf/bin/protoc'
Windows wont let me win today :x
Last edited by LittleSteps on Thu Aug 13, 2015 11:51 pm, edited 1 time in total.
User avatar
ConVicT
Shutout Match Winner
Posts: 1001
Joined: Fri Feb 17, 2012 2:33 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by ConVicT »

I get errors on 70 and 71 too, but it doesn't seem to affect the build, or nothing that I've noticed anyway.

A weird thing happened to me when I was doing this, and I got the same syntax errors as him.
When I built armagetronad, installed it, then uninstalled it (because I hate 0.4), my 0.2's floor a and floor b changed to green... Why is that?

Ps: LittleSteps, I PM'd you, can you have a look please.
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

ConVicT wrote:I get errors on 70 and 71 too, but it doesn't seem to affect the build, or nothing that I've noticed anyway.

A weird thing happened to me when I was doing this, and I got the same syntax errors as him.
When I built armagetronad, installed it, then uninstalled it (because I hate 0.4), my 0.2's floor a and floor b changed to green... Why is that?

Ps: LittleSteps, I PM'd you, can you have a look please.
When ever I get this error code blocks stops compiling.
User avatar
ConVicT
Shutout Match Winner
Posts: 1001
Joined: Fri Feb 17, 2012 2:33 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by ConVicT »

That's weird, it seems to just continue for me.
If you're not building one at a time, I suggest you do that.
I couldn't produce a working exe unless I built everything one by one and then built Armagetron Advanced.

I can't find it but you should look at Jip's tutorial, that's what I followed, 'cept I didn't get everything through svn, I just got it from sourceforge.
Edit: I'm quite busy atm so I have no time to look for the links but Vertrex's tutorial you can get from the wiki helped me a lot. Although, I was going in completely clueless to what "compile" even meant lol, so maybe not as helpful to you.
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

ConVicT wrote:
LittleSteps wrote: Hmm I was following jips tutorial and I got an error with the lines he told me to comment out 122 and 125 of defs.h. I decided to ignore that part in jips tutorial but I got the same error as I did before on line 70 and 71 which caused the build to fail
That's because they lines are no longer there.
If you'd read on you'd have seen Z-Man say:
Z-Man wrote:
Jip wrote: 3.
Edit ..\armagetronad\src\defs.h and comment out line 122 and 125
The block should look like this:

Code: Select all

//#ifndef HAVE_ISBLANK
// this function does not seem to exist in windows and solaris 2.8
inline bool isblank(int x){ return ((x == ' ') || (x == '\t')); }
//#endif
That should no longer be required.
And after update_version.bat, you need to run protobuf.bat, too.
Also he adds something Jip left out.
I also did what Z-Man said and still got the same errors.
LittleSteps wrote:I decided to ignore that part in jips tutorial but I got the same error as I did before on line 70 and 71 which caused the build to fail
Last edited by LittleSteps on Sat Aug 15, 2015 12:52 am, edited 1 time in total.
User avatar
ConVicT
Shutout Match Winner
Posts: 1001
Joined: Fri Feb 17, 2012 2:33 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by ConVicT »

LittleSteps wrote: Hmm I was following jips tutorial and I got an error with the lines he told me to comment out 122 and 125 of defs.h. I decided to ignore that part in jips tutorial but I got the same error as I did before on line 70 and 71 which caused the build to fail
That's because they lines are no longer there.
If you'd read on you'd have seen Z-Man say:
Z-Man wrote:
Jip wrote: 3.
Edit ..\armagetronad\src\defs.h and comment out line 122 and 125
The block should look like this:

Code: Select all

//#ifndef HAVE_ISBLANK
// this function does not seem to exist in windows and solaris 2.8
inline bool isblank(int x){ return ((x == ' ') || (x == '\t')); }
//#endif
That should no longer be required.
And after update_version.bat, you need to run protobuf.bat, too.
Also he adds something Jip left out.
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

ConVicT wrote:
LittleSteps wrote: Hmm I was following jips tutorial and I got an error with the lines he told me to comment out 122 and 125 of defs.h. I decided to ignore that part in jips tutorial but I got the same error as I did before on line 70 and 71 which caused the build to fail
That's because they lines are no longer there.
If you'd read on you'd have seen Z-Man say:
Z-Man wrote:
Jip wrote: 3.
Edit ..\armagetronad\src\defs.h and comment out line 122 and 125
The block should look like this:

Code: Select all

//#ifndef HAVE_ISBLANK
// this function does not seem to exist in windows and solaris 2.8
inline bool isblank(int x){ return ((x == ' ') || (x == '\t')); }
//#endif
That should no longer be required.
And after update_version.bat, you need to run protobuf.bat, too.
Also he adds something Jip left out.


I have read that part and tried everything Z-Man and jip has said in that conversation.
Below that he says that jips tutorial was correct and he was speaking on behalf of 2.8.3.x
Z-Man wrote:What I say there is for 0.2.8. 0.4 is as Jip describes.
User avatar
LittleSteps
Core Dumper
Posts: 157
Joined: Thu Apr 12, 2012 2:30 am

Re: Cross Compiling Linux to Windows ( Debian )

Post by LittleSteps »

Is there anything I can do to get this to compile? I am compiling a fresh source of 0.4 and winlibs and have tried several tutorials.
Post Reply