HaxeFoundation / hxcpp

Runtime files for c++ backend for haxe
Other
298 stars 189 forks source link

Linking issue on HXCPP_MINGW under MSYS2 #1094

Closed ovidiugabriel closed 8 months ago

ovidiugabriel commented 8 months ago

Hello,

I am trying to build an older project that once built successfully on hxcpp. I have "skipping incompatible" error message for every possible lib linked in the project.

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: 
skipping incompatible 
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../libws2_32.a 
when searching for -lws2_32

I also tried to use -D HXCPP_M32 but it did't fixed the issue.

cygpath "C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../libkernel32.a"

# will resolve to
/mingw64/lib/libkernel32.a

# This path is pointing to the same libkernel32.a as we expect (c:\msys64\mingw64\lib\libkernel32.a)

$ md5sum.exe /c/msys64/mingw64/lib/libkernel32.a
f180b3cfae56f5db30c6e3a6b1be9d77 */c/msys64/mingw64/lib/libkernel32.a

$ md5sum.exe /mingw64/lib/libkernel32.a
f180b3cfae56f5db30c6e3a6b1be9d77 */mingw64/lib/libkernel32.a

Here is the GCC version

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.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/include 
  --libexecdir=/mingw64/lib --enable-bootstrap --enable-checking=release --with-arch=nocona --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 --enable-lto --enable-libgomp --disable-libssp --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='Rev5, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues 
  --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ 
  --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Rev5, Built by MSYS2 project)

HXCPP info

$ haxelib info hxcpp
Name: hxcpp
Tags: cpp, haxe, hxcpp
Desc: Hxcpp is the runtime support for the C++ backend of the Haxe compiler. This contains the headers, libraries and 
  support code required to generate a fully compiled executable from Haxe code.
Website: https://github.com/HaxeFoundation/hxcpp/
License: BSD
Owner: gamehaxe
Version: 4.3.2

Haxelib version

$ haxelib version
4.1.0

Do you have any idea how this can be fixed? Am I missing something?

tobil4sk commented 8 months ago

I also tried to use -D HXCPP_M32 but it did't fixed the issue.

You could try running with -D HXCPP_M64, but you'll have to use the git version of hxcpp:

haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp
ovidiugabriel commented 8 months ago

Thanks @tobil4sk . It worked. I can draw the following conclusions:

1) the default of hxcpp is on 32-bits, that's why specifying -D HXCPP_M32 had no effect 2) -D HXCPP_M64 is not supported in the release distribution 3) Of course, it seems I don't have 32-bits support configured in MinGW

If I remember correctly I have used -D HXCPP_M64 in the past with the release version of hxcpp and it worked, or maybe I'm wrong.