Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error with MSYS2/mingw64, uses wrong path to windres.exe #40286

Open
v-dao opened this issue Jul 11, 2020 · 11 comments
Open

Build error with MSYS2/mingw64, uses wrong path to windres.exe #40286

v-dao opened this issue Jul 11, 2020 · 11 comments

Comments

@v-dao
Copy link
Contributor

v-dao commented Jul 11, 2020

Godot version:

git master branch。

OS/device including version:

windows 1903; msys2 - mingw64;

$ 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/10.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-10.1.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 --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --disable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.1.0 (Rev3, Built by MSYS2 project)
$ scons -v
SCons by Steven Knight et al.:
        script: v3.1.2.bee7caf9defd6e108fc2998a2520ddb36a967691, 2019-12-17 02:07:09, by bdeegan on octodog
        engine: v3.1.2.bee7caf9defd6e108fc2998a2520ddb36a967691, 2019-12-17 02:07:09, by bdeegan on octodog
        engine path: ['/usr/lib/python3.8/site-packages/SCons']
Copyright (c) 2001 - 2019 The SCons Foundation
$ python --version
Python 3.8.3

Issue description:

build error.

Steps to reproduce:

$ scons platform=windows use_mingw=yes
scons: Reading SConscript files ...
Package x11 was not found in the pkg-config search path.
Perhaps you should add the directory containing `x11.pc'
to the PKG_CONFIG_PATH environment variable
No package 'x11' found
Configuring for Windows: target=debug, bits=default
Using MinGW
Checking for C header file mntent.h... no
scons: done reading SConscript files.
scons: Building targets ...
[Initial build] Compiling ==> platform/windows/godot_windows.cpp
[Initial build] Compiling ==> platform/windows/crash_handler_windows.cpp
[Initial build] Compiling ==> platform/windows/os_windows.cpp
[Initial build] Compiling ==> platform/windows/display_server_windows.cpp
platform/windows/display_server_windows.cpp:432:2: warning: #warning touchscreen not working [-Wcpp]
  432 | #warning touchscreen not working
      |  ^~~~~~~
[Initial build] Compiling ==> platform/windows/key_mapping_windows.cpp
[Initial build] Compiling ==> platform/windows/joypad_windows.cpp
[Initial build] Compiling ==> platform/windows/windows_terminal_logger.cpp
[Initial build] Compiling ==> platform/windows/vulkan_context_win.cpp
[Initial build] Compiling ==> platform/windows/context_gl_windows.cpp
[Initial build] build_res_file(["platform/windows/godot_res.windows.tools.64.o"], ["platform/windows/godot_res.rc"])
scons: *** [platform/windows/godot_res.windows.tools.64.o] Error 1
scons: building terminated because of errors.

Minimal reproduction project:

@akien-mga
Copy link
Member

Do you have x86_64-w64-mingw32-windres in your PATH? Make sure that your MSYS2 installation includes binutils.

@v-dao
Copy link
Contributor Author

v-dao commented Jul 14, 2020

$ windres.exe --version
GNU windres (GNU Binutils) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
这个程序是自由软件;您可以遵循 GNU 通用公共授权版本 3 或
(您自行选择的) 稍后版本再发布它。
这个程序不含任何担保。
$ pacman -Ss binutils
mingw64/mingw-w64-x86_64-binutils 2.34-3 (mingw-w64-x86_64-toolchain) [已安装]
    A set of programs to assemble and manipulate binary and object files (mingw-w64)
msys/binutils 2.34-3 (msys2-devel)
    A set of programs to assemble and manipulate binary and object files
msys/mingw-w64-cross-binutils 2.34-1 (mingw-w64-cross-toolchain mingw-w64-cross)
    A set of programs to assemble and manipulate binary and object files

How to print the compiled command information?

@akien-mga
Copy link
Member

You can run scons platform=windows use_mingw=yes verbose=yes to have more info on the commands.

The problem seems to be that MSYS2 installs mingw-w64 binutils binary without a prefix: https://packages.msys2.org/package/mingw-w64-x86_64-binutils

/mingw64/bin/windres.exe

While at least on Linux, mingw64 installs its binaries with a prefix:

/usr/bin/x86_64-w64-mingw32-windres

The relevant code is here:

mingw32 = ""
mingw64 = ""
if os.name == "posix":
mingw32 = "i686-w64-mingw32-"
mingw64 = "x86_64-w64-mingw32-"
if os.getenv("MINGW32_PREFIX"):
mingw32 = os.getenv("MINGW32_PREFIX")
if os.getenv("MINGW64_PREFIX"):
mingw64 = os.getenv("MINGW64_PREFIX")

def build_res_file(target, source, env):
if env["bits"] == "32":
cmdbase = env["mingw_prefix_32"]
else:
cmdbase = env["mingw_prefix_64"]
cmdbase = cmdbase + "windres --include-dir . "
import subprocess
for x in range(len(source)):
cmd = cmdbase + "-i " + str(source[x]) + " -o " + str(target[x])
try:
out = subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
if len(out[1]):
return 1
except:
return 1
return 0

If you define MINGW64_PREFIX and MINGW32_PREFIX to "" in your environment variables, it might work.

But the platform/windows/detect.py should be reworked to properly support MSYS2's setup. It's surprising that it fails now though as I remember using it on Windows 10 just a few months ago. CC @Calinou @bruvzg

@akien-mga akien-mga changed the title Build Error in msys2/mingw64 Build error with MSYS2/mingw64, uses wrong path to windres.exe Jul 14, 2020
@v-dao
Copy link
Contributor Author

v-dao commented Jul 14, 2020

cp /mingw64/windres /mingw64/x86_64-w64-mingw32-windres

successed. Thanks.

@v-dao v-dao closed this as completed Jul 14, 2020
@akien-mga
Copy link
Member

It's still a bug that it doesn't work out of the box.

@akien-mga
Copy link
Member

@Atem1995 in #49212 seems to have the same issue #49212 (comment), with this error log:

'processCollision':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_57(D) + 48B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'collideTVNoStackAlloc' at thirdparty\\bullet/BulletCollision/BroadphaseCollision/btDbvt.h:1199:15,
    inlined from 'processCollision' at thirdparty\\bullet\\BulletCollision\\CollisionDispatch\\btCompoundCollisionAlgorithm.cpp:293:30:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_57(D) + 16B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processCollision' at thirdparty\\bullet\\BulletCollision\\CollisionDispatch\\btCompoundCollisionAlgorithm.cpp:310:23:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)this_57(D) + 48B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'setup' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:118:18,
    inlined from 'solveConstraints' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:698:31:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |
 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_8 + 56B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'setup' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:119:21,
    inlined from 'solveConstraints' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:698:31:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |
               new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_8 + 88B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'setup' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:120:23,
    inlined from 'solveConstraints' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:698:31:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |    
                             new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_8 + 120B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |
   ^
In member function 'resize',
    inlined from 'buildIslands' at thirdparty\\bullet\\BulletCollision\\CollisionDispatch\\btSimulationIslandManager.cpp:202:25,
    inlined from 'buildAndProcessIslands' at thirdparty\\bullet\\BulletCollision\\CollisionDispatch\\btSimulationIslandManager.cpp:345:14,
    inlined from 'solveConstraints' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:702:41:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset [-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_20 + 40B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processIslands' at thirdparty\\bullet\\BulletCollision\\CollisionDispatch\\btSimulationIslandManager.cpp:442:25,
    inlined from 'buildAndProcessIslands' at thirdparty\\bullet\\BulletCollision\\CollisionDispatch\\btSimulationIslandManager.cpp:346:19,
    inlined from 'solveConstraints' at thirdparty\\bullet\\BulletDynamics\\Dynamics\\btDiscreteDynamicsWorld.cpp:702:41:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'solveConstraints':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109:21: note: at offset 
[-17179869184, -8] into destination object 'MEM[(struct btAlignedObjectArray *)_20 + 72B].m_data' of size [0, 9223372036854775807]
  109 |
if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'processCollision' at thirdparty\\bullet\\BulletCollision\\CollisionDispatch\\btCompoundCompoundCollisionAlgorithm.cpp:337:0:
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:223: warning: '__builtin_memset' writing 
between 8 and 17179869184 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      | 
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h: In member function 'processCollision':
thirdparty\\bullet/LinearMath/btAlignedObjectArray.h:109: note: at offset [-17179869184, -8] into destination object 'manifoldArray.m_data' of size [0, 9223372036854775807]
  109 |      
           if (m_data)
      | 
thirdparty\\miniupnpc\\miniupnpc\\miniupnpc.c: In function 'GetUPNPUrls':
thirdparty\\miniupnpc\\miniupnpc\\miniupnpc.c:496:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  496 | }
      | ^
thirdparty\\miniupnpc\\miniupnpc\\upnpcommands.c: In function 'UPNP_GetExternalIPAddress':
thirdparty\\miniupnpc\\miniupnpc\\upnpcommands.c:336:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  336 | }
      | ^
editor\\editor_node.cpp: In member function '__ct_base ':
editor\\editor_node.cpp:5724: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without
 5724 | EditorNode::EditorNode() {
      | 
thirdparty\\zstd\\compress\\zstd_compress.c: In function 'ZSTD_cParam_getBounds':
thirdparty\\zstd\\compress\\zstd_compress.c:475:1: warning: visibility attribute not 
supported in this configuration; ignored [-Wattributes]
  475 | }
      | ^
thirdparty\\mbedtls\\library\\ssl_tls.c: In function 'ssl_calc_finished_tls_sha384':
thirdparty\\mbedtls\\library\\ssl_tls.c:6580:5: warning: 'mbedtls_sha512_finish_ret' accessing 64 bytes in a region of size 48 [-Wstringop-overflow=]
 6580 |     mbedtls_sha512_finish_ret( &sha512, padbuf );
      |     ^
thirdparty\\mbedtls\\library\\ssl_tls.c:6580:5: note: referencing argument 2 of type 'unsigned char *'
thirdparty\\mbedtls\\library\\sha512.c:405: note: in a call to function 'mbedtls_sha512_finish_ret'
  405 | int mbedtls_sha512_finish_ret( mbedtls_sha512_context *ctx,
      | 
thirdparty\\libwebp\\src\\enc\\picture_enc.c: In function 'WebPMemoryWrite':
thirdparty\\libwebp\\src\\enc\\picture_enc.c:216:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  216 | }
      | ^
thirdparty\\libwebp\\src\\utils\\utils.c: In function 'WebPSafeMalloc':
thirdparty\\libwebp\\src\\utils\\utils.c:199:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  199 | }
      | ^
thirdparty\\libwebp\\src\\enc\\config_enc.c: In function 'WebPValidateConfig':
thirdparty\\libwebp\\src\\enc\\config_enc.c:129:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
  129 | }
      | ^
thirdparty\\libwebp\\src\\enc\\picture_enc.c: In function 'WebPPictureAlloc':
thirdparty\\libwebp\\src\\enc\\picture_enc.c:167:1: warning: visibility attribute not 
supported in this configuration; ignored [-Wattributes]
  167 | }
      | ^
thirdparty\\libwebp\\src\\enc\\picture_csp_enc.c: In function 'WebPPictureImportRGB':
thirdparty\\libwebp\\src\\enc\\picture_csp_enc.c:1194:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 1194 | }
      | ^
thirdparty\\libwebp\\src\\enc\\picture_csp_enc.c: In function 'WebPPictureImportRGBA':
thirdparty\\libwebp\\src\\enc\\picture_csp_enc.c:1201:1: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
 1201 | }
      | ^
At top level:
lto1.exe: warning: visibility attribute not supported in this configuration; ignored [-Wattributes]
In member function 'resize',
    inlined from 'compute.constprop' at 
thirdparty\\vhacd\\src\\btConvexHullComputer.cpp:2413:17:
thirdparty\\vhacd\\inc/btAlignedObjectArray.h:209:17: warning: '__builtin_memset' writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  209 |                 new (&m_data[i]) T(fillData);
   
   |                 ^
thirdparty\\vhacd\\inc/btAlignedObjectArray.h: In member function 'compute.constprop':
thirdparty\\vhacd\\inc/btAlignedObjectArray.h:111:13: note: at offset [-8589934592, -4] into destination object 'MEM[(struct btAlignedObjectArray *)this_2(D) + 64B].m_data' of size [0, 9223372036854775807]
  111 |         if (m_data) {
      |             ^
thirdparty\\vhacd\\src\\VHACD.cpp: In member function 'ComputeBestClippingPlane.constprop':
thirdparty\\vhacd\\src\\VHACD.cpp:703:48: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  703 |     Mesh* chs = new Mesh[2 * m_ompNumProcessors];
      |                                                ^
C:/msys64/mingw64/include/c++/11.2.0/new:128:26: note: in a call to allocation function 'operator new []' declared here
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^
thirdparty\\vhacd\\src\\VHACD.cpp:703:48: warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  703 |     Mesh* chs = new Mesh[2 * m_ompNumProcessors];
      |
                                    ^
C:/msys64/mingw64/include/c++/11.2.0/new:128:26: note: in a call to allocation function 'operator new []' declared here
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^
In member function 'resize',
    inlined from 'compute.constprop' at thirdparty\\bullet\\LinearMath\\btConvexHullComputer.cpp:2676:30:
thirdparty\\bullet\\LinearMath\\btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |                                 ^
thirdparty\\bullet\\LinearMath\\btAlignedObjectArray.h: In member function 'compute.constprop':
thirdparty\\bullet\\LinearMath\\btAlignedObjectArray.h:109:21: note: at offset [-8589934592, -4] into destination object 'MEM[(struct btAlignedObjectArray *)this_2(D) + 32B].m_data' of size [0, 9223372036854775807]
  109 |                 if (m_data)
      |                     ^
In member function 'resize',
    inlined from 'compute.constprop' at thirdparty\\bullet\\LinearMath\\btConvexHullComputer.cpp:2678:14:
thirdparty\\bullet\\LinearMath\\btAlignedObjectArray.h:223:33: warning: '__builtin_memset' writing between 4 and 8589934592 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  223 |                                 new (&m_data[i]) T(fillData);
      |
                  ^
thirdparty\\bullet\\LinearMath\\btAlignedObjectArray.h: In member function 'compute.constprop':
thirdparty\\bullet\\LinearMath\\btAlignedObjectArray.h:109:21: note: at offset [-8589934592, -4] into destination object 'MEM[(struct btAlignedObjectArray *)this_2(D) + 96B].m_data' of size [0, 
9223372036854775807]
  109 |                 if (m_data)
      |                     ^
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `platform\\windows\\godot_res.windows.opt.tools.64.o' is incompatible with i386:x86-64 output
collect2.exe: error: ld returned 1 exit status
"
=====
scons: *** [bin\godot.windows.opt.tools.64.exe] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:15:58.440]

Apparently a 32-bit version of windres was used to build godot_res.rc, so it's failing.

@akien-mga
Copy link
Member

akien-mga commented Feb 23, 2022

@Atem1995 Can you check if this workaround works for you too #40286 (comment)?

For the record, this seems to be a packaging bug in MSYS2:

@bruvzg
Copy link
Member

bruvzg commented Feb 23, 2022

windres should take --target= argument to specify target format: pe-i386 and pe-x86-64, but I'm not sure 32-bit version have support for both. It seems like a packaging issue, but I guess we can check if /mingw64/bin/windres.exe or /mingw32/bin/windres.exe exist and use the full path in this case.

@Atem1995
Copy link

Atem1995 commented Feb 23, 2022

E:\Godot\_source_code\godot_3.4.2_stable>scons platform=windows -j 14 use_mingw=yes target=release_debug tools=yes bits=64
scons: Reading SConscript files ...
Configuring for Windows: target=release_debug, bits=64
Using MinGW
Checking for C header file mntent.h... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
[ 78%] Linking Program        ==> bin\godot.windows.opt.tools.64.exe
[100%] progress_finish(["progress_finish"], [])
[100%] Building compilation database compile_commands.json
=====
b"C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `platform\\windows\\godot_res.windows.opt.tools.64.o' is incompatible with i386:x86-64 output\r\ncollect2.exe: error: ld returned 1 exit status\n"
=====
scons: *** [bin\godot.windows.opt.tools.64.exe] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:01:17.168]

@akien-mga This is odd because it compiles successed when I don't specify target.But error when I specified the target **b"C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386 architecture of input file `platform\windows\godot_res.windows.opt.tools.64.o' is incompatible with i386:x86-64 output\r\ncollect2.exe: error: ld returned 1 exit status\n"**This error message is also very strange.

@bruvzg
Copy link
Member

bruvzg commented Feb 23, 2022

It seems like a packaging issue, but I guess we can check if /mingw64/bin/windres.exe or /mingw32/bin/windres.exe exist and use the full path in this case.

Seems like Scons do not like MSYS "Unix" paths, so that's not going to work (at least without some hacks).

And 32-bit windres do not have 64-bit platform support.

Also, I can't reproduce the issue, MSYS is always picking the correct executable, unless you are trying to build 64-bit Godot from MSYS2 MinGW 32-bit environment.

@bruvzg
Copy link
Member

bruvzg commented Feb 23, 2022

With a few hacks it's possible to get MSYS path, but I'm not sure how useful it is (also needs testing on other MinGW distros) - #58473

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants