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

'mix compile' fails when using Python 3.11 #14

Open
zetetic opened this issue Dec 17, 2023 · 5 comments
Open

'mix compile' fails when using Python 3.11 #14

zetetic opened this issue Dec 17, 2023 · 5 comments

Comments

@zetetic
Copy link

zetetic commented Dec 17, 2023

macOS 14.2

$ elixir -v
Erlang/OTP 26 [erts-14.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Elixir 1.15.7 (compiled with Erlang/OTP 26)
$ python --version
Python 3.11.6

When running 'mix compile' on a new Elixir project including ratatouille (which depends on ex_termbox):

$ mix compile
==> ex_termbox
cd c_src/termbox && CFLAGS=-fPIC ./waf configure --prefix=. && ./waf
Waf: The wscript in '/Users/tomhead/projects/nrat/deps/ex_termbox/c_src/termbox' is unreadable
Traceback (most recent call last):
  File "/Users/tomhead/projects/nrat/deps/ex_termbox/c_src/termbox/.waf3-2.0.14-e67604cd8962dbdaf7c93e0d7470ef5b/waflib/Scripting.py", line 102, in waf_entry_point
    set_main_module(wscript)
  File "/Users/tomhead/projects/nrat/deps/ex_termbox/c_src/termbox/.waf3-2.0.14-e67604cd8962dbdaf7c93e0d7470ef5b/waflib/Scripting.py", line 142, in set_main_module
    Context.g_module=Context.load_module(file_path)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tomhead/projects/nrat/deps/ex_termbox/c_src/termbox/.waf3-2.0.14-e67604cd8962dbdaf7c93e0d7470ef5b/waflib/Context.py", line 349, in load_module
    code=Utils.readf(path,m='rU',encoding=encoding)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tomhead/projects/nrat/deps/ex_termbox/c_src/termbox/.waf3-2.0.14-e67604cd8962dbdaf7c93e0d7470ef5b/waflib/Utils.py", line 146, in readf
    with open(fname,m)as f:
         ^^^^^^^^^^^^^
ValueError: invalid mode: 'rUb'
make: *** [c_src/termbox/build/src/libtermbox.a] Error 2

Downgrading Python to 3.10 allows 'mix compile' to complete successfully.

I think this is related to the following issue, which mentions that support for the deprecated 'U' flag was removed in v3.11:

open(): remove 'U' mode, deprecated since Python 3.3 #81511

@jimurrito
Copy link

@zetetic same issue here. My team can repro the issue ondemand as well with Python v3.11 +, and remediated with python v3.10

@jdmarshall
Copy link

Still happening with 3.12.2

@sschuldenzucker
Copy link

NB it also fails for 3.12.4 but for a different reason: here, the imp module is missing, which is deprecated. So this would be another thing that needs to be fixed.

@jimurrito
Copy link

Looks like this is an error from Termbox itself. This repo is just the bindings for Termbox in Elixir. The last update to Termbox was 6 years ago. Likely the issue should be raised there, but I doubt they will update it for the newer versions of Python. Link to Termbox repo https://github.com/nsf/termbox

@dragon0
Copy link

dragon0 commented Sep 1, 2024

The issue is that Termbox is using waf version 2.0.14. It looks like this issue has been fixed in waf 2.1.2: https://gitlab.com/ita1024/waf/blob/master/ChangeLog

I've opened an issue in termbox: nsf/termbox#136

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

No branches or pull requests

5 participants