Compiling OpenKore under Windows (WinXP/Win7)

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Compiling OpenKore under Windows (WinXP/Win7)

#1 Post by kLabMouse »

On these topic, I'll Explain how to SetUp and Install all required things to run OpenKore under Windows.
and Build start.exe and wxstart.exe


We Will Start from Installing Required Software and Perl packages:


1) Install:
ActiveState Perl 5.10
ActiveState PDK 9.0 (Optional)
GCC MingW 5.1
Python 2.7
Microsoft Windows SDK / Platform SDK
Note: About "Microsoft Windows SDK / Platform SDK" I still Donno. May-be It's better to just use "GCC MingW".

2) Installing Wx (Optional if you want to do #3.1):
Run PPM.
From the application menu under Edit -> Preferences, add a new repository using the URL

http://www.wxperl.co.uk/repository
If you have a recent ActivePerl installation on Windows, this repository will already be available in the dropdown list of repositories.
You can display the source repository for PPMs in the Perl Package Manager GUI via the menu selection View->View Columns->Repo.

Choose to install from wxperl repository:
Wx
Wx::Demo
Wx::TreeListCtrl
Wx::GLCanvas
Wx::Perl::Packager
Note: On Some Cases, hand compiling of "Wx" fails. So I better suggest to use wxperl PPM packages.

3) Other CPAN packages:
1) Compile and Install some needed CPAN packages:
cpan
cpan> install UNIVERSAL::require
cpan> install ExtUtils::XSpp
cpan> install IO::Scalar
cpan> install List::Util
cpan> install File::Path
cpan> install File::Slurp
cpan> install File::chdir
cpan> install Text::Balanced
cpan> install Digest::MD5
cpan> install OpenGL
4) Wx CPAN packages (optional):
1) Compile and Install some needed CPAN packages:
cpan
cpan> force install Alien::wxWidgets
cpan> force install Wx
cpan> force install Wx::GLCanvas
cpan> force install Wx::TreeListCtrl
cpan> force install Wx::Demo
cpan> force install Wx::Perl::Packager
5) 'Coro' (optional):
TODO....
Note: Thees is better done by hands.

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Compiling OpenKore under Windows (WinXP/Win7)

#2 Post by kLabMouse »

Compiling XSTools.dll and NetRedirect.dll

Note: this task is simple, and just need a few tools to be Installed.

1) Install Dependency tools (full installation)
GCC MingW 5.1
Python 2.5 or better
2) Open simple Console on where OpenKore is unpacked (Not the MS Dev Console).

3) Run SCons from OpenKore place:
python src/scons-local-1.3.0/scons.py
Note: sometimes (on some systems) Python is not on path, so you need to change 'python' to something like 'C:\Python27\python.exe'.
Note: When Ended successfully, you will get 'scons: done building targets.'

4) Move compiled DLL's:
copy .\src\auto\XSTools\XSTools.dll .\
copy .\src\auto\XSTools\NetRedirect.dll .\
del /F /Q .\src\auto\XSTools\XSTools.dll
del /F /Q .\src\auto\XSTools\NetRedirect.dll
5) Now Clean Up the mess We made:
python src/scons-local-1.3.0/scons.py -c
Note: Same as on Step (3)

6) All Done! Hurray!!!!!!! :D

User avatar
kLabMouse
Administrator
Administrator
Posts: 1301
Joined: 24 Apr 2008, 12:02

Re: Compiling OpenKore under Windows (WinXP/Win7)

#3 Post by kLabMouse »

Making start.exe and wxstart.exe

Note: this task is simple, and just need a few tools to be Installed.

1) Install Dependency:
ActiveState PDK 9.0
Platform SDK Redistributable: GDI+
2) Copy 'gdiplus.dll' to 'Perl\site\lib\Alien\wxWidgets\msw_*\lib\'
Note: this mean Unpacking that KB and copy file to Alien::wxWidgets lib folder.

3) Open simple Console on where OpenKore is unpacked (Not the MS Dev Console).

4) Navigate to 'build' folder:
cd src\build\
5) Build 'start.exe':
set BUILDING_WX=0
compile.bat
Note: Do not run this after 'compile-wx.bat' or you will get non working 'start.exe'.

6) Build 'wxstart.exe':
compile-wx.bat
7) All Done! Hurray!!!!!!! :D

User avatar
alisonrag
Developers
Developers
Posts: 34
Joined: 30 Jun 2011, 12:25
Noob?: No
Location: Brazil

Re: Compiling OpenKore under Windows (WinXP/Win7)

#4 Post by alisonrag »

Compiling Using perl 5.22

# Clearing the environment
uninstall all perl versions from pc
uninstall all python versions
clear the windows PATH remove all perl/mingw/gcc/python references

# Setting Up the environment
Intall Active Perl 5.22 x86_64 - https://github.com/OpenKore/perl-dev-ki ... r/perl_522
Instal Perl PDK 9.5.1 - x86 - https://github.com/OpenKore/perl-dev-ki ... r/perl_522
Install Winlibs (GCC 7.5.0 + MinGW-w64 7.0.0) x86 - https://github.com/brechtsanders/winlib ... .0.0-r1.7z

# Setting up the Windows PATH
Add Winlibs to PATH (must be before of everything)
`C:\mingw32\bin`
Add Perl PDK 9.5.1 to PATH
`C:\Program Files (x86)\ActiveState Perl Dev Kit 9.5.1\bin`
Add Active Perl 5.22 to PATH
`C:\Perl\site\bin`
`C:\Perl\bin`

# Installing CPAN dependencies
open ppm
install JSON-XS
install YAML
install Canary-Stability
close the ppm

# Installing Wx lib
open cpan

notest install Log::Log4perl
notest install CPAN
fforce notest install Alien::wxWidgets
fforce notest install Wx
fforce notest install Wx::Perl::Packager
fforce notest install OpenGL
fforce notest install Wx::GLCanvas
fforce notest install Wx::Demo
# fforce notest install Wx::TreeListCtrl (not working, error in compilation)

# Installing Openkore dependencies
notest install CPAN::DistnameInfo
notest install UNIVERSAL::require
notest install ExtUtils::XSpp
notest install IO::Scalar
notest install List::Util
notest install File::Path
notest install File::Slurp
notest install File::chdir
notest install Text::Balanced
notest install Digest::MD5
notest install Encode::HanExtra

# Wx::TreeListCtrl manual install
download https://cpan.metacpan.org/authors/id/M/ ... .13.tar.gz
extract to `C:\Perl\cpan\build`
edit Wx-TreeListCtrl-0.13\cpp\treelistctrl.cpp
comment (//) the following line:
`wxTheApp->GetTraits()->ScheduleForDestroy(this);`
change the following line from:
`m_findStr.Append (event.GetKeyCode());`
to:
`m_findStr.Append ((const char *)event.GetKeyCode());`

open cmd and go to (cd) `C:\Perl\cpan\build\Wx-TreeListCtrl-0.13`
perl Makefile.PL
dmake
dmake install

# optional
# Only work in ppm
# Tk lib
install Tk

# Win32 GUI lib
install Win32::Console
install Win32::GUI

from here just use the build files described above
"ignorance is a blessing"

User avatar
alisonrag
Developers
Developers
Posts: 34
Joined: 30 Jun 2011, 12:25
Noob?: No
Location: Brazil

Re: Compiling OpenKore under Windows (WinXP/Win7)

#5 Post by alisonrag »

The following is just to install Wx in recent perl versions (5.32):

1) set path so powershell and wbem don't interfere (still needed for downloads to work):

Code: Select all

set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\Users\USER\bin;C:\WINDOWS\System32\OpenSSH\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\Users\USER\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;

2) do cpan install which will take over an hour(med fast pc in a VM) and spew _many_ errors and eventually fail (but all necessary files will download)

Code: Select all

C:\Users\USER>cpan -i Wx
# this will fail
#NOTE: every time you run this it generates
#a new Wx-0.9932-X dir and in it a new
#wxapi.h, so just run it once and let
#it complete..

3) edit the wxapi.h file to undef calloc

Code: Select all

cd C:\Strawberry\cpan\build\Wx-0.9932-0\cpp

Code: Select all

vi wxapi.h
paste:

Code: Select all

#undef calloc
after

Code: Select all

#undef malloc
4) do not run cpan -i Wx again!!! instead do the following
# go to build folder

Code: Select all

cd C:\Strawberry\cpan\build
# cpan look

Code: Select all

cpan look Wx
#go to wx folder

Code: Select all

cd C:\Strawberry\cpan\build\Wx-0.9932-0
# this generates make file necessary for following

Code: Select all

perl Makefile.pl
# install Wx in strawberry

Code: Select all

gmake install test
# everything that is touched by wxapi.h will be recompiled,
#it will take about 15 mins this time, all tests should pass

5) in cmd type

Code: Select all

cpan fforce notest install Wx::Perl::Packager
6) go to openkore folder and start openkore.pl with inteface Wx

Code: Select all

cd C:\openkore

Code: Select all

perl openkore.pl --interface=Wx
"ignorance is a blessing"

Locked