Implemented Looking at improving GLFW build system

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Likes
427
Location
Germany
#22
Great job dawlane! Please don't forget the documentation. I can do it but would have to study the changes first. Which I don't mind.
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#23
Please don't forget the documentation.
Unlike Mr S. I start there first.

Let me know at what point you think you're "done" to merge your changes
Artists say that no great work is ever truly ever finished. So when I'm close to perfection I will let you know.:)

Up to press I've moved the third party code in to the new libs directory, supplied a makefile to build the core code into a static library (not OpenAL because of licence issues), modified the Linux gcc makefile to do a two stage build, i.e. runs the makefile to build the static liibrary, then to build the main application. Subsequent builds for all project would no long have to build their own versions of the third part stuff.
The Windows gcc makefile should be just a straight forward conversion of the Linux one.

I'm hoping that Visual Studio and Xcode project files can be modified to doe the same sort of job, or all this was a wasted effort. One of my main concerns is Xcode. I cannot up grade my iMac to the latest version of OS X and there for XCode, so I will be stuck to using the last version of Xcode that was released.
 

Martin

Administrator
Staff member
Joined
Jun 19, 2017
Likes
147
Location
Germany
#24
Thanks! By the way MSBuild works on my side again but I haven't added that curl stuff there yet. Have you already?
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#25
I haven't looked at any VS project stuff yet or Xcode, forgot how awkward working with makefile can be doing cross platforms. It doesn't help that I haven't done that sort of thing in around 7 years and what Linux make would do automatically, MinGW-32-make doesn't.

The I got curl working with GCC as it would have been a bit daft not implementing the changes that I was aiming for.

VS2017 uses a different method to detect where MSBuild is located. There's a tool mentioned somewhere on the MS site for it. I think that there is a link that I posted to it in one of the other posts. I think that there need to be a poll on the current use of Visual Studio versions to tidy up the code and get rid of some dead wood. Or a different approach on with having multiple solution files.
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#26
A small update on what I've been up to.
I've altered the directory structure of new libs directory. It now looks like this:
Cerberus
libs
licences
shared
Linux32 <<<< TO DO
Linux64 <<<< TO DO
MacOS
Win32
Win64​
staticlibs <<<< Created of the fly
gcc_Linux32
gcc_Linux64
gcc_Win32
gcc_Win64
macos
vs20xx_xx <<<< proposed​
src
curl
glfwgame
glfw3
stb​
obj <<<< Created on the fly
gcc_win32/64
gcc_linu32/64
gcc_macos32/64​
openal​

There are makefiles in the src directory to build the sources.
And here's a snippet of the transcc glow build for Xcode.
Code:
'***** Xcode *****
    Method MakeXcode:Void()

        CreateDataDir "xcode/data"

        Local main:=LoadString( "main.cpp" )
  
        main=ReplaceBlock( main,"TRANSCODE",transCode )
        main=ReplaceBlock( main,"CONFIG",Config() )
  
        SaveString main,"main.cpp"
  
        If tcc.opt_build
      
            Execute "make -f "+tcc._libs+"/src/Makefile OS=MacOS"
      
            Local ccopts:="", ldopts:="", libsopts:="-lglfwgame ", libsearch:="", includes:="", libsearchStack:StringStack, includesStack:StringStack
            Local appName:=GetConfigVar( "GLFW_APP_NAME" )
      
            If appName = "" appName=QuoteMe("CerberusGame") Else appName=QuoteMe(appName)
      
            ' Apple path search parameters are different than the usual -L and -I options
            ' All paths need to be quoted, as white space is considered to signify the next option
            ' e.g. LIBRARY_SEARCH_PATHS="PATH!" "PATH2" "PATH3"
            ' The most important for Cerberus are: OTHER_CFLAGS, LIBRARY_SEARCH_PATHS
            libsearchStack = New StringStack(GetConfigVar( "GLFW_XCODE_LIB_PATHS" ).Split(";"))
            libsearchStack.Push("staticlibs/macos")
            libsearchStack.Push("shared/macos")
      
            ' Fix the quotes
            For Local i:= Eachin libsearchStack
                If i<> ""
                    If FileType( i ) = FILETYPE_DIR        ' The directory exists that the user has passesd
                        libsearch+=QuoteMe( i )+" "
                    Elseif FileType( tcc._libs+"/"+i ) = FILETYPE_DIR ' The directory didn't exist, so check the applications library store
                            libsearch+=QuoteMe( tcc._libs+"/"+i )+" "
                    Endif
                Endif
            Next
      
            includesStack = New StringStack(GetConfigVar( "GLFW_XCODE_INCLUDES" ).Split(";"))
            includesStack.Push("src/glfwgame/glfw3/include")
            includesStack.Push("src/glfwgame/stb")
      
            ' Fix the quotes
            For Local i:= Eachin includesStack
                If i<>""
                    If FileType( i ) = FILETYPE_DIR
                        includes+= "-I"+QuoteMe( i )+" "
                    Elseif FileType(tcc._libs+"/"+i) = FILETYPE_DIR
                        includes+= "-I"+QuoteMe( tcc._libs+"/"+i )+" "
                    Endif
                Endif
            Next
      
            ccopts+=GetConfigVar( "GLFW_XCODE_CC_OPTS" ).Replace( ";"," " )
            ldopts+=GetConfigVar( "GLFW_XCODE_LD_OPTS" ).Replace( ";"," " )
            libsopts+=GetConfigVar( "GLFW_XCODE_LIBS_OPTS" ).Replace( ";"," " )
      
            ccopts+=" "+includes
      
            ChangeDir "xcode"
      
'            Execute "set -o pipefail && xcodebuild -configuration "+casedConfig+" | egrep -A 5 ~q(error|warning):~q"
            Local params:="OTHER_CFLAGS='"+ccopts+"' LIBRARY_SEARCH_PATHS='"+libsearch+"' OTHER_LDFLAGS='"+ldopts+" "+libsopts+"' PRODUCT_NAME="+appName
      
            Execute "xcodebuild -configuration "+casedConfig+" "+params
            If tcc.opt_run
      
                ChangeDir "build/"+casedConfig
          
                ChangeDir(StripQuotes(appName)+".app/Contents/MacOS")
          
                Execute "./"+appName
            Endif
        Endif
    End
Edit: I'm also in the process of rewriting the "rebuild all.sh" to work for both Linux and OS X.
 
Last edited:

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#27
@Martin: Before you build for shipping, the to Windows dynamic libraries are OpenAL Soft, and as far as I am aware the licence they are under is compatible with the zlib/libpng licence. I've update the home page docs to mention that OpenAl Soft is used for Windows and renamed one of the files in the libs directory.
The I have not update the zlib/libpnpg licence, which may also require this information added to it.
 
Last edited:

MikeHart

Administrator
Staff member
Joined
Jun 19, 2017
Likes
427
Location
Germany
#28
@Martin: Before you build for shipping, the to Windows dynamic libraries are OpenAL Soft, and as far as I am aware the licence they are under is compatible with the zlib/libpng licence. I've update the home page docs to mention that OpenAl Soft is used for Windows and renamed one of the files in the libs directory.
The I have not update the zlib/libpnpg licence, which may also require this information added to it.
@Martin, did you see this?
 
Joined
Nov 8, 2017
Likes
1
#29
Thanks a lot for your work Dawlane! :D I was finally able to compile Cerberus on windows, now I got some dll errors but I guess it's because of merging your powershell script with the original source. I'm going to clone your branch and try again.

regards,
Alvaro
 
Joined
Nov 8, 2017
Likes
1
#30
hmmm, I went back to having errors :( :

Code:
Exception calling "ExtractToDirectory" with "2" argument(s): "Could not find a part of the path
'C:\WINDOWS\system32\archives\shared_libs_win.zip'."
At D:\blitz_research\cerberus_git\cerberus\src\rebuildall.ps1:104 char:5
+     [System.IO.Compression.ZipFile]::ExtractToDirectory($zipFile,$dst ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DirectoryNotFoundException

Building transcc
Please wait
Building launcher

makedocs
TRANS cerberus compiler V2017-11-09 alpha
Parsing...
Semanting...
Translating...
Building...

building cserver
TRANS cerberus compiler V2017-11-09 alpha
Parsing...
Semanting...
Translating...
Building...
"This is not a 64 bit operating system"
64 BIT
gcc  -m64  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release64/context.o ../glfw3/src/context.c
../glfw3/src/context.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
//========================================================================

Makefile:95: recipe for target 'build/Release64/context.o' failed
mingw32-make: *** [build/Release64/context.o] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64  -O3 -DNDEBUG" LDOPTS=" -m64  -s" LIBOPTS=" -lopenal32" APPLIBPATH="D:/blitz_research/cerberus_git/cerberus/libs" HOSTOS="winnt" ARCH=64 OUT="Release64/cserver_winnt" ', return code=2
Move-Item : Cannot find path
'D:\blitz_research\cerberus_git\cerberus\src\cserver\cserver.build\glfw3\gcc_winnt\Release64\cserver_winnt.exe'
because it does not exist.
At D:\blitz_research\cerberus_git\cerberus\src\rebuildall.ps1:334 char:9
+         Move-Item cserver\cserver.build\glfw3\gcc_winnt\Release"$arch ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\blitz_resear...erver_winnt.exe:String) [Move-Item], ItemNotFoundExce
   ption
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.MoveItemCommand

ERROR: Failed to build cserver!
PS D:\blitz_research\cerberus_git\cerberus\src>
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#31
I've done some restructuring. Hence the TRANS cerberus compiler V2017-11-09 alpha.

First you will have to have the official version of OpenAL32 installed. There are two places that you can get it from http://openal.org/downloads/ and there is a link in the Cerberus documentation for the desktop targets (look under Target SDKs). Read the licence that is shown during the OpenAL installation. It should tell you how you can distribute the installer with your own software.

Cerberus should find them to link against when using MinGW.

"This is not a 64 bit operating system"
That would be the next clue. Which version of MinGW are you using and what CPU architectures does it support? What version and architecture of the operating system. Cerberus defaults to 64 bit, hence the -m64 gcc compiler flag. You could force 32 bit builds by adding #GLFW_GCC_MSIZE_WINNT="32" to the top of the offending source file (cerberus\src\cserver\cserver.cxs).

I think I will have to look at some old MonkeyX code that I was messing around with that added a compiler switch for creating 32/64 bit builds.

  • Exception calling "ExtractToDirectory" with "2" argument(s): "Could not find a part of the path
  • 'C:\WINDOWS\system32\archives\shared_libs_win.zip'."
You can ignore this error. The rebuild all script looks for a backup zip file that would have the libcurl shared libraries in it.

If you are going to use libcurl, then you will need to create this directory structure.
Cerberus\
libs\
shared\
Win32\
Win64\​

You can find the libcurl shared files in a previous release. Place them in the correct directories, Win32 for 32bit and Win64 for the 64 bit versions.
 
Joined
Nov 8, 2017
Likes
1
#32
Thanks for the prompt reply Dawlane.
1.I'll download openAl from the link you're posting and retry.

2.I usually use the MinGW version recommended to build Monkey 2, found here:
http://monkeycoder.co.nz/get-file?file=i686-6.2.0-posix-dwarf-rt_v5-rev1.exe

If I run a 'gcc --version' I get:
Code:
gcc (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 6.2.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
So it's a 64bit version, my OS is Win10 proX64, and my processor is and AMD Ryzen 1800X, which supports 64 bit instructions.
However, according to QT's documentation (which according to Cerberus' documents say it's required to build Ted), I'm using the Mingw included with the QT5 SDK, since they recommend using the included Mingw and disabling any other version on the system; I modified the powershell script as follows:

Code:
[string]$mingw = "D:\Qt\Tools\mingw492_32",
    [string]$qtsdk = "D:\Qt\5.5\msvc2013_64",
    [string]$visualstudio = "D:\Microsoft Visual Studio 12.0\VC",
    [string]$qtspec = "win32-msvc2013",
So this version is:
Code:
gcc (i686-posix-dwarf-rev1, Built by MinGW-W64 project) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Apparently it's also a 64bit compiler? The weird thing is that when I copied just the code you posted for the new powershell script on the previous page (modifying its paths accordingly) and used it in the official source code, everything compiled fine, no errors at all, but running the executable would notify dll problems. Let me know if you want me to recreate all this again and paste any resulting info here.

3. I'm not using libcurl, I just tried to compile with all the default options in the script. ;) Just as in Linux (well, it goes smooth if you got all dependencies installed). I got no idea why it went looking for that. :D

Thanks a lot. Let me know if you need any further info. I'm very interested in getting it to compile on Windows.

regards,
Alvaro
 
Joined
Nov 8, 2017
Likes
1
#33
OK, I tried 2 things.
1. I downloaded the OpenAL SDK and installed it.
2. I downloaded the curl SDK as well, zipped only the libraries into a file with the reported name (shared_libs_win.zip), and placed it in the reported path 'C:\WINDOWS\system32\archives\shared_libs_win.zip'." ANd things went a tad better, lol :D
Code:
Building transcc
Please wait
Building launcher

makedocs
TRANS cerberus compiler V2017-11-09 alpha
Parsing...
Semanting...
Translating...
Building...

building cserver
TRANS cerberus compiler V2017-11-09 alpha
Parsing...
Semanting...
Translating...
Building...
"This is not a 64 bit operating system"
64 BIT
gcc  -m64  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release64/context.o ../glfw3/src/context.c
../glfw3/src/context.c:1:0: sorry, unimplemented: 64-bit mode not compiled in
//========================================================================
^
makefile:95: recipe for target 'build/Release64/context.o' failed
mingw32-make: *** [build/Release64/context.o] Error 1
TRANS FAILED: Error executing 'mingw32-make CCOPTS=" -m64  -O3 -DNDEBUG" LDOPTS=" -m64  -s" LIBOPTS=" -lopenal32" APPLIBPATH="D:/blitz_research/cerberus_git/cerberus/libs" HOSTOS="winnt" ARCH=64 OUT="Release64/cserver_winnt" ', return code=2
Move-Item : Cannot find path
'D:\blitz_research\cerberus_git\cerberus\src\cserver\cserver.build\glfw3\gcc_winnt\Release64\cserver_winnt.exe'
because it does not exist.
At D:\blitz_research\cerberus_git\cerberus\src\rebuildall.ps1:334 char:9
+         Move-Item cserver\cserver.build\glfw3\gcc_winnt\Release"$arch ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\blitz_resear...erver_winnt.exe:String) [Move-Item], ItemNotFoundExce
   ption
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.MoveItemCommand

ERROR: Failed to build cserver!
Still, the end result is the same, but little by little... :D
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#34
This should be a quick fix. I was playing around yesterday and forgot to set the template back to it's original state due to being distracted by more pressing real life matters.
Open
cerberus\targets\glfw3\template\config.cxs
#GLFW_GCC_MSIZE_WINNT="64"
to
#GLFW_GCC_MSIZE_WINNT="32"

The changes have be pushed to github.

sorry, unimplemented: 64-bit mode not compiled in
I will have to have a look at MinGW 6.2.1.
But here's what's someone says on stack-overflow about it.

I've been using TDM-GCC 5.1 64 bit version cross compiler, mostly to keep in line with the closest version that you would find on Ubuntu/Mint LTS 16.04. MinGW 5.1 had an issue with MS .lib files.

The 6.2.1 has more standardisation to the new C++1x features.

When issuing calling g++ -v
You should get a full output that include the details of how it was built
e.g.

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=D:/Applications/Compilers/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 5.1.0 (tdm64-1)

2.I usually use the MinGW version recommended to build Monkey 2, found here:
http://monkeycoder.co.nz/get-file?file=i686-6.2.0-posix-dwarf-rt_v5-rev1.exe
This package has two version of g++ installed in the bin directory. I will have to integrate this it transcc, in case it should become part of the official distribution.

THE REBUILD ALL SCRIPT
You can test each of the applications build process by passing an option. See the BUILDIN.txt in the src directory.

TIP: When it comes to Qt. Download the latest versions and look for the Maintenance tool in the Qt root directory.
Run it, skip the first Qt login dialog.
You may have to run the update tool to get the latest version of the Maintenance tool, before adding any new repositories.

Select Add or remove components. The settings button bottom left becomes available. Click it, and in the next dialog select the Repositories tab.

Select the User define repositories and the add button.
Paste http://download.qt.io/online/qt5/windows/x86/online_repository/
and do the same for
http://download.qt.io/online/qtsdkrepository/windows_x86/root/qt/
Click the test button to make sure that the repository is fine.
Click OK

You will start back at the Qt login. Skip it and select Add or remove components.
You should now have full access to install any Qt version and select individual components.
 
Last edited:
Joined
Nov 8, 2017
Likes
1
#35
Hi Dawlane, thanks for all that info.
This should be a quick fix. I was playing around yesterday and forgot to set the template back to it's original state due to being distracted by more pressing real life matters.
Open
cerberus\targets\glfw3\template\config.cxs
#GLFW_GCC_MSIZE_WINNT="64"
to
#GLFW_GCC_MSIZE_WINNT="32"
I already pulled your new version. Does this mean Cerberus will now be only 32 bits?
I've been using TDM-GCC 5.1 64 bit version cross compiler, mostly to keep in line with the closest version that you would find on Ubuntu/Mint LTS 16.04. MinGW 5.1 had an issue with MS .lib files.
I downloaded TDM-GCC and I must say it's very nice! I compiled the latest commit with this new version, more to come below... ;)

TIP: When it comes to Qt. Download the latest versions and look for the Maintenance tool in the Qt root directory.
Run it, skip the first Qt login dialog.
You may have to run the update tool to get the latest version of the Maintenance tool, before adding any new repositories.
I tried it out, but I'm not getting a "repositories tab":

Is this due to using the Online installer? (qt-unified-windows-x86-3.0.1-online.exe), should I install the full qt-opensource (offline) package instead? (qt-opensource-windows-x86-msvc2013_64-5.5.1.exe)

OK, now my latest results:

Code:
Building transcc
Please wait
Building launcher

makedocs
TRANS cerberus compiler V2017-11-09 alpha
Parsing...
Semanting...
Translating...
Building...

building cserver
TRANS cerberus compiler V2017-11-09 alpha
Parsing...
Semanting...
Translating...
Building...
Check C:\WINDOWS\SysWOW64\OpenAL32.dll
Created link to 64 bit OpenAL32.dll
symbolic link created for D:\Blitz_research\cerberus_git\cerberus\src\cserver\cserver.build\glfw3\openal\libs\shared\Win32\OpenAL32.dll <<===>> C:\WINDOWS\SysWOW64\OpenAL32.dll
32 BIT
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/context.o ../glfw3/src/context.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/egl_context.o ../glfw3/src/egl_context.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/init.o ../glfw3/src/init.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/input.o ../glfw3/src/input.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/monitor.o ../glfw3/src/monitor.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/osmesa_context.o ../glfw3/src/osmesa_context.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/vulkan.o ../glfw3/src/vulkan.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/wgl_context.o ../glfw3/src/wgl_context.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/win32_init.o ../glfw3/src/win32_init.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/win32_joystick.o ../glfw3/src/win32_joystick.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/win32_monitor.o ../glfw3/src/win32_monitor.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/win32_time.o ../glfw3/src/win32_time.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/win32_thread.o ../glfw3/src/win32_thread.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/win32_window.o ../glfw3/src/win32_window.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/window.o ../glfw3/src/window.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/stb_vorbis.o ../stb/stb_vorbis.c
gcc  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/stb_image.o ../stb/stb_image.c
g++  -m32  -O3 -DNDEBUG -Wno-free-nonheap-object -I../curl/include -I../glfw3/include -I../glfw3/src -I../openal/include -I../stb -I../zlib-1.2.8 -I../lpng1610 -c -o build/Release32/main.o ../main.cpp
g++ -m32  -s -LD:/blitz_research/cerberus_git/cerberus/libs/shared/Win32 -L../openal/libs/shared/Win32 -Wl,--subsystem,windows -o Release32/cserver_winnt build/Release32/context.o build/Release32/egl_context.o build/Release32/init.o build/Release32/input.o build/Release32/monitor.o build/Release32/osmesa_context.o build/Release32/vulkan.o build/Release32/wgl_context.o build/Release32/win32_init.o build/Release32/win32_joystick.o build/Release32/win32_monitor.o build/Release32/win32_time.o build/Release32/win32_thread.o build/Release32/win32_window.o build/Release32/window.o build/Release32/stb_vorbis.o build/Release32/stb_image.o build/Release32/main.o -lcomdlg32 -lgdi32 -lopengl32 -lopenal32 -lws2_32
Move-Item : Cannot find path
'D:\blitz_research\cerberus_git\cerberus\src\cserver\cserver.build\glfw3\gcc_winnt\Release64\cserver_winnt.exe'
because it does not exist.
At D:\blitz_research\cerberus_git\cerberus\src\rebuildall.ps1:334 char:9
+         Move-Item cserver\cserver.build\glfw3\gcc_winnt\Release"$arch ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\blitz_resear...erver_winnt.exe:String) [Move-Item], ItemNotFoundExce
   ption
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.MoveItemCommand

ERROR: Failed to build cserver!
Everything seems to go fine, until it has to create some folder where to move stuff into. The culprit is this line (rebuildall.ps1:334 char:9):
Code:
Move-Item cserver\cserver.build\glfw3\gcc_winnt\Release"$arch"\cserver_winnt.exe ..\bin\cserver_winnt.exe
I also tried creating the mentioned folders/subfolders by hand, it creates stuff temporarily, but it then immediately deletes everything ;(

So, as I said, little by little, little by little :D We're close!

Thank you Dawlane
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#36
Everything seems to go fine, until it has to create some folder where to move stuff into. The culprit is this line (rebuildall.ps1:334 char:9):
Actually you will find that the the culprit is line 99:
Code:
$arch = $env:PROCESSOR_ARCHITECTURE | %{$_ -replace "AMD", ""} | %{$_ -replace "x86", "32"}
On a 64 bit version of Windows, should be Vista on wards. You should find that you have two versions of Power-Shell installed. One is a native 64 bit executable and the other is is a pure 32 bit executable. When you open the native version, executing:
Code:
write-host $env:PROCESSOR_ARCHITECTURE
will output AMD64. While using the the 32 bit version will output x86.
So running the script on a 64 bit version of power-shell expects to build a 64 bit version.
So the path ends up as \cerberus\src\cserver\cserver.build\glfw3\gcc_winnt\Release64\cserver_winnt.exe'.

This is whats going on:
When the script is run on the 32 bit version of Power-Shell, it will generate a check path like so, a path
\cerberus\src\cserver\cserver.build\glfw3\gcc_winnt\Release32\cserver_winnt.exe'

The problem is now that the template config has changed back to #GLFW_GCC_MSIZE_WINNT="32".
Transcc now generates the output file path of \cerberus\src\cserver\cserver.build\glfw3\gcc_winnt\Release32\cserver_winnt.exe', so the script running on the 64bit version cannot find it, as the path it's looking for would be \cerberus\src\cserver\cserver.build\glfw3\gcc_winnt\Release64\cserver_winnt.exe'

So try and use the 32 bit power-shell. You will end up though with a mix of 32 bit and 64 bit binaries depending on the compiler being used. The TDM native 64 bit compiler outputs 64 bit binaries by default.

The only real problem is dealing with the building of Ted, with the pre-built libraries for MinGW being only 32 bit. The native 64 bit MinGW compiler by default only outputs 64 bit binaries, so it requires a 64 bit version of those libraries which do not exist. There was a project call Qt64-NG that is now unfortunately no longer available where you could get these.

I downloaded TDM-GCC and I must say it's very nice! I compiled the latest commit with this new version, more to come below..
If you have installed the native 64 bit version, you will find that changing the #GLFW_GCC_MSIZE_WINNT="32" back to #GLFW_GCC_MSIZE_WINNT="64" and running the script in the 64 bit version of power-shell it will compile OK.

Does this mean Cerberus will now be only 32 bits?
No. The intention of the script is that it should build either pure 32 bit or 64 bit binaries based on the version of Power-Shell used. But there has to be a default MSIZE has to be used somewhere. You would normally over-ride this in your own code by using #GLFW_GCC_MSIZE_WINNT="64" in your main source file.

I also tried creating the mentioned folders/subfolders by hand, it creates stuff temporarily, but it then immediately deletes everything ;(
It's meant to clean up after it's self or you would end up with a lot of old build files.

Is this due to using the Online installer? (qt-unified-windows-x86-3.0.1-online.exe), should I install the full qt-opensource (offline) package instead? (qt-opensource-windows-x86-msvc2013_64-5.5.1.exe)
To access the tab to add repositories. On the dialog with radio buttons, where is gives you a choice of:
  • Add or remove components
  • Update components
  • Remove all components
You will find that there is no button called settings until you click on on either of the top two items.
Once you have that button visible, then you can access the settings by clicking on it to add or remove addition repositories in the repository section.

As I've finally got a fresh re-install of Windows X installed. I will be looking into script changes tonight.

The best way to build this for this repository as 64 bit, is to use TDM with Visual Studio 2013.
 
Joined
Nov 8, 2017
Likes
1
#37
Wow! Wow! Wow! Fantastic! :D I can't wait to get back home and try all this new info out . Thanks for your time, patience and dedication dawlane. I really appreciate it.

I'm glad you got a fresh windows installed, I'm sure Cerberus will benefit from your wonderful optimizations , not to mention us, poor mortals. ;)

I'll report back soon.
Regards,
Alvaro
 
Joined
Nov 10, 2017
Likes
1
#38
I think the best improvement that could be made is to just bundle MinGW along with Cerberus so it can build right from the start. Not to mention that it will then always have the correct MinGW version for the type of code it generates.
 

dawlane

Active Member
CX Code Contributor
Joined
Jun 21, 2017
Likes
198
#39
Personally I would like to see it compile with LLVM, which I will see if it can do it. MinGW has gotten messy with licencing. TDM requires that you copy over the winpthread.txt. The only other alternative is MinGW-w64 and it's set up application with lack of documentation.
 
Last edited:
Joined
Nov 10, 2017
Likes
1
#40
Well, LLVM would be great as well, but for now just release Cerberus with MinGW (TDM or not) in it so it can compile desktop games right away.
 
Top Bottom