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

How to use the latest Pyodide for Pyxel Web #462

Closed
kitao opened this issue Apr 17, 2023 · 47 comments
Closed

How to use the latest Pyodide for Pyxel Web #462

kitao opened this issue Apr 17, 2023 · 47 comments
Labels
help wanted Extra attention is needed

Comments

@kitao
Copy link
Owner

kitao commented Apr 17, 2023

Since the latest Pyodide supports SDL2, I'd like update Pyxel Web to work with it instead of the modified version, pyodide-sdl2.

Any help is welcome for that.
@pmp-p, I would appreciate it if you could give me some advice.

@kitao kitao added the help wanted Extra attention is needed label Apr 17, 2023
@ryanking13
Copy link

Hello, Pyodide dev here. I made following changes when porting pyxel:

  1. To reduce the size of the Pyodide main module, I only linked JS parts of SDL2 library to Pyodide main module. So you need to link SDL2 to pyxel itself. I added the following RUSTFLAG that links SDL2 when building pyxel:
export RUSTFLAGS="\
  -C link-arg=-sUSE_SDL=2 \
  -C link-arg=-fPIC \
  -C link-arg=-lSDL2 \
"
  1. We added an API: pyodide.canvas.setElement2D(). This API is used to set a canvas to draw on.
let sdl2Canvas = document.createElement("canvas");
sdl2Canvas.id = "canvas";
pyodide.canvas.setCanvas2D(sdl2Canvas);
  1. Handling unwind exception (Pyodide fatal error occurs in Pyxel on WASM #418) is not yet fully resolved. We found that throwing unwind exceptions corrupts the call stack ([Discussion] Handling "unwind" exception pyodide/pyodide#3697). So for now we added an opt-in flag (pyodide._api._skip_unwind_fatal_error) to ignore unwind errors.
pyodide._api_skip_unwind_fatal_error = true

See also: https://pyodide.org/en/stable/usage/sdl.html

@kitao
Copy link
Owner Author

kitao commented Apr 23, 2023

Thank you for your information.
I tried it and wasm-ld: error: unable to find library -lSDL2 error occured.
I'm wondering Emscripten (emsdk) has the library or not.

@ryanking13
Copy link

I guess you need to explicitly build SDL2 first with embuilder build sdl2 --pic.

@kitao
Copy link
Owner Author

kitao commented Apr 23, 2023

@ryanking13 Thank you! It worked.
Now I'm thinking why it doesn't work when I write the same settings in config under .cargo like this:

[target.wasm32-unknown-emscripten]
rustflags = [
    "-C", "link-arg=-sUSE_SDL=2",
    "-C", "link-arg=-fPIC",
    "-C", "link-arg=-lSDL2",
]

Other options like this in the same file works:

[target.aarch64-apple-darwin]
rustflags = [
    "-C", "link-arg=-undefined",
    "-C", "link-arg=dynamic_lookup",
]

@ryanking13
Copy link

Hmm, yeah I think I also failed to add those configs to config file so I ended up using RUSTFLAGS env variable. I don't know much about how cargo read the config but maybe that file is ignored?

When I look at the cargo documentation, there's following explanation. Maybe it's relevant?

At present, when being invoked from a workspace, Cargo does not read config files from crates within the workspace.
i.e. if a workspace has two crates in it, named /projects/foo/bar/baz/mylib and /projects/foo/bar/baz/mybin,
and there are Cargo configs at /projects/foo/bar/baz/mylib/.cargo/config.toml and /projects/foo/bar/baz/mybin/.cargo/config.toml,
Cargo does not read those configuration files if it is invoked from the workspace root (/projects/foo/bar/baz/).

@kitao
Copy link
Owner Author

kitao commented Apr 24, 2023

Thank you for the useful information. In Makefile, actually I use the same commands except the target name. Specifically, I just call maturin build command.
@messense Do you have any idea of this?

@messense
Copy link

@kitao It's not read by maturin 0.14, but it's implemented in PyO3/maturin#1405, you can try maturin pre-release to test it out: pip install -U --pre maturin.

@kitao
Copy link
Owner Author

kitao commented Apr 24, 2023

@messense Thank you!
Let me make sure the current situation.
After changing the build system to Maturin, Pyxel's config files in .cargo are not used actually.
But Maturin handled the build options for Python extension for Mac instead of the configs and then Pyxel worked.
And now I added new options for new Pyodide and it didn't work because the config files were ignored in the first place.
Is my understanding correct?

And now I changed Maturin 1.0.0-beta.7, but it seems that the configs are not read.
Is there other correct place for the config files?

@kitao
Copy link
Owner Author

kitao commented Apr 24, 2023

By the way, thank you for your continued Maturin updates! @messense

@messense
Copy link

After changing the build system to Maturin, Pyxel's config files in .cargo are not used actually.
But Maturin handled the build options for Python extension for Mac instead of the configs and then Pyxel worked.
And now I added new options for new Pyodide and it didn't work because the config files were ignored in the first place.

maturin sets RUSTFLAGS env var so cargo ignores .cargo files, this is because cargo prefer RUSTFLAGS over config files.

And now I changed Maturin 1.0.0-beta.7, but it seems that the configs are not read.

maturin 1.0.0 beta versions read .cargo config files and merge with RUSTFLAGS using cargo-config2. I'm not sure why it's not working for you, I'll add some logging in maturin so it can be diagnosed with RUST_LOG=maturin=debug maturin build.

@messense
Copy link

Actually CARGO_ENCODED_RUSTFLAGS is already printed with RUST_LOG=maturin=debug maturin build, you can check that.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

@messense
I tried RUST_LOG=maturin=debug maturin build and it seems that CARGO_ENCODED_RUSTFLAGS doesn't refer to .cargo/config of crates.
Is there any possibility that this setting affects it?

[tool.maturin]
manifest-path = "crates/pyxel-extension/Cargo.toml"

@messense
Copy link

I'm not sure. Do you have a branch that I can try to debug?

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

Now I've pushed the latest test code to the develop brunch.
Config files are under each crates' directory.
And if you type make under the project root, RUST_LOG=maturin=debug maturin build is called.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

One more thing, you can set up the venv environment by type `. scripts/setup_python_venv'.
But it's not mandatory if your environment meets Pyxel's requirements.txt

@messense
Copy link

messense commented Apr 25, 2023

I'm seeing this:

$ maturin --version
maturin 1.0.0-beta.7
$ make build-wasm
Skipped 4 files
All done! ✨ 🍰 ✨
52 files left unchanged.
info: component 'rust-std' for target 'wasm32-unknown-emscripten' is up to date
2023-04-25T12:16:15.206485Z DEBUG maturin::project_layout: Found pyproject.toml in working directory at "/Users/messense/Projects/pyxel/pyproject.toml"
2023-04-25T12:16:15.207380Z DEBUG maturin::project_layout: Using cargo manifest path from pyproject.toml "crates/pyxel-extension/Cargo.toml"
2023-04-25T12:16:15.207566Z DEBUG maturin::project_layout: Resolving cargo metadata from "/Users/messense/Projects/pyxel/crates/pyxel-extension/Cargo.toml"
2023-04-25T12:16:15.280852Z DEBUG maturin::project_layout: Project layout resolved project_root=/Users/messense/Projects/pyxel python_dir=/Users/messense/Projects/pyxel/python rust_module=/Users/messense/Projects/pyxel/python/pyxel_extension python_module=/Users/messense/Projects/pyxel/python/pyxel_extension extension_name=pyxel_extension
🔗 Found pyo3 bindings with abi3 support for Python ≥ 3.7
⚠️  Warning: skipped unavailable python interpreter 'python3.8' from pyenv
2023-04-25T12:16:15.701007Z DEBUG maturin::python_interpreter: Found CPython interpreter at /opt/homebrew/opt/[email protected]/bin/python3.9
2023-04-25T12:16:15.766912Z DEBUG maturin::python_interpreter: Found CPython interpreter at /opt/homebrew/opt/[email protected]/bin/python3.10
2023-04-25T12:16:15.785802Z DEBUG maturin::python_interpreter: Found CPython interpreter at /Users/messense/.pyenv/versions/test-3.11/bin/python3.11
🐍 Not using a specific python interpreter
2023-04-25T12:16:15.787536Z DEBUG maturin::compile: Setting `-Z link-native-libraries=no` for Emscripten
2023-04-25T12:16:15.787541Z DEBUG maturin::compile: Setting additional linker args for Emscripten: ["-C", "link-arg=-sSIDE_MODULE=2", "-C", "link-arg=-sWASM_BIGINT"]
2023-04-25T12:16:15.787565Z DEBUG maturin::compile: Running CARGO_ENCODED_RUSTFLAGS="-C\u{1f}link-arg=-sUSE_SDL=2\u{1f}-C\u{1f}link-arg=-fPIC\u{1f}-C\u{1f}link-arg=-lSDL2\u{1f}-Z\u{1f}link-native-libraries=no" "cargo" "rustc" "--target" "wasm32-unknown-emscripten" "--message-format" "json" "--manifest-path" "/Users/messense/Projects/pyxel/crates/pyxel-extension/Cargo.toml" "--release" "--lib" "--" "-C" "link-arg=-sSIDE_MODULE=2" "-C" "link-arg=-sWASM_BIGINT"

CARGO_ENCODED_RUSTFLAGS="-C\u{1f}link-arg=-sUSE_SDL=2\u{1f}-C\u{1f}link-arg=-fPIC\u{1f}-C\u{1f}link-arg=-lSDL2\u{1f}-Z\u{1f}link-native-libraries=no"

You can see that the config file is loaded.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

Interesting. On my M2 MacBook Air,

maturin --version
maturin 1.0.0-beta.7
🐍 Not using a specific python interpreter
2023-04-25T12:23:17.114533Z DEBUG maturin::compile: Setting `-Z link-native-libraries=no` for Emscripten
2023-04-25T12:23:17.114537Z DEBUG maturin::compile: Setting additional linker args for Emscripten: ["-C", "link-arg=-sSIDE_MODULE=2", "-C", "link-arg=-sWASM_BIGINT"]
2023-04-25T12:23:17.114553Z DEBUG maturin::compile: Running CARGO_ENCODED_RUSTFLAGS="-Z\u{1f}link-native-libraries=no" "cargo" "rustc" "--target" "wasm32-unknown-emscripten" "--message-format" "json" "--manifest-path" "/Users/takashi/Library/CloudStorage/OneDrive-\xe5\x80\x8b\xe4\xba\xba\xe7\x94\xa8/projects/pyxel/crates/pyxel-extension/Cargo.toml" "--release" "--lib" "--" "-C" "link-arg=-sSIDE_MODULE=2" "-C" "link-arg=-sWASM_BIGINT"

@messense
Copy link

Maybe you can try it out in GitHub Actions? Or in a different path that's not in OneDrive?

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

I copied the pyxel directory to an other place and tried again for now.

🐍 Not using a specific python interpreter
2023-04-25T12:33:12.995560Z DEBUG maturin::compile: Setting `-Z link-native-libraries=no` for Emscripten
2023-04-25T12:33:12.995565Z DEBUG maturin::compile: Setting additional linker args for Emscripten: ["-C", "link-arg=-sSIDE_MODULE=2", "-C", "link-arg=-sWASM_BIGINT"]
2023-04-25T12:33:12.995596Z DEBUG maturin::compile: Running CARGO_ENCODED_RUSTFLAGS="-Z\u{1f}link-native-libraries=no" "cargo" "rustc" "--target" "wasm32-unknown-emscripten" "--message-format" "json" "--manifest-path" "/Users/takashi/test/pyxel/crates/pyxel-extension/Cargo.toml" "--release" "--lib" "--" "-C" "link-arg=-sSIDE_MODULE=2" "-C" "link-arg=-sWASM_BIGINT"

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

Now I'm trying it on GitHub Actions.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

Hmm, in the case of GitHub Actions, it stops with a compilation error on Intel Mac. Is the pyproject.toml setting not enabled by this setting?

[tool.maturin.target."x86_64-apple-darwin"]
macos-deployment-target = "10.7"

@messense
Copy link

Collecting maturin (from -r requirements.txt (line 4))
  Downloading maturin-0.14.17-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (14.9 MB)

You are using 0.14.17.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

Could you give me an advice about how to change the requirements.txt?

@messense
Copy link

Well you can just write maturin==1.0.0b7 in it.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

I changed the requirements.txt, but the old version was installed.
Does the appropriate wheel for Mac exist?

I pushed the updated requirements.txt for your check.

@messense
Copy link

maturin --pre

I don't think you are following my previous instruction. You need to change it to maturin==1.0.0b7.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

Ah sorry, I didn't commit button yet and now I've pushed it.
But I tested it on my local environment.
And it seems that the same result occured on GitHub Actions.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

My mistake. Now the correct version of Maturin is installed.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

@messense Thank you.
In the copied directory (not under OneDrive), Maturin referred to the config file correctly though I don't know how to work it under the OneDrive path. Probably its unicode path causes this trouble, but I don't know how to change OneDrive's default system path. In my terminal, it consists of ascii characters, but it is changed into unicode path automatically by OneDrive.

@kitao
Copy link
Owner Author

kitao commented Apr 25, 2023

@ryanking13 I've faced an another issue.
After loading the latest Pyxel wheel in JavaScript, some error occurs when a Python code impots Pyxel.

ModuleNotFoundError: The module 'pyxel' is included in the Pyodide distribution, but it is not installed.
You can install it by calling:
  await micropip.install("pyxel") in Python, or
  await pyodide.loadPackage("pyxel") in JavaScript
See https://pyodide.org/en/stable/usage/loading-packages.html for more details.

Is this the result of conflict between the pre-registered Pyxel in Pyodide and the latest Pyxel?

@ryanking13
Copy link

Is this the result of conflict between the pre-registered Pyxel in Pyodide and the latest Pyxel?

I don't think so. Is there other error messages showing in browser console?

@kitao
Copy link
Owner Author

kitao commented Apr 26, 2023

@ryanking13

There's no error on browser console.

Launch Pyxel
pyxel.js:45 {command: 'run', root: '../../python/pyxel/examples', name: '02_jump_game.py', script: undefined, packages: undefined, …}
NoSleep.min.js:2 Wake Lock active.
pyodide.asm.js:9 Loading pyxel
pyodide.asm.js:9 Loaded pyxel
NoSleep.min.js:2 Wake Lock released.
NoSleep.min.js:2 Wake Lock active.
NoSleep.min.js:2 Wake Lock released.
NoSleep.min.js:2 Wake Lock active.
NoSleep.min.js:2 Wake Lock released.
NoSleep.min.js:2 Wake Lock active.
NoSleep.min.js:2 Wake Lock released.
NoSleep.min.js:2 Wake Lock active.
NoSleep.min.js:2 Wake Lock released.
NoSleep.min.js:2 Wake Lock active.

And what pyxel.js does is as follows:

async function _loadPyodideAndPyxel(canvas) {
  await _loadScript(NO_SLEEP_URL);
  let noSleep = new NoSleep();
  noSleep.enable();
  await _loadScript(PYODIDE_URL);
  let pyodide = await loadPyodide();
  pyodide._api._skip_unwind_fatal_error = true;
  pyodide.canvas.setCanvas2D(canvas);
  await pyodide.loadPackage(_scriptDir() + PYXEL_WHEEL_PATH);
  let FS = pyodide.FS;
  FS.mkdir(PYXEL_WORKING_DIRECTORY);
  FS.chdir(PYXEL_WORKING_DIRECTORY);
  return pyodide;
}

It just does pyodide.loadPackage(PYXEL_WHEEL) after loadPyodide() and worked with the previous Pyodide.

@ryanking13
Copy link

Hmm, okay. Could you share the wheel file so that I can test?

@kitao
Copy link
Owner Author

kitao commented Apr 26, 2023

Here's a zipped version of wheel file.
pyxel-1.9.14-cp37-abi3-emscripten_3_1_36_wasm32.whl.zip

@ryanking13
Copy link

ryanking13 commented Apr 26, 2023

@kitao It looks like the wheel file does not contain Python files. Maybe maturin didn't correctly detect the source directory for some reason?

$ unzip -l pyxel-1.9.14-cp37-abi3-emscripten_3_1_36_wasm32
Archive:  pyxel-1.9.14-cp37-abi3-emscripten_3_1_36_wasm32.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
    28112  2023-04-26 06:01   pyxel-1.9.14.dist-info/METADATA
      116  2023-04-26 06:01   pyxel-1.9.14.dist-info/WHEEL
       38  2023-04-26 06:01   pyxel-1.9.14.dist-info/entry_points.txt
     1069  2023-04-26 06:01   pyxel-1.9.14.dist-info/license_files/LICENSE
      143  2023-04-26 06:01   pyxel_extension/__init__.py
  3504174  2023-04-26 06:01   pyxel_extension/pyxel_extension.abi3.so
      582  2023-04-26 06:01   pyxel-1.9.14.dist-info/RECORD
---------                     -------
  3534234                     7 files

@kitao
Copy link
Owner Author

kitao commented Apr 26, 2023

Thank you for your great effort!
Now I've noticed that all Pyxel wheels don't include python files.
I'll check how to use the latest version of maturin.

@kitao
Copy link
Owner Author

kitao commented Apr 26, 2023

I tried maturin 0.13.7 which is the previous version Pyxel used just in case and it worked.
Probably python-source usage changed.

@messense
Copy link

[package.metadata.maturin]
name = "pyxel.pyxel_extension"

package.metadata.maturin is removed in maturin 1.0 pre-releases, it's now specified in pyproject.toml instead.

[tool.maturin]
module-name = "pyxel.pyxel_extension"

@kitao
Copy link
Owner Author

kitao commented Apr 26, 2023

@messense Thank you. I modified pyproject.toml as you suggested.
But unfortunately pyxel_extension does not appear under python/pyxel directory and caused an import error.
Do I miss something? (I pushed the current code to the develop brunch just in case)

@messense
Copy link

messense commented Apr 26, 2023

Sorry I don't understand what was the issue you are facing, the whl looks fine to me:

$ unzip -l dist/pyxel-1.9.15-cp37-abi3-emscripten_3_1_36_wasm32.whl
Archive:  dist/pyxel-1.9.15-cp37-abi3-emscripten_3_1_36_wasm32.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
    28111  04-26-2023 11:35   pyxel-1.9.15.dist-info/METADATA
      116  04-26-2023 11:35   pyxel-1.9.15.dist-info/WHEEL
       38  04-26-2023 11:35   pyxel-1.9.15.dist-info/entry_points.txt
     1069  04-26-2023 11:35   pyxel-1.9.15.dist-info/license_files/LICENSE
    16362  04-26-2023 11:35   pyxel/__init__.pyi
       60  04-26-2023 11:35   pyxel/__init__.py
    11094  04-26-2023 11:35   pyxel/cli.py
      763  04-26-2023 11:35   pyxel/examples/12_perlin_noise.py
      609  04-26-2023 11:35   pyxel/examples/99_flip_animation.py
     8638  04-26-2023 11:35   pyxel/examples/09_shooter.py
      452  04-26-2023 11:35   pyxel/examples/01_hello_pyxel.py
     4375  04-26-2023 11:35   pyxel/examples/03_draw_api.py
    29948  04-26-2023 11:35   pyxel/examples/megaball.pyxapp
     4211  04-26-2023 11:35   pyxel/examples/02_jump_game.py
     1180  04-26-2023 11:35   pyxel/examples/08_triangle_api.py
     3693  04-26-2023 11:35   pyxel/examples/04_sound_api.py
     3095  04-26-2023 11:35   pyxel/examples/13_bitmap_font.py
     7880  04-26-2023 11:35   pyxel/examples/10_platformer.py
     4031  04-26-2023 11:35   pyxel/examples/06_click_game.py
     7738  04-26-2023 11:35   pyxel/examples/07_snake.py
      551  04-26-2023 11:35   pyxel/examples/05_color_palette.py
      248  04-26-2023 11:35   pyxel/examples/assets/pyxel_logo_38x16.png
     2466  04-26-2023 11:35   pyxel/examples/assets/jump_game.pyxres
  1086726  04-26-2023 11:35   pyxel/examples/assets/umplus_j12r.bdf
     5635  04-26-2023 11:35   pyxel/examples/assets/platformer.pyxres
  1017044  04-26-2023 11:35   pyxel/examples/assets/umplus_j10r.bdf
    12895  04-26-2023 11:35   pyxel/examples/assets/sample.pyxres
      181  04-26-2023 11:35   pyxel/examples/assets/cat_16x16.png
     4154  04-26-2023 11:35   pyxel/examples/assets/offscreen.pyxres
    13941  04-26-2023 11:35   pyxel/examples/assets/noguchi_128x128.png
      310  04-26-2023 11:35   pyxel/examples/assets/tileset_24x32.png
     3839  04-26-2023 11:35   pyxel/examples/11_offscreen.py
    20880  04-26-2023 11:35   pyxel/examples/30SecondsOfDaylight.pyxapp
        0  04-26-2023 11:35   pyxel/py.typed
       29  04-26-2023 11:35   pyxel/__main__.py
     5078  04-26-2023 11:35   pyxel/editor/piano_roll.py
     6380  04-26-2023 11:35   pyxel/editor/image_viewer.py
     4341  04-26-2023 11:35   pyxel/editor/tilemap_editor.py
    16961  04-26-2023 11:35   pyxel/editor/canvas_panel.py
     4496  04-26-2023 11:35   pyxel/editor/sound_field.py
       79  04-26-2023 11:35   pyxel/editor/__init__.py
     8294  04-26-2023 11:35   pyxel/editor/sound_editor.py
     5276  04-26-2023 11:35   pyxel/editor/piano_keyboard.py
     3165  04-26-2023 11:35   pyxel/editor/sound_selector.py
     8251  04-26-2023 11:35   pyxel/editor/field_cursor.py
     1442  04-26-2023 11:35   pyxel/editor/octave_bar.py
     6416  04-26-2023 11:35   pyxel/editor/music_editor.py
     1173  04-26-2023 11:35   pyxel/editor/settings.py
     7265  04-26-2023 11:35   pyxel/editor/app.py
     3390  04-26-2023 11:35   pyxel/editor/music_field.py
     1772  04-26-2023 11:35   pyxel/editor/additional_apis.py
     1237  04-26-2023 11:35   pyxel/editor/assets/editor_220x160.png
     3960  04-26-2023 11:35   pyxel/editor/image_editor.py
     2027  04-26-2023 11:35   pyxel/editor/widgets/radio_button.py
     9030  04-26-2023 11:35   pyxel/editor/widgets/widget.py
     1214  04-26-2023 11:35   pyxel/editor/widgets/toggle_button.py
      509  04-26-2023 11:35   pyxel/editor/widgets/__init__.py
     6084  04-26-2023 11:35   pyxel/editor/widgets/scroll_bar.py
      763  04-26-2023 11:35   pyxel/editor/widgets/image_toggle_button.py
     2110  04-26-2023 11:35   pyxel/editor/widgets/color_picker.py
     1896  04-26-2023 11:35   pyxel/editor/widgets/button.py
      768  04-26-2023 11:35   pyxel/editor/widgets/image_button.py
      335  04-26-2023 11:35   pyxel/editor/widgets/settings.py
     2095  04-26-2023 11:35   pyxel/editor/widgets/number_picker.py
      911  04-26-2023 11:35   pyxel/editor/widgets/widget_var.py
      913  04-26-2023 11:35   pyxel/editor/widgets/text_button.py
     3329  04-26-2023 11:35   pyxel/editor/editor_base.py
     2983  04-26-2023 11:35   pyxel/editor/tilemap_viewer.py
 82746781  04-26-2023 11:35   pyxel/pyxel_extension.abi3.so
     6102  04-26-2023 11:35   pyxel-1.9.15.dist-info/RECORD
---------                     -------
 85179188                     70 files

@kitao
Copy link
Owner Author

kitao commented Apr 26, 2023

The error was this:

ImportError: dlopen(/Users/takashi/Library/CloudStorage/OneDrive-個人用/projects/pyxel/venv/lib/python3.11/site-packages/pyxel/pyxel_extension.abi3.so, 0x0002): symbol not found in flat namespace '___isPlatformVersionAtLeast'

Extension lib exists but is doesn't satisfy some condition?

@messense
Copy link

@kitao
Copy link
Owner Author

kitao commented Apr 27, 2023

@messense Thank you.
I'm wondering why I faces this error now and looking for the simplest solution.

@kitao
Copy link
Owner Author

kitao commented Apr 28, 2023

@messense
If I restore the version of Maturin to 0.13.7, symbol not found in flat namespace '___isPlatformVersionAtLeast' doesn't occur and Pyxel works on my M2 Mac.
What's the difference of Mac build envirionment between 0.13.7 and 1.0.0b7?

@messense
Copy link

MACOSX_DEPLOYMENT_TARGET, #431

@kitao
Copy link
Owner Author

kitao commented Apr 28, 2023

Yes. I had set the targets according to your past advices.
https://github.com/kitao/pyxel/blob/develop/pyproject.toml#L35-L39

I also tried "10.12" for aarch64 but the result was the same though I'm not sure its the proper version.

@kitao
Copy link
Owner Author

kitao commented Apr 28, 2023

I understood it happened when the version was too old and decided to add build.rs for covering old versions.
Thank you.

@kitao kitao closed this as completed Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants