.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > POD-Bot mm > Releases, Installers, Docs & Coding
Releases, Installers, Docs & Coding Where the official development happens

Reply
 
Thread Tools
How to compile binaries (dll, so) under windows
Old
  (#1)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Arrow How to compile binaries (dll, so) under windows - 03-01-2006

How to compile binaries (win/linux/amd64) using WIN OS.

This topic is dedicated to compile podbot sources, but it may be used as an good example also for oother metamod bots.
Topic could be created only because of big help T(+)rget (from AMX Dev team) gave me and because of his article dedicated mingw and cygwin. That article/procedure of usage mingw/cygwin You can find here: http://www.xake.dk/target/tools.html
Also big credits belongs to Jussi Kivilinna (ghost_of_evilspy, Hullu) - he teached T(+)rget and prepared for him some makefile, based on T(+)rget prepared the makefile for me for podbot mm.

Lets begin

A. The first part - Downloading all tools.
1. The first thing You need to have to compile podbot sources is... podbot mm sources
The sources of the latest release are available in filebase here: http://filebase.bots-united.com/inde...ct=view&id=380

2. The next step - download HL SDK and sources of metamod (podbot mm calls in its code a lot of HL and metamod functions,
so You need to link HL SDK and metamod in the file for compilation - more explanation later). Because for compilation we will use mingw - it's a GNU GCC software - the HL SDK version will need to be GNU GCC compliant (otherwise the compilation may finish OK , but *dll and *so files may not work). Will Day prepared it and You can download it here - from metamod site:
http://metamod.sourceforge.net/files...sdk-2.3-p3.zip
and the sources of metamod - currently it's mm 1.19 You can find here:
http://prdownloads.sourceforge.net/metamod/metamod-1.20-linux.src.tar.gz?download
Because windows mm sourcres are formatted by some editor which leaves some special characters at the line end, I recommend to use the sources of for linux version version - it's "normally" formatted.

3. Third step - download all utilities You will need to make compilation:
a) MinGW - the latest version from here: http://sourceforge.net/projects/ming...d?source=files
b) MSYS - shell for MinGW (You can also compile binaries without it - from command line - cmd.exe under Windows XP, 2000), but it's a useful tool and it's recommended to use it with MinGW - http://downloads.sourceforge.net/mingw/MSYS-1.0.11.exe
d) CYGWIN - http://www.cygwin.com/setup.exe
e) Linux crosscompiller for Cygwin - http://mirror.transact.net.au/source....6-tls.tar.bz2

B. The second part - Preparing the workspace and installing tools.

4. Now You need to prepare the workspace - need to choose some drive and directory You want to have everything installed. I did it this way - I preapred on my D: drive the directory called "COMPILE" and I created such subfolders in it: MINGW, MSYS, CYGWIN. These are directories where everything will be installed.

5. Lets begin the installation with MinGW - just let it to be installed in the directory You prepared for it (just hit enter
on the file MinGW-xxxx.exe and show the target directory). In my case it was:
D:\Compile\MINGW

6. Your MINGW is almost ready - just missing only one thing - Your system need to know where it is installed (it needs to be added to system paths) - to let You call some MINGW commands from command line. To do this You need to add this line into Your autoexec.bat file existing on C drive:
path = %path%;D:\COMPILE\MINGW\BIN
In my case there is "D:\COMPILE" , but if You installed it somewhere else You need to write Your path. Notice there is a path to MINGW\bin (there are located some exe file which will be used during compilation).

7. MinGW is ready - now You need to install MSYS - as it was mentioned before - You can compile without it, but it's a useful tool. Just hit enter on MSYS-1.0.10.exe and show the installer where is installed Your MINGW and where MSYS needs to be installed. In my case it's D:\COMPILE\MSYS
a) start MSYS installation by hit Enter
b) input: y then press: Return/Enter for post installation
c) input: y then press: Return/Enter for MinGW is installed
d) input: d:/COMPILE//MINGW - if thats where you installed it!
e) if all is successful You should see: "Oh joy, you do not have c:/MinGW/bin/make.exe". Keep it that way (it's a normal message). If You don't need to compile bot linux binaries (You need dll only) You may skip these follwing 2 steps.

8. Hit enter on cygwin's setup.exe and show it the target directory. Because it's installation from the internet - You will need to have some patience during process installation. On fast internet connection the installation may consume about 15 minutes, but if You don't have luck, it may take about 1hr. . The installation of cygwin is the hardest step You need to do if You want to compile linux binaries correctly! You need to mark some options (different than defaults):
a) choose Install from Internet
b) install in D:\COMPILE\cygwin (or the directory You preapred in the step 4)
c) continue until You see the Select Packages
d) click the "+" near "Libs"
e) make sure this file: "libpcre0: Perl-Compatible Regular Expressions library" is set on "4.5-1". If not - click on "skip"
(to mark it).
f) click the "+" near "Devel"
g) find "make": The GNU version of the "make" utility
h) click on: "skip" (to mark it) - it should change to a version number, which should be: "3.80-1"
i) find "nasm: The Netwide Assembler"
j) click on: "skip" (to mark it) - it should change to a version number, which should be: "0.98.39-1"
k) click "next" to finish installing cygwin
The cygwin is installed, but You need to crosscompiler tool to correctly compile linux binaries on Windows based PC.

9. To install crosstool:
a) move this file: cygwin-gcc-linux.tar.bz2 into: D:\Compile\CYGWIN - if thats where you installed it!
b) open up Cygwin Bash Shell (just left mouse button click on the icon created by installtor ine Your Menu STart or go to Your CYGWIN
directory and hit enter on cygwin.bat)
c) in the Bash Shell type:
cd d:/compile/cygwin
(notice the slashes direction!!!)
if it will not say You "not such file or directory" - it will mean You are in correct directory
d) in the bash shell type:
tar -jxvf cygwin-gcc-linux.tar.bz2
After doing it the crosscompiler tool will be automatically installed. There are some directories called as "i686-unknown-linux-gnu" - it's the correct name and You may not to be afraid something installed incorrectly. This package also contains the gcc 2.95 version necessary to make correct linux binaries compilation (it's because HL SDK is GCC 2.95 compliant - more info about that ask Pierre-Marie Baty or Whistler).
Every tools You have installed already , now You need to place somwhere Your bot's sources and HL SDK and metamod sources.

10. I created the folder called "PROJ" and I placed it in MINGW directory, but it may be placed in any place You want.
a) Into the "PROJ" directory unzip the contents of the file hlsdk-2.3-p3.zip. Then You should have now the new subfolder in "PROJ"
called hlsdk-2.3-p3 - rename it to HLSDK (if HL SDK wll be patched or updated again, You will not need to change anything in makefile
- some of next steps)
b) Unzip Your metamod-1.19-linux-src.tar.gz into PROJ directory - then You should see the subfolder called metamod-1.19 - rename it to
metamod - this way You just can easy update the contents of folder by the newer metamod sources without necessuty changing anything in the "makefile" (same as with HLSDK).
c) create the folder PODBOT in "PROJ" and unzip Your podbot sources into it (if in the zip file there is no directory called podbot - if there is such folder - just unzip it exactly into "PROJ")
d) download attached to this post the file called "makefile" and place it into PROJ\PODBOT directory.
e) open up that file and check if all directories used there are the same You are using (otheriwse something may not work for You).

Now You are ready to compile podbot_mm.

C. The third part - Compilation.

11. The first binary You may want to create as a *dll (windows binary). There are two ways two compile it.
a) The first one is - compilation from Windows command shell (Menu Start -> Run -> cmd.exe). when You have opened it already, type:
d:[hit Enter-key]
cd compile\proj\podbot[hit Enter-key] (this is the example of my path - remember to type the correct path to Your project bot sources)
mingw32-make[hit Enter-key]
and the compilation should start for You
b) Fire-up MSYS (You should see the link to it in Menu Start after installation), then type in Bash shell:
cd /d/compile/mingw/proj/podbot[hit Enter-key] (path - see the info like in 12.a)
make[hit Enter-key]
and the compilation should start for You.
In both cases You should see (if everything happened OK) the podbot_mm.dll file inside d:\compile\mingw\proj\podbot\obj.win32 folder.
(or in your_folder\obj.win32 You prepared).
After compilation there are some files *.o in that win32.obj - before trying to compile the sources again You need to delete them manually or in msys' Bash shell by command:
make clean[hit Enter-key]
or in command shell under windows:
mingw32-make clean[hit Enter-key]

12. The next binary You may need is linux *i386.so. I call it as *i386.so, but it's really compiled as i586 , but I do it because of the compatibility with metamod's plugins.ini file (to don't change everytime - according to the compilation parameters - the line
linux addons/podbot/podbot_mm_i386.so
It might be a bit confusing for linux users - they are used to calling file name according to the optimizations parameters of the compilation, but I hope it's not big violation of linux rules.
Lets begin to compile linux binary...
Fire-up Your cygwin and type in the Bash shell:
cd d:/compile/mingw/proj/podbot[hit Enter-key] (the info like above - use correct directory here)
make[hit Enter-key]
and the compilation of the linux *so file shoud start for You. If everything happened OK - You should see inside
d:\compile\mingw\proj\podbot\linux.obj directory the podbot_mm_i386.so file. After compilation there are some files *.o in that linux.obj - before trying to compile the sources again (notes as with compilation dll) You need to delete them manually or write the command in cygwin's Bash shell:
make clean[hit Enter-key]

13 The last thing You may need is the amd64 linux compilation. Fire-up the cygwin (if You have it closed) and type in Bash shell:
cd d:/compile/mingw/proj/podbot[hit Enter-key] (the info like above - use correct directory here)
make arch=amd64[hit Enter-key] (note - look - arch=amd64 shouln't be in capitalize!!!)
If everything happend ok You should see in d:\compile\mingw\proj\podbot\linux.obj directory the podbot_mm_amd64.so file.
The same rules for deleting *.o files before compiling amd64.so file again as in point 13.

That's all. Now You have everything described to make Your podbot binary Your-self. The "makefile" isn't yet perfect, but as it was mentioned before - if someone help me with it, I'll fix some issues with it (cleaning up *.o files doesn't work, dll properties aren't displayed by right mouse click to see everything from *.rc file).

[EDIT=KWo - 2006.01.05]
Re-edited text to divide it into some parts.
Fixed problem with windows dll properties (WIN_RES)
Fixed problem with cleaning up *.o files by make clean command.
Updated makefile in attachment.
[/EDIT]
[EDIT2=KWo - 2006.11.19]
Updated the description for mm 1.19
Updated again the makefile in the attachment
[/EDIT2]
[EDIT3=KWo - 2010.09.09]
Updated the description for the latest mingw version
Removed the makefile - use the latest from the sources of podbot mm
[/EDIT3]
[EDIT4=KWo - 2013.06.04]
Updated the description for the latest mingw version
Fixed broken links.
[/EDIT3]

Last edited by KWo; 04-06-2013 at 23:27..
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#2)
[NvT]_KaszpiR_
Member
 
[NvT]_KaszpiR_'s Avatar
 
Status: Offline
Posts: 322
Join Date: Apr 2004
Default Re: How to compile binaries (dll, so) under windows - 21-05-2006

today (21st may 2006) i managed to cross comile sources under linux for windows plaftorm

but makefile is a mess
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#3)
dragon52225
Member
 
Status: Offline
Posts: 9
Join Date: Apr 2006
Default Re: How to compile binaries (dll, so) under windows - 26-05-2006

Haha, I compiled it succesfully, without messing with the makefile, both for linux and windows, i'm just trying to make it build under native linux... but gcc 3 hates me.
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#4)
[NvT]_KaszpiR_
Member
 
[NvT]_KaszpiR_'s Avatar
 
Status: Offline
Posts: 322
Join Date: Apr 2004
Default Re: How to compile binaries (dll, so) under windows - 26-05-2006

because as u said before, original makefile under linux returns errors
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#5)
Serious Sam
Member
 
Serious Sam's Avatar
 
Status: Offline
Posts: 33
Join Date: Sep 2009
Location: Bulgaria
Default Re: How to compile binaries (dll, so) under windows - 01-10-2010

What exactly should I change in the source to compile it under windows with visual studio and full metamod/hlsdk sources instead of messing with min-something like in this tutorial? And if I do use the full metamod/hlsdk sources, is this going to make the .dll to take much more space or resources or something like that?
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#6)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: How to compile binaries (dll, so) under windows - 04-10-2010

Here is my vcproj file for MS Visual C++ 2008 Express.
If You have directories the same way created like I described for MINGW, this vcproj file should work for You.
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#7)
Serious Sam
Member
 
Serious Sam's Avatar
 
Status: Offline
Posts: 33
Join Date: Sep 2009
Location: Bulgaria
Default Re: How to compile binaries (dll, so) under windows - 05-10-2010

I did put hlsdk, metamod and podbot (sources) folders in one folder, and put your vcproj in the podbot folder, when I try to build release I get this error: 1>'pre_build.bat' is not recognized as an internal or external command. I found it in the Build Events tab and deleted it, then I got error 1>'post_build_rel_mv.bat' is not recognized as an internal or external command, I deleted it as well, and It compiled fine, but I want to ask if removing these will cause some problems later, and what were they there for
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#8)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: How to compile binaries (dll, so) under windows - 05-10-2010

prebuild.bat makes the res file (podbot.rc) with all needed info (like plugin version, date creation etc). Those info are later seen under windows when You right-click by mouse button on dll properties.
post_build_rel_mv.bat copies podbot_mm.dll file (after the compilation) from the \release folder to my cstrike\addons\podbot folder.
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#9)
Serious Sam
Member
 
Serious Sam's Avatar
 
Status: Offline
Posts: 33
Join Date: Sep 2009
Location: Bulgaria
Default Re: How to compile binaries (dll, so) under windows - 05-10-2010

ok thanks, I don't need them then
  
Reply With Quote
Re: How to compile binaries (dll, so) under windows
Old
  (#10)
dstopgunner
Member
 
Status: Offline
Posts: 2
Join Date: Apr 2011
Default Re: How to compile binaries (dll, so) under windows - 11-04-2011

I downloaded the hlsdk (not source)
http://metamod.sourceforge.net/files...sdk-2.3-p3.zip


MinGW - the latest version from here: http://sourceforge.net/projects/ming...W%20Installer/
b) MSYS - shell for MinGW (You can also compile binaries without it - from command line - cmd.exe under Windows XP, 2000), but it's a useful tool and it's recommended to use it with MinGW - http://sourceforge.net/projects/ming...0.exe/download
d) CYGWIN
http://www.cygwin.com/setup.exe

okay hence this is my workspace


but at step 6)
I dont see any .bat files here to edit


the only bat file i see is in the msys folder , msys.bat



I added "path = %path%;D:\botsunited\MINGW\BIN" to msys.bat

going on... went to step 11b) tried to compile .. not sure if it compiled



there wasnt any podbot_mm.dll file inside d:\botsunited\mingw\proj\podbot\obj.win32 folder , there wasnt any obj.win32 folder at all
this was what i got after my attempt to compile


Need help...
This my workspace files if anyone needs 2 see http://www.megaupload.com/?d=IEU5UTB5
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com