## Compiling the PureBasic IDE on Windows

Working on new editor enhancements?
ChrisR
Enthusiast
Posts: 246
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

### Re: Compiling the PureBasic IDE on Windows

Tristano wrote:@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
The batch was done quite quickly (copy/paste), just a little start and it needs improvement or to do it differently, or with other tools...
I don't use Bash, is it also available on Windows 7 ?
Just my 2 cts, be free, no worries

In the batch Set as Admin is done automatically, it is required for SetACL to grant rights on registry keys to be able to change the NET Framework Setup version values. The original values are saved and then restored and the rights are also restored.
Personally I prefer this tiny hack rather than uninstall .NET Framework 4.5 and reinstall it and update it to 4.8
For the rest Admin is not required but at the same time there is no installations in the batch, only the uninstall of Visual C++ 2010, they are reinstalled then by windows 7.1 SDK

#
Otherwise, I confirm that DirectX SDK is not required [Microsoft DirectX 9.0 SDK (December 2004) - Microsoft DirectX SDK (August 2009)]
I think they can be removed from Window-x64(x86).cmd

#
Tristano wrote: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).
Yes, it would indeed be good
Last edited by ChrisR on Tue Dec 17, 2019 3:28 am, edited 1 time in total.
ChrisR
Enthusiast
Posts: 246
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

### Re: Compiling the PureBasic IDE on Windows

Tristano wrote: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.
In UnxUtils, only make.exe, pwd.exe, rm.exe, touch.exe and zip.exe are required and also cp.exe for Window-x86.cmd.
Dependencies seen with procmon and I tested Make with only these one, it works

To replace UnxUtils, dependencies can be downloaded from gnuwin32 (same dependencies are required)

Make for Windows: http://gnuwin32.sourceforge.net/packages/make.htm
Binaries: http://gnuwin32.sourceforge.net/downlin ... in-zip.php (make.exe)
Dependencies: http://gnuwin32.sourceforge.net/downlin ... ep-zip.php (libiconv2.dll, libintl3.dll)

CoreUtils for Windows: http://gnuwin32.sourceforge.net/packages/coreutils.htm
Binaries: http://gnuwin32.sourceforge.net/downlin ... in-zip.php (cp.exe, pwd.exe, rm.exe, touch.exe)
Dependencies: coreutils-dep-zip not required, already exist in make-dep-zip and more up to date (http://gnuwin32.sourceforge.net/downlin ... ep-zip.php)

Zip for Windows: http://gnuwin32.sourceforge.net/packages/zip.htm

If you have 7-zip, you can use this small batch to extract the required files

Code: Select all

@Echo Off
cd /d %~dp0

Set _7zexe="C:\Program Files\7-Zip\7z.exe"

If Not exist %_7zexe% Echo Define the path to 7z.exe && Pause && Goto :eof

%_7zexe% e make-3.81-bin.zip bin\make.exe -o"%~dp0bin" -y
%_7zexe% e make-3.81-dep.zip bin\lib*.dll -o"%~dp0bin" -y

%_7zexe% e coreutils-5.3.0-bin.zip bin\cp.exe bin\pwd.exe bin\rm.exe bin\touch.exe -o"%~dp0bin" -y

%_7zexe% e zip-3.0-bin.zip bin\zip.exe -o"%~dp0bin" -y
%_7zexe% e zip-3.0-dep.zip bin\bzip2.dll -o"%~dp0bin" -y
pause
I have tested, Make works then

Edit: added cp.exe required for Window-x86.cmd
ChrisR
Enthusiast
Posts: 246
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

### Re: Compiling the PureBasic IDE on Windows

I added Windows 10 SDK support in Window-x64(x86).cmd
See Github Issue #32
Tristano
Enthusiast
Posts: 191
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

### Re: Compiling the PureBasic IDE on Windows

Thanks for all the replies and dedication.
ChrisR wrote:I don't use Bash, is it also available on Windows 7 ?
No not natively, but when you install Git for Windows it also installs a full Bash (the mintty version, which is the standard nowadays, used also by MSYS2, Microsoft WSL, and others).

https://mintty.github.io/

The Git Bash has all the required tools you mentioned except Make and Zip. These tools are just .exe files living in a subfolder of the Git installation, and can be used from the CMD by copying them (and required DLLs, if any) into a separate folder which is (or is made) on the PATH. By copying the LICENSE files, it should be OK to create our own ZIP package for distribution, to help with this build.

I have 7-Zip installed, with the CLI version on the path, but adding the one you indicated is not a problem at all, and can always come handy.

By the way, the best way to install Git under Windows is via Chocolatey GUI, which then makes it easier to keep it updated:

https://chocolatey.org/packages/git

Probably you can install also the various GNU tools via Chocolatey, for there are tons of packages (especially those which don't have installers).

Using Make from the UnxTools should be safe, the problem is the lack of GPL license in UnxTools (and that is old).

I've started looking into CMake right now, which would allow a single configuration for all OSs, and all different VC compilers and SDK versions.

https://cmake.org/

CMake has enough presets to auto-magically handle the different MSVS and VC distributions under Windows. The hard part is going to be adding the custom PB tools from the toolchain (i.e. hard for me that I never programmed in CMake — it's a real configuration language, not just a syntax). It might be worth the effort though, because we could even create and add support for a dedicated PureBasic build engine to CMake. Unfortunately, the documentation is quite big, and rather dry and technical, so it's not going to happen overnight. Also, I have the impression that currently it's all very much focused on C++ and C#, although documentation toolchains were also added. The project was designed to be OS and architecture agnostic, and extensible, so all the tools are there, and the idea of creating a dedicate PureBasic/SpiderBasic engine (or backend, what you want to call it) for CMake is not far fetched, it's even encouraged.

@ChrisR, I use batch scripting now and then but it's really limited and limiting, I think that PowerShell scripts would give you better control over this type of operatrions, especially regarding admin permissions. I don't use (nor like) PowerShell, but it is indeed more powerful than batch scripts and more flexible.

If I have understood correctly, the path to a PB installation that is set in the build script(s) is then used to build the fresh IDE there — i.e. overriding the original.
The problem with the current system that I see is that users have to tweak the scripts to provide their own paths, which is not OK in Git versioned control projects.

Couldn't the script just look for the currently installed PB versions under %PROGRAMFILES% and %PROGRAMFILES(X86)%, copy the full folder contents to the BUILD directory and use these as the reference PB setups? We can safely assume that users are interested in building the IDE with and for the current version of PB, which they should have already installed on their system (both x86 and x64, in case of x64 machines). So why not exploit this in the script and make the whole build simpler? (right now, it's all very complicate, unless you have the old SDK and VC installed).
The PureBASIC Archives:
FOSS Resources:
dcr3
Enthusiast
Posts: 114
Joined: Fri Aug 04, 2017 11:03 pm

### Re: Compiling the PureBasic IDE on Windows

Hi. Has anyone came across this ,and how did you solved it.

make: *** No rule to make target
C:\..\..\PureBasicIDE/Libraries/Debugger/DebuggerInternal.h'
, needed by
C:\..\..\PureBasicIDE/Build/x64/ide/NetworkSupport.obj'. Stop.
Tristano
Enthusiast
Posts: 191
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

### Re: Compiling the PureBasic IDE on Windows

dcr3 wrote:Hi. Has anyone came across this ,and how did you solved it.

make: *** No rule to make target
C:\..\..\PureBasicIDE/Libraries/Debugger/DebuggerInternal.h'
, needed by
C:\..\..\PureBasicIDE/Build/x64/ide/NetworkSupport.obj'. Stop.
Yes, I did encounter this error — I don't remember exactly why and how it was solved, but if I remember correctly it was due to either spaces in the paths or mixing foward- and back-slashes in file paths assigned to env vars (which somehow corrupted strings passed to Make, which resulted in searching for Makefiles in the wrong folder). But I'm not 100% sure, because then I started to use the new scripts by ChrisR instead, which come with better commented instructions and dual SDK support.

Please try out the new scripts by ChrisR:

https://github.com/ChrisRfr/purebasic/b ... ow-x64.cmd
https://github.com/ChrisRfr/purebasic/b ... ow-x86.cmd

Also, there's now a dedicated Wiki page to troubleshooting Windows related problems:

https://github.com/fantaisie-software/purebasic/wiki

So if you encounter problems and find solutions it would helpful if you could add them to the Wiki page.
The general idea is that for problems discussed on the thread, the findings and solutions could then be resumed on the Wiki.
The PureBASIC Archives:
FOSS Resources:
Zebuddi123
Enthusiast
Posts: 767
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

### Re: Compiling the PureBasic IDE on Windows

@dcr3 me also and if I remember correctly it was spaces or slash's as with Tristano. My work through was basically at every make call I would us
Make -dk >some.txt or just Make -dk
and tracking the Make fail points to find the correct paths that were Missing.

Zebuddi.
malleo, caput, bang. Ego, comprehendunt in tempore
kenmo
Posts: 1890
Joined: Tue Dec 23, 2003 3:54 am

### Re: Compiling the PureBasic IDE on Windows

I've mainly been building the IDE on:
Windows 7 and 10
x86 build
MS Visual Studio 12.0
Windows SDK v7.1

It all builds OK.

When I try to build the x64 IDE, using the x64 cmd file, with all else remaining the same, the last step of the make file (pbcompiler) fails with:

Code: Select all

Error: Linker
POLINK: warning: Invalid machine type in object 'NetworkSupport.obj'.
POLINK: error: Unresolved external symbol '_Network_Listen'.
POLINK: error: Unresolved external symbol '_Network_CheckAccept'.
POLINK: error: Unresolved external symbol '_Network_CheckData'.
POLINK: error: Unresolved external symbol '_Network_SendString'.
POLINK: error: Unresolved external symbol '_Network_SendData'.
POLINK: error: Unresolved external symbol '_Network_CloseSocket'.
POLINK: error: Unresolved external symbol '_Network_ConnectSocketStart'.
POLINK: error: Unresolved external symbol '_Network_ConnectSocketCheck'.
POLINK: error: Unresolved external symbol '_Network_Initialize'.
POLINK: error: Unresolved external symbol '_Network_CreateSocket'.
POLINK: error: Unresolved external symbol '__imp_select'.
POLINK: error: Unresolved external symbol '__imp_accept'.
POLINK: error: Unresolved external symbol '__imp_setsockopt'.
POLINK: error: Unresolved external symbol '__imp_closesocket'.
POLINK: error: Unresolved external symbol '__imp_getsockopt'.
POLINK: error: Unresolved external symbol '__imp_ioctlsocket'.
POLINK: error: Unresolved external symbol '__imp_gethostbyname'.
POLINK: error: Unresolved external symbol '__imp_htons'.
POLINK: error: Unresolved external symbol '__imp_connect'.
POLINK: error: Unresolved external symbol '__imp_WSAGetLastError'.
POLINK: error: Unresolved external symbol '__imp_socket'.
POLINK: error: Unresolved external symbol '__imp_WSAStartup'.
POLINK: error: Unresolved external symbol '__imp_bind'.
POLINK: error: Unresolved external symbol '__imp_listen'.
POLINK: error: Unresolved external symbol '__imp_recv'.
POLINK: error: Unresolved external symbol '__imp_send'.
POLINK: error: Unresolved external symbol 'strlen'.
POLINK: fatal error: 29 unresolved external(s).
make: *** [ide] Error 1
Anyone know why this happens or how to fix?
Tristano
Enthusiast
Posts: 191
Joined: Thu Nov 26, 2015 6:52 pm
Location: Italy
Contact:

### Re: Compiling the PureBasic IDE on Windows

The error:

Code: Select all

Error: Linker
POLINK: warning: Invalid machine type in object 'NetworkSupport.obj'.
POLINK: error: Unresolved external symbol '_Network_Listen'.
seems to indicate that one of the C components is being compiled for x86 instead of x86_64 (the rest are just the consequences of the failed linkage).

Have you deleted all the files in the build folder before compiling again? Sometimes these errors are due to the toolchain seeing some previously compiled binaries and skipping the compilation (so you end up reusing the 32-bit object files in the 64-bit build).

In these days I have flue and am not spending much time at the PC, but when I get better I'll look into it.

Also ... thanks for the binaries! (really needed them)
The PureBASIC Archives:
FOSS Resources: