Post by flip on Oct 8, 2018 23:35:30 GMT 1
I know this is an old thread, but I thought I post my experience using the latest SE 1.3 here.. I'm certainly no expert so some settings might be unnecessary, but I got compiling with codeblocks to work on 32 and 64 bit using the latest nuwen mingw-64 version which uses GCC 8.1.0 (https://nuwen.net/mingw.html) and I'm going to try the normal MinGW64 next although I assume the settings would be very similar except for maybe compiler executables. ( * Update with discrepant options for regular MinGW64 posted below * ).
first the obvious:
-download and install Nuwen MinGW-64, please note it doesn't really let you choose an install folder (it makes you think it does) but in the instructions it clearly states you need to point to a root of a drive, and if you have an existing C:\MinGW folder, it would probably be overwritten.
-download and install codeblocks (without MinGW)
-if you haven't done so also download the SE SDK3 files and store the SE_SDK3 folder at a location that's easy to get to (like root).
Now we have that covered it's time to open CodeBlocks. To test a compile of an existing module from the SDK it's good to copy one to i.e. your documents folder or where-ever you like and open the project with Codeblocks, choose the default GNU GCC Compiler when prompted. Go to the Settings tab and click Compiler. In the Search Directories I added the 'C:\SE_SDK3' folder and the 'C:\MinGW\X86_64-w64-mingw32' folder, in the toolchain executables I have C:\MinGW as the directory.
C Compiler: mingw32-gcc.exe
C++ Compiler: mingw32-g++.exe
Linker for Dynamic libs: mingw32-g++.exe
Linker for static libs: ar.exe
Resource compiler: windres.exe (which I assume is the troublemaker in 32-bit compile that needs the rc code).
Make Program: mingw32-make.exe
Now Copy this and name it GNU GCC Compiler(32bit)
Go back to the GNU GCC Compiler and change the filenames that start with mingw32- to be without mingw32- which are the executables for the 64-bit compile. Click OK.
Open the Project tab and click Build options. On the module itself, in compiler settings, other compiler options I have added: -msse2
In compiler settings defines I have the following:
in the Linker settings there's: -Wl,--kill-at -static-libstdc++ -static-libgcc
and in the Search Directories, compiler: 'C:\MinGW\X86_64-w64-mingw32'
In 32bit debug, choose the 32 bit compiler.
In compiler settings check the -m32 box for 32bit and the -m64 box for 64bit, leave the rest as is (I didn't specify a language type or anything). The rest is for both the 32bit and the 64bit option.
For Debug there's the Other compiler option -O0 , and defines:
(the release version have nothing instead of -O0 and NDEBUG instead of _DEBUG).
There is probably a list of libraries populated in the Linker settings, remove this with the clear button, then Add and copy paste this line:
In search Directories I have C:\SE_SDK3\
Then a copy to the related common files modules folder in the post steps if needed, click OK.
We can go to Project Properties and in Build Targets I have unchecked create import library as well as the create .DEF exports file, and the Auto_Generate file extension. The filename is renamed from .dll to .sem. Do this for all compiler options. Also, in 64bit I unchecked auto-generate filename prefix and added 64 to the filename (so it's clear which one is 64bit). Please make sure you are aware of the output folder location.
Then lastly, go to the project .rc file as stated in the Previous instructions by Andrew, right click it, choose properties, in advanced check the box to use a custom command and enter: $rescomp -Fpe-i386 -i $file -J rc -o $resource_output -O coff $res_includes
Finally, time to compile and if everything is ok it should compile fine. If you'd try to open the module in SynthEdit without changing the plugin name and registration you'd get a duplicate error, but this only means you're ready to go and alter or make some modules..
Please feel free to comment if you have corrections to the above, but this is working for me so far.. Hope this helps.
UPDATE (regular MinGW64):
tried with 8.1.0 MinGW-64 edition (downloaded installer, selected: Version 8.1.0 , X86_64, Win32, sjlj, 0 during installation). After install I copied the MinGW64 folder to the C: root. Everything is the same as in the above configuration, except change all the C:\MinGW\ references above to C:\MinGW64\ (do not forget to replace it in the libs list), and you do not need to have separate compiler executables as they are the same for 32bit and 64bit, executables are like Rob's post:
C compiler: x86_64-w64-mingw32-gcc.exe
C++ compiler: x86_64-w64-mingw32-g++.exe
Linker for Dynamic Libs: x86_64-w64-mingw32-g++.exe
Linker for Static Libs: ar.exe
Resource compiler: windres.exe
Make program: mingw32-make.exe
(Just to be 100% clear, in this way you do have the same compiler choice in the project build options for 32 and 64bit, and I'm not sure if it's necessary but I do uncheck the rc file properties custom code flag when compiling 64bit).
All the other settings are the same as what I posted above and it's creating smaller files after compiling than the Nuwen MinGW edition which is also based of 8.1.0. I'm not 100% sure if there's any difference in how the module works or it's just the extra libs in Nuwen, but maybe someone can elaborate on that? The reason I initially went for Nuwen is because I didn't know what to choose during the installation of MinGW-64. I just tested the SEH option in the mingw64 installation, and that doesn't compile (missing files), I read that's because of the error handling not being included. For SJLJ Everything seems to run fine after compile.
Before (when trying to use the settings as mentioned on the SynthEdit website) and using MinGW64 to get it compiled to 64bit I did get _MP_STDCALL errors, but most likely that's because it mentioned you need to run the C:++11 standard language flag which apparently isn't working with MinGW64 and Nuwen, and/or -m32 or -m64 flag not set, and/or because the compiler search directory is missing from the build options compiler search directory.
I think I'm sticking to the regular latest MinGW64 build for now, there doesn't seem to be notable differences between Nuwen and MinGW64 when it comes to compiling other than settings, but seeing the compiled file size difference I'm inclined to go with the smaller output.