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

WIP: Build with target wasm #82

Closed
wants to merge 12 commits into from

Conversation

IsabelParedes
Copy link
Member

@IsabelParedes IsabelParedes commented May 17, 2024

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe:

@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

@IsabelParedes
Copy link
Member Author

@conda-forge-admin, please rerender

recipe/build.sh Outdated
@@ -3,6 +3,8 @@
set -ex

export CXXFLAGS="${CXXFLAGS} -D__STDC_FORMAT_MACROS -D_LIBCPP_DISABLE_AVAILABILITY"
export EMSDK_PATH=${CONDA_EMSDK_DIR}
export WASI_SDK_PATH="" # FIXME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/bin/sh: /bin/clang: No such file or directory
make[2]: *** [src/runtime/legacy/CMakeFiles/lfortran_runtime_wasm.dir/build.make:73: src/runtime/legacy/lfortran_runtime_wasm.o] Error 127
make[1]: *** [CMakeFiles/Makefile2:692: src/run

We need the WASI_SDK_PATH to be set for the above. We use WASI_SDK_PATH/bin/clang to compile our runtime library src/libasr/runtime/lfortran_intrinsics.c to WebAssembly Object file which we can later link.

@certik
Copy link
Contributor

certik commented May 19, 2024

Thanks @IsabelParedes for the PR!

Let's document what the blockers are and let's fix them one by one.

Is setting WASI_SDK_PATH one such blocker? Does the suggestion from @Shaikh-Ubaid above help?

Are there other blockers?

@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

I do have some suggestions for making it better though...

For recipe:

  • You are setting MACOSX_SDK_VERSION below c_stdlib_version, in conda_build_config.yaml which is not possible! Please ensure MACOSX_SDK_VERSION is at least c_stdlib_version (you can leave it out if it is equal).
    If you are not setting c_stdlib_version yourself, this means you are requesting a version below the current global baseline in conda-forge. In this case, you also need to override c_stdlib_version and MACOSX_DEPLOYMENT_TARGET locally.

@IsabelParedes
Copy link
Member Author

[  4%] Cross compiling lfortran_intrinscs.c to lfortran_runtime_wasm.o
../../../../wasi-sdk-22.0/bin/clang: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by ../../../../wasi-sdk-22.0/bin/clang)
make[2]: *** [src/runtime/legacy/CMakeFiles/lfortran_runtime_wasm.dir/build.make:73: src/runtime/legacy/lfortran_runtime_wasm.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:692: src/runtime/legacy/CMakeFiles/lfortran_runtime_wasm.dir/all] Error 2

@IsabelParedes
Copy link
Member Author

@Shaikh-Ubaid @certik

When building locally from the main branch (commit 0ea994d2c6bf834ca73fd298bd5e4256db4769b4), it is not necessary to have the wasi-sdk installed. So I'm not sure if WASI_SKD_PATH is a problem in general or just an problem for this version.

@Shaikh-Ubaid
Copy link
Member

Shaikh-Ubaid commented May 21, 2024

When building locally from the main branch (commit 0ea994d2c6bf834ca73fd298bd5e4256db4769b4), it is not necessary to have the wasi-sdk installed. So I'm not sure if WASI_SKD_PATH is a problem in general or just an problem for this version.

You need atleast WASI_SDK_PATH or EMSDK_PATH to be set. (Having both of them set should be fine, I think.)

  • WASI_SDK_PATH is needed if you want to use clang wasi for linking and target the wasi architecture, that is lfortran examples/expr2.py --target=wasm32-wasi
  • EMSDK_PATH is needed if you want to use emscripten, that is lfortran examples/expr2.py --target=wasm32-unknown-emscripten

# To install wasi-sdk
- wget # [unix]
- tar # [unix]
- glib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we pin this to the exact version that is missing?

/lib64/libm.so.6: version `GLIBC_2.27' not found

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately glib v2.27 is not available. The lowest version on conda-forge is v2.48

recipe/build.sh Outdated
@@ -2,7 +2,15 @@

set -ex

# Install WASI SDK
export WASI_VERSION=22
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have tried with WASI SDK version 19 on my system and version 21 on Ondrej's system. So, maybe let's try/use one of these?

@Shaikh-Ubaid
Copy link
Member

Looks like both 19 and 21 did not work. I will explore this on coming Saturday/Sunday.

@Shaikh-Ubaid
Copy link
Member

We made some progress over here #83. I think we are close. Also some observations:

  • strangely config.h is expected to be auto-generated by cmake, but it does not seems to be getting generated or the WASI_SDK/bin/clang gets executed earlier than the generation of config.h (and thus cannot find it).
  • Using emsdk would not help for lfortran 0.35.0. EMSDK_PATH is supported in the latest main at LFortran, but the release 0.35.0 does not have support for it. (we might need to make/wait-for another release).

@certik
Copy link
Contributor

certik commented May 29, 2024

We can make a new release of LFortran any time. Just let me know.

@IsabelParedes
Copy link
Member Author

Thanks for the new release!!!

@IsabelParedes
Copy link
Member Author

Closing this in favor of v0.36.0 #84

@IsabelParedes IsabelParedes deleted the wasm branch June 5, 2024 10:07
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

Successfully merging this pull request may close these issues.

3 participants