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

CheckTypeSize fails when running in MSYS2 #4323

Open
jdpipe opened this issue Mar 13, 2023 · 2 comments
Open

CheckTypeSize fails when running in MSYS2 #4323

jdpipe opened this issue Mar 13, 2023 · 2 comments
Labels
Configure any issues related to Configure contexts msys The msys2 environment on Windows

Comments

@jdpipe
Copy link

jdpipe commented Mar 13, 2023

Describe the bug
The following fairly trivial SConstruct file fails on MSYS2:

# SConstuct
import os
env = Environment(tools=["default","mingw"])
conf = Configure(env)
conf.env['SIZEOF_INT'] = conf.CheckTypeSize("int")
conf.env['SIZEOF_VOIDP'] = conf.CheckTypeSize("void *")
env = conf.Finish()
print("size of int:",env['SIZEOF_INT'])
print("size of void*:",env['SIZEOF_VOIDP'])
print("env['PLATFORM'] =",env['PLATFORM'])
print("env['HOST_OS'] =",env['HOST_OS'])

env.Program('hello',['hello.c'])
// hello.c
#include<stdio.h>
int main(void){fprintf(stderr,"hello from C\n"); return 0;}

The output is below. The output '.sconf_temp' is not recognized comes from Windows being passed a forward-slash-separated path, because on this version of Python, os.path.sep is set to /.

john@WIN-HG6RBDGB9LV UCRT64 ~/testsize
$ scons --config=force
scons: Reading SConscript files ...
'.sconf_temp' is not recognized as an internal or external command,
operable program or batch file.
Checking size of int ... no
'.sconf_temp' is not recognized as an internal or external command,
operable program or batch file.
Checking size of void * ... no
size of int: 0
size of void*: 0
env['PLATFORM'] = win32
env['HOST_OS'] = win32
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.

A solution for this issue would be the automatic detection of the MSYS platform, (issue #4311), but there may be other simpler fixes to consider.

Required information

  • Discord discussion: https://discord.com/channels/571796279483564041/1078868924248105032
  • Version of SCons: 4.5.1
  • Version of Python: 3.10.10 (mingw-w64-ucrt-x86_64-python 3.10.10-1 in MSYS2)
  • Which python distribution if applicable: MSYS2
  • How you installed SCons: pip install scons
  • What Platform are you on? MSY2
  • How to reproduce your issue? As above.
  • How you invoke scons scons --config=force
@jdpipe
Copy link
Author

jdpipe commented Mar 13, 2023

The workaround for this issue is to invoke MSYSTEM= scons, which disables MSYS2's Python from setting os.path.sep to /. However, this is inconvenient and undesirable for other reasons, as a 'general solution'.

@mwichmann mwichmann added Configure any issues related to Configure contexts msys The msys2 environment on Windows labels Apr 19, 2023
@mwichmann
Copy link
Collaborator

A lot of the discussion around the questions opened by this ended up discussed elsewhere, but this particular issue should actually have been resolved by PR #4307.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Configure any issues related to Configure contexts msys The msys2 environment on Windows
Projects
None yet
Development

No branches or pull requests

2 participants