Jump to content
The Dark Mod Forums

Recommended Posts

Posted

by request i have made a ucrt32 version of the msys2 mingw cross compiler for bootstrapping a mingw-w64-i686-ucrt32 compiler.

this version can be used to make 32 bit ucrt versions of current mingw packages for use on vista and greater os versions.

since this is a by request build it might not make it into the official msys2 repo's but ill make it avaliable for developers to add to the existing msys2 toolchain.

 

Posted

for those interrested the ada or gnat compiler is not currently buildable but we might be able to use the same hack to get it going as was used to build ada for the ucrt64 version of mingw-w64.

Fortran C and C++ should be bootstrappable without any problems, ada however needs its own seperate ada compiler since it cannot be built with C / C++ alone.

 

Posted

another note. since the ucrt32 version is not part of the official repo i will have to make my own version of the the msys2 filesystem package since this is needed for integration with the msys2 toolchain.

i will probably also have to make my own version of the shell launchers so that we have an easy way of starting a bash shell for the mingw-w64-i686-ucrt32 toolchain, this also means i have to modify the msys2 batch file so that it will work with the mingw-w64-ucrt32 toolchain.

so a lot of work ahead.

i will also make a TDM based version of both ucrt32 and ucrt64 for those who dont want there executables depending on the libgcc and libstdc++ dll's (exceptions will still work). the TDM version is pretty stable by now but a few packages cannot be linked to the static libgcc/libstdc++ which is not a problem with the TDM patches since they are also broken with plain gcc if the runtimes are linked statically (so far the only two packages that refuse to work when linked to the static runtimes are ogre3d and gdk-pixbuf2).

Posted

currently building the gcc cross compiler because it needs to be built before the rest of the toolchain.

afterwards ill start building the rest of the cross toolchain so i expect it will be done by tomorrow.

for those who might not want to wait for the changes to the msys2 filesystem you can use this guide.

in /etc find the msystem file and open it with notepad++,  you will see a large block of text with settings for the different compilers so scroll down to ucrt64 and make a copy of the block from UCRT64) to the two ;; at the end of the block. now paste it below the ;; in the UCRT64 block and change x86_64 to i686 and ucrt64 to ucrt32 and prefix to /ucrt32. now open makepkg_mingw.conf and do the same copy of the ucrt64 block and paste it below the ucrt64 block. CFLAGS change -march=nocona -msahf -mtune=generic to -march=pentium4 -mtune=generic and MINGW_PREFIX to /ucrt32 save the two files and done.

now comes the hard part you need to modify the msys2_shell.cmd file as otherwise theres no way to start a shell for the new compiler so here we go. find this block

if "x%~1" == "x-ucrt64" shift& set /a msys2_shiftCounter+=1& set MSYSTEM=UCRT64& goto :checkparams and copy it off and paste it below. then change x-ucrt64 to x-ucrt32 and MSYSTEM=UCRT64 to MSYSTEM=UCRT32. 

now this block ->

else if "%MSYSTEM%" == "UCRT64" (
  set "CONTITLE=MinGW UCRT x64"
  set "CONICON=ucrt64.ico"
)

copy it off and paste it below so it becomes

else if "%MSYSTEM%" == "UCRT64" (
  set "CONTITLE=MinGW UCRT x64"
  set "CONICON=ucrt64.ico"
) else if "%MSYSTEM%" == "UCRT32" (
  set "CONTITLE=MinGW UCRT x86"
  set "CONICON=ucrt32.ico"
) 

and this part

echo     -mingw32 ^| -mingw64 ^| -ucrt64 ^| -clang64 ^|
echo     -msys[2] ^| -clangarm64          Set shell type

make it

echo     -mingw32 ^| -mingw64 ^| -ucrt32 ^| -ucrt64 ^| -clang64 ^|
echo     -msys[2] ^| -clangarm64          Set shell type

save and make a shortcut to the batch file then in properties put -ucrt32 after the batch file name (remember to make a space between the batch file name and the variable).

now the shortcut will open the ucrt32 compiler when it has been built.

the launcher executables will do that part when im done editing them.

EDIT: you also need to add the ucrt32 toolchain to /usr/bin/makepkg-mingw

Posted

64 bit msys2 version is done and up on the sourceforge site.

currently building the mingw-w64-ucrt32 compiler toolchain.

it will not have a gnat compiler to start with since it requires a working gnat compiler to start with, but there are plans to use the same method as was used for ucrt64 to have one.

a TDM based version will also be supplied which is geared more towards building standalone programs on windows without needing the gcc runtime dll's.

Posted

it is a 32 bit version of the mingw compiler using the universal runtime instead of the old msvcrt :)

the Msys2 project only provides the 64 bit version as they are moving away from 32 bit.

You can use it to make windows compatible software eg. games / dependencies for windows (must be atleast vista as ucrt does not support older windows versions than that).

I done it by request so it wont have a full package repository like UCRT64 does and it will not be added to the official Msys2 repo. Ill provide compiler builds and integration with Msys2 but packages users will have to build themself.

Posted

the upside to building with the above compared to the standard mingw 32 and 64 bit compilers is better compatibility with windows 10 and up as they use the universal runtime instead of msvcrt.

Posted

btw. the current uploaded compiler is not working because of a simple oversight.

the bootstrap compiler used gcc's own libssp and not the mingw-w64 dummies which means it will fail to run unless you copy of libssp-0.dll from the winlibs ucrt compiler and place it in /ucrt32/bin.

im currently rebuilding the toolchain without the libssp library from gcc so that it will work correctly with Msys2. Sorry about that...

The upside to this is that im including my runtime-config script in the new build to make it easier to use the static runtimes in case you absolutely dont want your code to rely on the gcc unwinder and exception dll's.

this version however will not support throwing exceptions across dll boundaries (32 bit problem only as the exception mechanism is incompatible with windows SEH exceptions. gcc uses dwarf or sjlj in 32 bit).

ill post a version based on the TDM compiler later which does support it.

Posted

mostly people working with emulators like pcem and clones which work better with 32 bit.

also still needed for some older sources not ported to 64 bit because the benefit of doing it would be neglible or just not there.

as posted i did the port by request, and it is indeed a niche product but wanted non the less 😉

  • Like 1
Posted

fixed compiler uploaded btw. totally forgot 😂.

currently building the rust toolchain for use with it since a lot of the libraries on the Msys2 repo depends on it.

llvm/clang done just havent had time to upload it. ill upload it together with the rust toolchain.

Posted

btw. there are actually toolchains out there targetting ucrt32 but the benefit of having one specifically for the Msys2 version is the large library of packages and the package manager which eases building somewhat.

i also uploaded the Msys2 filesystem and pacman changes as well as updated launchers.

64 bit Msys here https://sourceforge.net/projects/cbadvanced/files/Msys64/

32 bit Msys here https://sourceforge.net/projects/cbadvanced/files/Msys32/

without these you cannot use them with Msys2 as the unmodified filesystem has no paths for the Ucrt32 compiler only Ucrt64.

Posted

the tdm version of ucrt32 will probably replace the current compiler as it works just as well.

the difference is that packages linked to the static gcc runtimes do not support throwing exceptions across dll boundaries on the normal ucrt compiler, the tdm version does support it. that is not to say you should link everything to the static runtimes as some packages behave very buggy when doing so (gdk-pixbuf ogre3d). i added my runtime-config script to the compiler to ease using the static runtimes, it does this by copying the static libstdc++.a to libstdc++.dll.a and libgcc_eh.a to libgcc_s.a. this might seem a little convoluted but there is actually a very good reason it was done this way instead of using the -static-libgcc and -static-libstdc++ flags. -static-libstdc++ does not work to well as the linker sees

-lstdc++ which both the static and shared runtime use so it links to the shared. we could get away with -static-libgcc but i decided against it because the script would become even more messy than it is.

so to build against the static runtimes you call runtime-config with no arguments before configure and runtime-config -shared after make or whatever build command you use.

it is mostly intended for people who want to build standalone programs something which the Msys2 MinGW / Clang compilers are not really geared towards.

Posted

go llvm and rust toolchains done and will be uploaded next.

a lot of packages on the Msys2 MinGW repos depend on these as many sources have moved away from standard C/C++. rust is needed for the svg imaging library (probably one of the first packages that got ported) and many more. go is used for a lot of networking tools like some git additions. llvm/clang can be used as a replacement compiler for C/C++ and it's libraries are used all over the place. this will conclude the compiler toolchain for my part and building packages for it will be up to users themself.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...