Greetings,
I like to report a partial success building the trunk on
MSYS2/MINGW Windows 10 64Bit platform.
The mc compiler works fine.
Probably due to the failed linking the 'gmc' binary does not work.
There where some changes I had to do in order to get to this stage.
The nature of these could perhaps be implemented as these could improve
the porting to other target also.
1. Cast of pointer loosing precession error.
Message : error cast from 'void*' to 'long unsigned int' loses precision
File1 : m2/mc-boot/GDynamicStrings.c:908:18
Line1 : 908 | writeLongcard ((long unsigned int ) (a));
File2 : mc-boot/Gdecl.c:8213:28:
File3 : m2/mc-boot/Gdecl.c:19726:24:
I believe '
long unsigned int ' is 32 bit.
Propose to use 'uintptr_t'?
2. BSD function 'index'
Message : error: 'index' was not declared in this scope
File1 : m2/mc-boot-ch/Glibc.c:93:11:
Line1 : 93 | c = index (&_format[i], '\\');
Propose to change this to the 'strchr' function.
Believe index is not part of posix and comes from BSD.
This function is not found in MSYS2/MINGW
Found at many places in the code base.
3. Use of obsolete function 'creat'
File1 : m2/tools-src/mklink.c
Change
OutputFile = creat (NameOfFile, 0666);
To :
OutputFile = open (NameOfFile, O_WRONLY | O_CREAT | O_TRUNC, 0666);
Also in mc-boot & pge-boot the libc_creat procedure is used in several locations.
Ref :
https://www.gnu.org/software/libc/manual/html_node/Opening-and-Closing-Files.html This compiles OK, but somehow this function is not properly
implemented in
MSYS2/MINGW .
I changes this to use the replacement above and then mc works properly.
4. Reference to 'termios' commented out in several locations
due to missing functinallity on the MSYS platform.
This should probably be handled on the Makefile level.
5. Reference to 'signal.h' commented out in several locations
due to missing functinallity on the MSYS platform.
This should probably be handled on the Makefile level.
6. Failure to link plugin
Error : /m2rte.o:m2rte.cc:(.rdata$.refptr._ZTV8opt_pass[.refptr._ZTV8opt_pass]+0x0): undefined refere nce to `vtable for opt_pass'
No solution currently found.
Skipped with make -k to continue
Testing gm2 yields:
./gm2.exe -g hello.mod
cc1gm2.exe: error: plugin support is disabled; configure with '--enable-plugin'
It is very close to working correctly and with some further
investigation is should be solved.
Is see there is adaptation for MINGW/MSYS platform in several places
in the GCC code base: Line 2028 in 'gcc\ada\Makefile.rtl'. Probably
this could be reused.
Hope this information can be useful.
Best regards
Runar Tenfjord