msys2 / MSYS2-packages

Package scripts for MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
1.3k stars 490 forks source link

Running SCons in Mingw64's python3 fails to import a site tool #1556

Open pauschar opened 5 years ago

pauschar commented 5 years ago

Hi, I installed

I had to change the shebang in mingw64/bin/scons to use python3: #!/mingw64/bin/python3 instead of #!/usr/bin/env python. With this change, scons --version tells that it it 3.0.3.

Now, actually running scons fails- it seems unable to import site tools from my (local= site_scons\site_tools:

`$ scons -h scons: Reading SConscript files ... ImportError: cannot import name 'generate' from 'gcc_x86' (E:/rfs_projects/radar_sdk_1/site_scons/site_tools/gcc_x86/init.py): File "E:/rfs_projects/radar_sdk_1/SConstruct", line 47: SConscript('libs/unit_test/SConscript', exports=['rsdk_inv']) File "e:/rfs_projects/radar_sdk_1/tools/msys64/mingw64/lib/python3.7/site-packages/scons\SCons\Script\SConscript.py", line 667: return method(*args, *kw) File "e:/rfs_projects/radar_sdk_1/tools/msys64/mingw64/lib/python3.7/site-packages/scons\SCons\Script\SConscript.py", line 604: return _SConscript(self.fs, files, subst_kw) File "e:/rfs_projects/radar_sdk_1/tools/msys64/mingw64/lib/python3.7/site-packages/scons\SCons\Script\SConscript.py", line 285: call_stack[-1].globals) File "E:/rfs_projects/radar_sdk_1/libs/unit_test/SConscript", line 69: 'FLAGS': '-std=gnu99 -g3 -O0' File "e:/rfs_projects/radar_sdk_1/tools/msys64/mingw64/lib/python3.7/site-packages/scons\SCons\Environment.py", line 1788: tool = SCons.Tool.Tool(tool, toolpath, kw) File "e:/rfs_projects/radar_sdk_1/tools/msys64/mingw64/lib/python3.7/site-packages/scons\SCons\Tool__init__.py", line 117: module = self._tool_module() File "e:/rfs_projects/radar_sdk_1/tools/msys64/mingw64/lib/python3.7/site-packages/scons\SCons\Tool__init__.py", line 232: module = spec.loader.load_module(spec.name) File "", line 407:

File "", line 907:

File "", line 732:

File "", line 265:

File "", line 696:

File "", line 677:

File "", line 728:

File "", line 219:

File "E:/rfs_projects/radar_sdk_1/site_scons/site_tools/gcc_x86/init.py", line 1: from gcc_x86 import generate ` The 'tool 'gcc_x68' and its init does exist, in fact the whole thing works fine when using MSYS2/python2 and the pacman SCons package, The reason I would like to not use this is a massive performance problem of Py2 when walking dir's. In MSYS2, Py2 can't really benefit from scandir because MSYS2's Py2 patches sys.platform to 'msys', making scandir's optimization not appliable. Moreover, we would like to migrate to Py3, in fact Py2 is around only due to MSYS2 seems to require Py2. All our other stuff is already for Py3.

I'm not sure what is going wrong here, googling this gives e.g. http://scons.1086193.n5.nabble.com/Python-3-issue-td41665.html , but this is inconclusive to me.

Is there anyone who knows what to do in order to get scons running under mingw64?

Thx in advance