Page 1 of 2

Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 5:02 pm
by kenmo
Here is a place to get help with building the open source PureBasic IDE - focusing on the Windows version.

Feel free to post any problems or solutions, no matter how big or small :)


Anything I write in <Brackets> is just a placeholder for your real path.




First, refer to the repo's BUILD document. It says:
Create a copy of Window-x64.cmd or Window-x86.cmd and edit it
You should choose x86 or x64 depending on which version of the IDE you want to build, not what your own system is.
(That is, on 64-bit Windows you don't need to use the x64 cmd file.)
Change the PUREBASIC_HOME path to your main PB folder, such as C:\Programs\PureBasic, the x86 or x64 version depending on your selection.


Run the 'cmd' file, change to the ('cd PureBasicIDE') and run 'make'.
Possible errors:

Code: Select all

'make' is not recognized as an internal or external command, operable program or batch file.
1. Install UnxTools, which includes 'make' and many other tools
https://sourceforge.net/projects/unxutils/
2. Find your UnxTools 'wbin' folder, for example: <InstallPath>\UnxUtils\usr\local\wbin
3. Add this 'wbin' path to your PATH environment variable.
You can add it in your system's properties (do a web search, there are various ways)
or add it in your copied 'cmd' file:

Code: Select all

set UNXTOOLS_WBIN=<InstallPath>\UnxUtils\usr\local\wbin
set PATH=%UNXTOOLS_WBIN%;%PATH%


Code: Select all

make: *** No targets specified and no makefile found.  Stop.
You forgot to 'cd' into 'PureBasicIDE' :)


Code: Select all

makefile:252: warning: overriding commands for target `C:\Program'
makefile:247: warning: ignoring old commands for target `C:\Program'
makefile:252: warning: overriding commands for target `Files'
makefile:247: warning: ignoring old commands for target `Files'
...
cp: copying multiple files, but last argument ((x86)\PureBasic/Catalogs/ColorTable.xml) is not a directory
Your PUREBASIC_HOME path should not have spaces, this breaks the script.
Maybe this can be fixed with double-quoting or escape-characters throughout the 'cmd' file,
but it's easier to simply use a PureBasic installation path without spaces (no "Program Files"!)
EDIT: You can also cleverly use subst P: "c:\Program Files\PureBasic\" to alias your PB installation as P:\ (or try other path alias methods).
EVEN BETTER: Use Tristano's recommendation below, use Windows "short names" like C:\PROGRA~1\ to seamlessly work with space-less paths. Use dir /X to get the short names.


Code: Select all

'cl.exe' is not recognized as an internal or external command,
operable program or batch file.
The 'cl' tool cannot be found (it's part of the Visual Studio installation).
You should have Visual Studio and Windows Platform SDK installed.
BUILD recommends VisualStudio C++ 2013 and SDK Version 7.0.
Set your PB_VS8 path.
The 'cmd' script expects cl.exe in a <PB_VS8>\VC\bin folder.
In my case I have Visual Studio 2019 Community Edition, and I had to add this to the PATH: <ProgramFiles>\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\bin\Hostx86\x86
EDIT: I uninstalled newer Visual Studios, and installed the 2013 Community Edition. Then it worked with 'make' using the default defined subfolders.



Code: Select all

<...>/purebasic/Libraries\Debugger/DebuggerInternal.h(26): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory
This is where I am stuck now.
Like the 'cl.exe' issue above, it seems my paths don't match
(Using VS 2019 Community Edition and Windows 10 SDK.)
When I try to install 'Windows SDK for Windows 7 and .NET Framework 4' I get this error:
Some components cannot be installed
Some Windows SDK components require the RTM .NET Framework 4. <...> click Cancel, then install the .NET Framework 4 from http://go.microsoft.com/fwlink/?LinkID=187668 and then rerun Setup.
I installed the .NET Framework 4.8 Developer Pack from that link, same error occurs.
EDIT: I uninstalled all Visual Studio components, redistributables, SDKs, back to 2008 version, then I could install the Windows SDK 7.1 without error. (It still warned about a pre-release .NET Framework though.)

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 5:31 pm
by ChrisR
I didn't have any success with Windows 10 SDK too
So, I continued the installation of Windows 7 SDK despite the message on .Net Framework
And now it looks good for Make.

For the next step on PureBasic IDE.pbp, I had to change
Fred wrote:You need to define PureBasicPath$ to a purebasic installation in WindowsMisc.pb line 100

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 5:48 pm
by kenmo
I am not so lucky. If I skip the error message and continue to install, it fails after a bit saying:
Installation of the "Microsoft Windows SDK for Windows 7" product has reported the following error: Please refer to Samples\Setup\HTML\ConfigDetails.htm document for further information.

Please attempt to resolve the problem and then start Windows SDK setup again. If you continue to have problems with this issue, please visit the SDK team support page at http://go.microsoft.com/fwlink/?LinkId=130245.
I cannot refer to Samples\Setup\HTML\ConfigDetails.htm because it deletes everything in the Windows/v7.1 folder upon hitting the error, and the URL redirects to a generic developer page.

Maybe I will uninstall all the VS/SDKs I have and start fresh.

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 6:05 pm
by ChrisR
I forgot to write it but I did that too

https://stackoverflow.com/questions/314 ... up-failure
I had to uninstall the following:

"Microsoft Visual C++ 2010 x64 Redistributable"
"Microsoft Visual C++ 2010 x86 Redistributable"
Before installing the Windows 7.1 SDK, and the install package reinstalls those two during installation.
And the installation of windows 7 SDK was completed
Then change in Window-x64.cmd
set PB_PLATEFORM_SDK=C:/Program Files/Microsoft SDKs/Windows/v7.1

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 6:18 pm
by ChrisR
After Windows 7.1 SDK

I don't know if it was really required but according to Window-x64.cmd I also installed

Microsoft DirectX 9.0 SDK (December 2004)
Microsoft DirectX SDK (August 2009)
TortoiseSVN 1.13.1 - 64-bit

My change in Window-x64.cmd
set PB_PLATEFORM_SDK=C:/Program Files/Microsoft SDKs/Windows/v7.1
set PATH=%PB_DIRECTX9_SDK%/Utilities/bin/x86;C:\Program Files (x86)\UnxUtils\usr\local\wbin;C:\Program Files\TortoiseSVN\bin;%PATH%
cd PureBasicIDE <= before cmd

And in WindowsMisc.pb
PureBasicPath$ = "E:\PureBasic\PureBasic_5.71_x64\" ; Line 100 + added in Line 104 to be able to create pbide.exe

Also, In compiler option, constantes tab:
#BUILD_DIRECTORY=E:\PureBasic\Purebasic-master_2019-10-12\Build\x64\ide\
#PureBasicPath=E:\PureBasic\PureBasic_5.71_x64\

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 8:00 pm
by kenmo
Thanks for that extra info! I will update the original post.

I aggressively uninstalled any Visual Studio or Windows SDK components I had (back to 2008 version) and was now able to install the Windows SDK 7.1 successfully.

But in doing that, I uninstalled my Visual Studio, so cl.exe was missing again :lol:
This time I installed the 2013 Community Edition so that my VS subfolders matched the cmd script.
(To download the 2013 edition I had to sign in, and join the free "Visual Studio Dev Essentials" program.)



Now I can run 'make' and open 'PureBasic IDE.pbp'.

Code: Select all

The target 'Default Target' for this Project has no output executable file.
Add an executable name to the project's Compiler Options, of course.

Code: Select all

Line 35: File not found (C:\PureBasic\GitHub\purebasic\Build\x64\ide\BuildInfo.pb).
Compiler Options > Constants
Set #BUILD_DIRECTORY=<your repo path>\Build\x86\ide\ (use x64 for 64-bit build)
Set #PureBasicPath=<your PureBasic install path>\


Thanks for this ChrisR.

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 8:08 pm
by IceSoft
kenmo wrote:

Code: Select all

Line 35: File not found (C:\PureBasic\GitHub\purebasic\Build\x64\ide\BuildInfo.pb).
It is visible after starting the "make". Which should be one of the first step before you work on PB_IDE directly.

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 8:15 pm
by kenmo

Code: Select all

[14:09:00] [ERROR] PureBasic.pb (Line: 278)
[14:09:00] [ERROR] The specified #Window is not initialised.
Open WindowsMisc.pb, and around Line 100, define PureBasicPath$ to your installation, such as

Code: Select all

PureBasicPath$ = #PureBasicPath
Thanks to Fred for that tip. viewtopic.php?p=545923#p545923


Now the IDE builds and runs with the Debugger ON.
With the Debugger OFF, launched from the IDE, I get the error:
Cannot initialize Scintilla Engine!
Make sure the 'Scintilla.dll' is placed in the 'Compilers' subdirectory of your PureBasic setup.
EDIT: OK, this is really a non-problem.
When you have the Debugger on, PureBasicPath$ is defined to your existing PB installation, so it finds Scintilla.dll.
When you have the Debugger off (for example, building a public release) PureBasicPath$ is not pre-defined, so it looks for <Current Dir>\Compilers\Scintilla.dll
(It only looks there, not even in the <Current Dir>, it expects to be within a PB installation.)
The solution is simple, copy Scintilla.dll into <Your Repo>\PureBasicIDE\Compilers\ for testing. (Do not commit the DLL to the repo!)

Re: Compiling the PureBasic IDE on Windows

Posted: Tue Dec 10, 2019 9:48 pm
by ChrisR
Good you were able to go to the end.
It is not really easy with the different config win7, win10
kenmo wrote: With the Debugger OFF, launched from the IDE, I get the error:
Cannot initialize Scintilla Engine!
Make sure the 'Scintilla.dll' is placed in the 'Compilers' subdirectory of your PureBasic setup.
To work around, I moved line 100

Code: Select all

PureBasicPath$ = #PureBasicPath   ;(would be good to have it in the git repository)
To line 104 after the CompilerEndIf

With that pbide.exe is well created.
And to be more friendly, I extracted PureBasic.ico to the root of Purebasic-master to use it during compilation

Re: Compiling the PureBasic IDE on Windows

Posted: Thu Dec 12, 2019 5:06 pm
by kenmo
ChrisR wrote:To work around, I moved line 100

Code: Select all

PureBasicPath$ = #PureBasicPath   ;(would be good to have it in the git repository)
To line 104 after the CompilerEndIf
Now that I took a better look at the code, I don't recommend moving that line.


For debugging ease, that line pre-defines PureBasicPath$ to your own personal PB install path. It's hard-coded in the resulting exe.

For non-debug builds, it doesn't include your personal path, but it DOES expect to be in a valid PB folder with a Compilers subdirectory.

Better fix is to just copy Scintilla.dll into <Your Repo>\PureBasicIDE\Compilers\ so that it finds it when you run.


I edited my previous post about this.

Re: Compiling the PureBasic IDE on Windows

Posted: Fri Dec 13, 2019 6:10 pm
by ChrisR
kenmo wrote: Better fix is to just copy Scintilla.dll into <Your Repo>\PureBasicIDE\Compilers\ so that it finds it when you run.
I understand, thanks :)


For the problem when Installing Microsoft Windows 7.1 SDK for Windows 7
Some components cannot be installed - Some Windows SDK components require the RTM .Net Framework 4.
Setup detect a pre-release version... these components will not be installed...

On Windows 10 x64, the setup is blocked by:

Code: Select all

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full\Version
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client\Version
Change both values temporarily to 4.0.30319 - the RTM .Net Framework 4

Image

Re: Compiling the PureBasic IDE on Windows

Posted: Fri Dec 13, 2019 6:20 pm
by ChrisR
To help with the installation and if you need, I have created a batch

Image

BuildPBide.cmd (Edit 2019/12/17 typo)

Code: Select all

@Echo off
Color 17
set "params=%*"
setlocal EnableDelayedExpansion
cd /d "%~dp0" && ( If exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || (  Echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
%windir%\system32\reg.exe query "HKU\S-1-5-19" 1>nul 2>nul || (
Echo ============================================================
Echo ERROR: Run The Script As Administrator.
Echo ============================================================
Echo.
Echo.
Echo Press any key to exit...
pause >nul
Goto :eof
)

Cd /D %~dp0

:menu
Title Build PureBasic OpenSource Projects (helper)
Cls
Set Userinp=
Echo.
Echo ===============================================================================
Echo.
Echo.  Press 1 -  Download PureBasic OpenSource Projects
Echo.  Press 2 -  Download UnxUtils a collection of the most important GNU utilities ported to Windows
Echo.  Press 3 -  Download MicrosoftVisual Studio Community 2013 with Update 5
Echo.  Press 4 -  Download Microsoft Windows 7.1 SDK for Windows 7 and .NET Framework 4
Echo.
Echo. On Windows 8, 10 if you have the message:
Echo.   Some components cannot be installed - Some Windows SDK components require the RTM .Net Framework 4...
Echo. Use the following Options 5, 6 and 7
Echo.
Echo.  Press 5 -  Uninstall Visual C++ 2010 Redistributable before Installing Windows 7.1 SDK that reinstalls them
Echo.  Press 6 -  Download SetACL 3.0.6 EXE version
Echo.  Press 7 -  Patch NET Framework Setup version registry to RTM version and Install Microsoft Windows 7.1 SDK for Windows 7
Echo.
Echo.  Press 8 -  Information : Tune the launch script, Launch the makefile...
Echo.
Echo.  Press 0 -  Exit
Echo ===============================================================================
Echo.
Set /p Userinp= ^> Enter Your Option:
If [%Userinp%]==[] Echo.&Echo Invalid User Input&Echo.&Pause&Goto :Menu
If %Userinp% gtr 8 Echo.&Echo Invalid User Selection&Echo.&Pause&Goto :Menu
If %Userinp%==0 Goto :Done
If %Userinp%==1 Goto :opt1
If %Userinp%==2 Goto :opt2
If %Userinp%==3 Goto :opt3
If %Userinp%==4 Goto :opt4
If %Userinp%==5 Goto :opt5
If %Userinp%==6 Goto :opt6
If %Userinp%==7 Goto :opt7
If %Userinp%==8 Goto :opt8
Goto :eof

:Done
Exit

:opt1
Cls
Echo Download PureBasic OpenSource Projects
Echo.
Echo Choose Clone or Download then Download ZIP
Echo Extract purebasic-master.zip to the folder of your choice
Echo.
Start https://github.com/fantaisie-software/purebasic
Pause
Goto :Menu

:opt2
Cls
Echo Download UnxUtils a collection of the most important GNU utilities ported to Windows
Echo.
Echo Extract UnxUtils.zip to the folder of your choice (ex: C:\Program Files (x86)\UnxUtils)
Echo Add ^<UnxUtilsInstallPath^>\usr\local\wbin to your PATH
Echo (ex: Set PATH=C:\Program Files (x86)\UnxUtils\usr\local\wbin;^%PATH^%)
Echo.
Start https://sourceforge.net/projects/unxutils/
Pause
Goto :Menu

:opt3
Cls
Echo Download Visual Studio Community 2013 with Update 5
Echo.
Echo Choose 2013 then Download. In the new page Download Visual Studio Community 2013 avec Update 5 (x86 english)
Echo (You had to sign in, and join the free "Visual Studio Dev Essentials" program)
Echo Install Visual Studio Community 2013 with Update 5
Echo.
Start https://visualstudio.microsoft.com/vs/older-downloads/#visual-studio-2013-and-other-products
Pause
Goto :Menu

:opt4
Cls
Echo Download Microsoft Windows 7.1 SDK for Windows 7 and .NET Framework 4
Echo.
Echo Install Microsoft Windows 7.1 SDK for Windows 7
Echo.
Echo On Windows 8, 10 if you have the message:
Echo   Some components cannot be installed - Some Windows SDK compopnents require the RTM .Net Framework 4.
Echo   Setup detect a pre-release version... these components will not be installed...
Echo Then, choose option 5 - Uninstall Visual C++ 2010 Redistributable before Installing Windows 7.1 SDK that reinstalls them
Echo Option 6 - Download SetACL 3.0.6 EXE version
Echo And option 7 - Patch NET Framework Setup version registry and Install Microsoft Windows SDK for Windows 7
Echo.
Start https://www.microsoft.com/en-us/download/details.aspx?id=8279
Pause
Goto :Menu


:opt5
Cls
Echo Uninstall Visual C++ 2010 Redistributable before Installing Windows 7.1 SDK that reinstalls them
Echo.
::UninstallString for Microsoft Visual C++ 2010 x86 Redistributable - 10.0.30319
For /f "tokens=2*" %%a in ('Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{196BB40D-1578-3D01-B289-BEFC77A11A1E}" /v UninstallString /reg:32 2^>nul') Do Set "UninstallVC2010x86=%%~b"
If Defined UninstallVC2010x86 (
  Echo Uninstall Microsoft Visual C++ 2010 x86 Redistributable - 10.0.30319
  Echo %UninstallVC2010x86%
  Echo.
  %UninstallVC2010x86%
)

::UninstallString for Microsoft Visual C++ 2010 x64 Redistributable - 10.0.303194
For /f "tokens=2*" %%a in ('Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{DA5E371C-6333-3D8A-93A-6FD5B20BCC6E}" /v UninstallString 2^>nul') Do Set "UninstallVC2010x64=%%~b"
If Defined UninstallVC2010x64 (
  Echo Uninstall Microsoft Visual C++ 2010 x64 Redistributable - 10.0.30319
  Echo %UninstallVC2010x64%
  Echo.
  %UninstallVC2010x64%
)

::UninstallString for Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219
For /f "tokens=2*" %%a in ('Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}" /v UninstallString /reg:32 2^>nul') Do Set "UninstallVC2010SP1x86=%%~b"
If Defined UninstallVC2010SP1x86 (
  Echo Uninstall Microsoft Visual C++ 2010 SP1 x86 Redistributable - 10.0.40219
  Echo %UninstallVC2010SP1x86%
  Echo.
  %UninstallVC2010SP1x86%
)

::UninstallString for Microsoft Visual C++ 2010 x64 Redistributable - 10.0.40219
For /f "tokens=2*" %%a in ('Reg Query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1D8E6291-B0D5-35EC-8441-6616F567A0F7}" /v UninstallString 2^>nul') Do Set "UninstallVC2010SP1x64=%%~b"
If Defined UninstallVC2010SP1x64 (
  Echo Uninstall Microsoft Visual C++ 2010 SP1 x64 Redistributable - 10.0.40219
  Echo %UninstallVC2010SP1x64%
  Echo.
  %UninstallVC2010SP1x64%
)

Pause
Goto :Menu

:opt6
Cls
Echo Download SetACL 3.0.6 EXE version
Echo.
Echo Extract SetACL.exe in the same folder, next to this batch
Echo.
Start https://helgeklein.com/download/
Pause
Goto :Menu

:opt7
Cls
Echo Patch NET Framework Setup version registry to RTM version and Install Microsoft Windows 7.1 SDK for Windows 7
Echo.
Echo The current registry keys of the NET Framework Setup version will be saved
Echo Take Ownership and Full Access on NET Framework Setup registry key
Echo Change NET Framework Setup version registry to RTM version (4.0.30319)
Echo Install Microsoft Windows 7.1 SDK for Windows 7
Echo Restore NET Framework Setup registry keys, Owner and Rights
Echo.

If %PROCESSOR_ARCHITECTURE%==x86 (
  Echo.
  Echo This option is only available for x64 Architecture
  Echo.
  Pause
  Goto :Menu
)
If Not Exist %~dp0SetACL.exe (
  Echo.
  Echo SetACL.exe not found in the same folder, next to this batch
  Echo Use option 6 first to Download SetACL 3.0.6 EXE version
  Echo.
  Pause
  Goto :Menu
)

For /f "tokens=2*" %%a in ('Reg Query "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client" /v Version /reg:32') Do Set "CurrentNDPv4ClientVersion=%%~b"
For /f "tokens=2*" %%a in ('Reg Query "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" /v Version /reg:32') Do Set "CurrentNDPv4FullVersion=%%~b"

:: Administrator SID S-1-5-32-544 - EveryOne SID S-1-1-0
SetACL.exe -on "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" -ot reg -actn setowner -ownr "n:S-1-5-32-544;s:y" -rec Yes
SetACL.exe -on "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" -ot reg -actn ace -ace "n:S-1-5-32-544;p:full;s:y" -rec Yes

Reg Add "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" /v Version /t REG_SZ /d 4.0.30319 /reg:32 /f
Reg Add "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client" /v Version /t REG_SZ /d 4.0.30319 /reg:32 /f

Echo Start Microsoft Windows SDK for Windows 7 Installer now
Pause

Reg Add "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client" /v Version /t REG_SZ /d %CurrentNDPv4ClientVersion% /reg:32 /f
Reg Add "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full" /v Version /t REG_SZ /d %CurrentNDPv4FullVersion% /reg:32 /f

:: Get "NT SERVICE\TrustedInstaller" SID
For /F "tokens=4*" %%a IN ('sc.exe Showsid TrustedInstaller') Do Set "TrustedInstallerSID=%%a"

SetACL.exe -on "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" -ot reg -actn setowner -ownr "n:%TrustedInstallerSID%;s:y" -rec Yes
SetACL.exe -on "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" -ot reg -actn ace -ace "n:%TrustedInstallerSID%;p:full;s:y" -rec Yes
:: System SID (Not NT SERVICE\TrustedInstaller)
::SetACL.exe -on "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" -ot reg -actn setowner -ownr "n:S-1-5-18;s:y" -rec Yes
::SetACL.exe -on "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4" -ot reg -actn ace -ace "n:S-1-5-18;p:full;s:y" -rec Yes

Pause
Goto :Menu

:opt8
Cls
Echo Information : Tune the launch script, Launch the makefile...
Echo.
Echo Create a copy of "Window-x64.cmd" or "Window-x86.cmd" and edit it:
Echo Set PUREBASIC_HOME to a working PureBasic installation and Check All the other paths
Echo Run Window-x64.cmd and go in PureBasicIDE directory (cd PureBasicIDE) and Type: Make
Echo To compile all the dependencies and the IDE. A 'Build' directory will be created with all temporary files in it.
Echo.
Echo You can then use PureBasic to open the "PureBasic IDE.pbp" project file and run it from PureBasic itself
Echo Adjust the constants in Compilers Options, Contants tab
Echo The #BUILD_DIRECTORY constant must point to the Build/x64/ide/ folder created before by the 'make'
Echo The #PureBasicPath constant must point to a full PureBasic installation.
Echo.
Echo Open WindowsMisc.pb and in Line 100, define PureBasicPath$ to your installation
Echo PureBasicPath$ = #PureBasicPath
Echo Thus, with the debugger On, it finds Scintilla.dll and use the Scintilla Engine
Echo.
Echo With Debugger Off (ex: to create PBide.exe) PureBasicPath$ is not pre-defined, so it looks for ^<Current Dir^>\Compilers\Scintilla.dll
Echo Copy Scintilla.dll into ^<Your Repo^>\PureBasicIDE\Compilers\ for testing. (Do not commit the DLL to the repo!)
Echo.
Pause
Goto :Menu

Re: Compiling the PureBasic IDE on Windows

Posted: Sat Dec 14, 2019 9:26 pm
by kenmo
ChrisR wrote:On Windows 10 x64, the setup is blocked by:

Code: Select all

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Full\Version
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\v4\Client\Version
Change both values temporarily to 4.0.30319
:shock: Thank you ChrisR. I got the repo building on a second Windows system (Win 7) and had even more trouble than the first (Win 10).

Once again I had to aggressively uninstall Microsoft components (VS, SDK, redistributables) until I could install SDK 7.1 successfully.

The SDK installation kept failing until I tried your temporary registry edit - it worked! I don't know how you figured that out, or what it's really solving, but it works, thank you!

Re: Compiling the PureBasic IDE on Windows

Posted: Mon Dec 16, 2019 6:10 pm
by Tristano
Thanks for this thread, it’s much needed as anything relating to using MSVS products on Windows is always an endless nightmare of troubleshooting and hacks — one would expect that Visual Studio (one of the best MS products after XBox) should install flawlessly under Windows, but that’s not the case.

I’m stuck with the Win 10 SDK, which I need for languages like Rust and Nim, so uninstalling it is not an option. My hope is to find a way to compile the IDE under Win 10 SDK (although it would be much better if the precompiled binaries of those couple of C components would be added to the repository, after all users are interested in the PB code of the IDE, not the C part).

A few comments on a couple of things that came up in this thread.

Paths Containing Spaces

Make and other Linux tools will break when presented with paths containing spaces, which are the norm when it comes to installed apps on Windows.

The quick workaround to this is using the short paths from the DOS era, which you can obtain via the /X option in the DIR command.

Code: Select all

C:\>DIR /X prog*

11/12/2019  04:21    <DIR>          PROGRA~1     Program Files
10/11/2019  14:05    <DIR>          PROGRA~2     Program Files (x86)

From the above we learn that instead of Program Files we can use PROGRA~1, and instead of Program Files (x86) we can use PROGRA~2. Since short paths never contain spaces we are able to provide Unix tools with valid paths.

About UnxUtils

Today I’ve looked into UnxUtils, as I always do before even considering installing something on my PC, and what I discovered didn’t please me at all. See my recent Issue on this:
The UnxUtils are extremely outdated, having been created between 1999 and 2003, which means they were targeting Windows 95 or XP (most were compiled using MS VC 5.0). These tools represent a huge security hole for any PC, and in any case the tools of that package are really lagging behind their Unix counterparts. From what I read on SourceForge comments, many don’t even work as expected, other are simply broken.

The point is that we surely don’t need all 123 of the UnxUtils tools to build the IDE, and most of those that we do need are going to be available either on Win 10 natively, or in the Bash that comes with Git installation. So, probably we’d be missing only the Make tools for our needs — which you’ll already have if you’ve installed MinGW for any reasons, except that it’s renamed as mingw32-make.exe, but you only need a symlink to make it work.

Anyhow, finding updated versions of the GNU tools ported to Windows is not a problem, there are many versions in the wild to choose from — but UnxUtils? no thanks.

(the UnxUtils package doesn’t even contain a copy of the GPL license — which says it all on the commitment of its author toward the GNU philosophy)

Using the MSVC Build Tools Instead

Why install the whole Visual Studio package (which is huge) when all we need is available in the Build Tools distributions? For recent versions of MSVS Microsoft always provides a separate Build Tools distribution:
You can install multiple Build Tools on the same machine without conflicts, because to use them you must run a batch file that sets all the env vars to make its tools accessible, so they are effectively isolated tools.

Of course, you still need to install the correct SDK for the Build Tools, and as far as I know you can’t install multiple SKDs on the same machine.

DirectX SDK: Needed?

As @kenmo pointed out, are these really needed?
  • Microsoft DirectX 9.0 SDK (December 2004)
  • Microsoft DirectX SDK (August 2009)
I can’t see them in the Win 10 SDK, so I was hoping that they are not strictly necessary for building the IDE. (does the IDE use DirectX anywhere?)

The RTM .Net Framework 4 Error

Failure to install Win 7 SDKs due to the RTM .Net Framework 4 error is a known issue that always pops up on the Internet. The registry hack is a bad solution, and I stronly advice against it! While searching this error I’ve also found the registry hack solution proposed many times, but it’s really a quick-and-dirty solution that became popular because it seems to solve the problem at root. I’ve found many contradicting opinions and solution regarding this problem, but ultimately I did manage to find some good solutions too.

The truth is that it’s a rather simple problem which requires a clean solution.

The problem is that the SDK installer find a more recent version on the machine (.NET Framework 4.5, which is bundled with Windows), so the SDK installer abort with error. The solution is uninstalling the .NET Framework 4.5 and let the SDK install the older (deprecated) version — once you’ve installed the SDK and you update it, version 4.5 is reinstalled automatically.

For a good tutorial on how to install the Win 7.1 SDK without crazy hacks that expose your machine to a Blue-Screen-of-Death time-bomb countdown, see this article:
The Batch Helper

@ChrisR, that of creating a batch script to help with the installation is a good idea. I was looking at your script and noticed that it requires privileges elevation to run as Admin.

What worries me is that besides installing and uninstalling package it also unpacks archives, which means that those files and folder will be owned by Admin, and may behave unexpectedly under normal privileges conditions.

Wouldn’t it be better to only launch sub shells with Admin permission when strictly required, and keep the base script running normally?

Personally, I was thinking of writing a Bash script, on the assumption that end user will have installed Git and surely have a Bash. You get all the Windows tools plus the Bash tools, and you can write more flexible scripts.

But maybe the best solution is creating a PureBasic program that can handle all the various compilation settings and either generate a customized build script or directly handle all the build process, including invoking Make. After all, this is a PB project, so it would be the easiest solution for end user, covering all three platforms.

Re: Compiling the PureBasic IDE on Windows

Posted: Mon Dec 16, 2019 8:00 pm
by kenmo
Good advice!

Using Windows short names to avoid spaces is a much simpler and cleaner solution than moving your PB installation, or playing with the subst command.

MSVC Build Tools... that would have saved me some time :)