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

[Build] Building wasm static lib in docker #17780

Open
jozefchutka opened this issue Oct 4, 2023 · 2 comments
Open

[Build] Building wasm static lib in docker #17780

jozefchutka opened this issue Oct 4, 2023 · 2 comments
Labels
build build issues; typically submitted using template platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot

Comments

@jozefchutka
Copy link

jozefchutka commented Oct 4, 2023

Describe the issue

On Apple M2, Emscripten build fails when compiled in docker (from debian:12.1). There are two issues to address:

  1. Emsdk installing fails error: tool or SDK not found: '3.1.46':
2023-10-04 06:25:05,002 build [INFO] - Installing emsdk...
WARNING: arm64-linux binaries are not available for all releases.
See https://github.com/emscripten-core/emsdk/issues/547
error: tool or SDK not found: '3.1.46'
Traceback (most recent call last):
  File "/piper-wasm/modules/onnxruntime/tools/ci_build/build.py", line 2695, in <module>
    sys.exit(main())
             ^^^^^^
  File "/piper-wasm/modules/onnxruntime/tools/ci_build/build.py", line 2534, in main
    run_subprocess([emsdk_file, "install", emsdk_version], cwd=emsdk_dir)
  File "/piper-wasm/modules/onnxruntime/tools/ci_build/build.py", line 800, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/piper-wasm/modules/onnxruntime/tools/python/util/run.py", line 49, in run
    completed_process = subprocess.run(
                        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/piper-wasm/modules/onnxruntime/cmake/external/emsdk/emsdk', 'install', '3.1.46']' returned non-zero exit status 1.
  1. When emsdk issue is resolved, the build proceeds until it fails on qemu-i386: Could not open '/lib/ld-linux.so.2': No such file or directory

-- WebAssembly Build is enabled
-- Configuring done (83.8s)
-- Generating done (4.1s)
CMake Warning:
  Manually-specified variables were not used by the project:

    Python_EXECUTABLE
    onnxruntime_EMSCRIPTEN_SETTINGS


-- Build files have been written to: /piper-wasm/modules/onnxruntime/build/Linux/Release
2023-10-04 06:20:29,039 build [INFO] - Building targets for Release configuration
[  0%] Running gen_proto.py on onnx/onnx.in.proto
Processing /piper-wasm/modules/onnxruntime/build/Linux/Release/_deps/onnx-src/onnx/onnx.in.proto
Writing /piper-wasm/modules/onnxruntime/build/Linux/Release/_deps/onnx-build/onnx/onnx-ml.proto
Writing /piper-wasm/modules/onnxruntime/build/Linux/Release/_deps/onnx-build/onnx/onnx-ml.proto3
generating /piper-wasm/modules/onnxruntime/build/Linux/Release/_deps/onnx-build/onnx/onnx_pb.py
[  0%] Running C++ protocol buffer compiler on /piper-wasm/modules/onnxruntime/build/Linux/Release/_deps/onnx-build/onnx/onnx-ml.proto
qemu-i386: Could not open '/lib/ld-linux.so.2': No such file or directory
gmake[2]: *** [_deps/onnx-build/CMakeFiles/gen_onnx_proto.dir/build.make:74: _deps/onnx-build/onnx/onnx-ml.pb.cc] Error 255
gmake[1]: *** [CMakeFiles/Makefile2:5585: _deps/onnx-build/CMakeFiles/gen_onnx_proto.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2
Traceback (most recent call last):
  File "/piper-wasm/modules/onnxruntime/tools/ci_build/build.py", line 2695, in <module>
    sys.exit(main())
             ^^^^^^
  File "/piper-wasm/modules/onnxruntime/tools/ci_build/build.py", line 2588, in main
    build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
  File "/piper-wasm/modules/onnxruntime/tools/ci_build/build.py", line 1494, in build_targets
    run_subprocess(cmd_args, env=env)
  File "/piper-wasm/modules/onnxruntime/tools/ci_build/build.py", line 800, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/piper-wasm/modules/onnxruntime/tools/python/util/run.py", line 49, in run
    completed_process = subprocess.run(
                        ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/cmake', '--build', '/piper-wasm/modules/onnxruntime/build/Linux/Release', '--config', 'Release']' returned non-zero exit status 2.
root@e24313a5d869:/piper-wasm/modules/onnxruntime# 

Urgency

No response

Target platform

wasm

Build script

Following flags are being used:

./build.sh --config Release --build_wasm_static_lib --skip_tests --enable_wasm_debug_info --allow_running_as_root --disable_wasm_exception_catching --disable_rtti --emsdk_version 3.1.46

same errors when added

--cmake_extra_defines CMAKE_OSX_ARCHITECTURES=arm64

Error / output

error: tool or SDK not found: '3.1.46'

qemu-i386: Could not open '/lib/ld-linux.so.2': No such file or directory

Visual Studio Version

No response

GCC / Compiler Version

No response

@jozefchutka jozefchutka added the build build issues; typically submitted using template label Oct 4, 2023
@github-actions github-actions bot added the platform:web issues related to ONNX Runtime web; typically submitted using template label Oct 4, 2023
@jozefchutka
Copy link
Author

The workaround is to build using 64bit docker image which contains /lib/ld-linux.so.2

docker run -it --platform linux/amd64 debian:12.1

Copy link
Contributor

github-actions bot commented Nov 3, 2023

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build issues; typically submitted using template platform:web issues related to ONNX Runtime web; typically submitted using template stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

1 participant