When compiling on mingw64, got error: cast to pointer from integer of different size
$ make
test -d objs || mkdir objs
test -d lib || mkdir lib
gcc -Iinclude -Imelang -c -Wall -ggdb -Werror -O3 -fPIC -o objs/mln_lang_file.o ./melang/file/mln_lang_file.c
./melang/file/mln_lang_file.c: In function 'mln_lang_open_process':
./melang/file/mln_lang_file.c:345:41: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
345 | if ((rn = mln_rbtree_node_new(tree, (void *)fd)) == NULL) {
| ^
./melang/file/mln_lang_file.c: In function 'mln_lang_close_process':
./melang/file/mln_lang_file.c:939:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
939 | rn = mln_rbtree_search(tree, tree->root, (void *)fd);
| ^
cc1.exe: all warnings being treated as errors
make: *** [Makefile:90: objs/mln_lang_file.o] Error 1
GCC version
$ gcc -v
Using built-in specs.
COLLECT_GCC=H:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=H:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-11.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev8, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' 'LDFLAGS_FOR_TARGET=-pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high' --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\ -pipe\ -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high\ -Wl,--stack,12582912'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Rev8, Built by MSYS2 project)
And turn to mingw32, got another error error: conflicting types for 'inet_ntop'
$ make
test -d objs || mkdir objs
test -d lib || mkdir lib
gcc -Iinclude -Imelang -c -Wall -ggdb -Werror -O3 -fPIC -o objs/mln_lang_network.o ./melang/network/mln_lang_network.c
./melang/network/mln_lang_network.c:180:7: error: conflicting types for 'inet_ntop'; have 'char *(int, const void *, char *, socklen_t)' {aka 'char *(int, const void *, char *, int)'}
180 | char *inet_ntop(int af, const void src, char dst, socklen_t size){
| ^~~~~~~~~
In file included from ./melang/network/mln_lang_network.c:6:
H:/msys64/mingw32/include/ws2tcpip.h:401:35: note: previous declaration of 'inet_ntop' with type 'const CHAR *(INT, const void *, CHAR *, size_t)' {aka 'const char *(int, const void *, char *, unsigned int)'}
401 | WINSOCK_API_LINKAGE LPCSTR WSAAPI InetNtopA(INT Family, LPCVOID pAddr, LPSTR pStringBuf, size_t StringBufSize);
| ^~~~~~~~~
make: *** [Makefile:102: objs/mln_lang_network.o] Error 1
With GCC version
$ gcc -v
Using built-in specs.
COLLECT_GCC=H:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=H:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/11.2.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-11.2.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/include --libexecdir=/mingw32/lib --enable-bootstrap --enable-checking=release --with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-lto --enable-libgomp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev10, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --with-boot-ldflags='-pipe -Wl,--no-seh -Wl,--large-address-aware -Wl,--disable-dynamicbase -static-libstdc++ -static-libgcc' 'LDFLAGS_FOR_TARGET=-pipe -Wl,--no-seh -Wl,--large-address-aware' --enable-linker-plugin-flags='LDFLAGS=-static-libstdc++\ -static-libgcc\ -pipe\ -Wl,--no-seh\ -Wl,--large-address-aware\ -Wl,--stack,12582912' --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Rev10, Built by MSYS2 project)
MSYS version
$ uname -a
MSYS_NT-10.0-19043 XXX 3.3.3-341.x86_64 2022-01-18 13:00 UTC x86_64 Msys
melon git branch/commit 3d6329a60941ab198ab9b952ebd2bbdea0c8de49