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

Fix the location of onnxruntime headers for piper-phonemize #754

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

ms1design
Copy link
Contributor

The piper-phonemize was unable to locate the onnxruntime headers during build after changing to the new APT/PYPI server:

-- Installing: /opt/piper-phonemize/build/ei/include/espeak-ng
-- Installing: /opt/piper-phonemize/build/ei/include/espeak-ng/espeak_ng.h
-- Installing: /opt/piper-phonemize/build/ei/include/espeak-ng/encoding.h
-- Installing: /opt/piper-phonemize/build/ei/include/espeak-ng/speak_lib.h
-- Installing: /opt/piper-phonemize/build/ei/lib/libespeak-ng.so.1.52.0.1
-- Installing: /opt/piper-phonemize/build/ei/lib/libespeak-ng.so.1
-- Installing: /opt/piper-phonemize/build/ei/lib/libespeak-ng.so
[ 42%] Completed 'espeak_ng_external'
[ 42%] Built target espeak_ng_external
[ 47%] Building CXX object CMakeFiles/piper_phonemize.dir/src/phonemize.cpp.o
[ 52%] Building CXX object CMakeFiles/piper_phonemize.dir/src/tashkeel.cpp.o
[ 57%] Building CXX object CMakeFiles/piper_phonemize.dir/src/phoneme_ids.cpp.o
[ 63%] Building CXX object CMakeFiles/piper_phonemize.dir/src/shared.cpp.o
/opt/piper-phonemize/src/phonemize.cpp:6:10: fatal error: onnxruntime_cxx_api.h: No such file or directory
    6 | #include <onnxruntime_cxx_api.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/piper_phonemize.dir/build.make:79: CMakeFiles/piper_phonemize.dir/src/phonemize.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
/opt/piper-phonemize/src/tashkeel.cpp:9:10: fatal error: onnxruntime_cxx_api.h: No such file or directory
    9 | #include <onnxruntime_cxx_api.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/piper_phonemize.dir/build.make:107: CMakeFiles/piper_phonemize.dir/src/tashkeel.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:124: CMakeFiles/piper_phonemize.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
The command '/bin/sh -c git clone --branch ${PIPER_PHONEMIZE_VERSION} --depth 1 https://github.com/rhasspy/piper-phonemize &&     cd piper-phonemize &&     cmake -B build -DONNXRUNTIME_DIR=${ONNXRUNTIME_DIR} -DCMAKE_CXX_FLAGS="-I${ONNXRUNTIME_DIR}/include/onnxruntime/" &&     cmake --build build --config Release --parallel &&     cmake --install build &&     CPPFLAGS="-I${ONNXRUNTIME_DIR}/include/onnxruntime/"     pip3 install --no-cache-dir --verbose . &&     ln -s ${ESPEAK_NG_DATA_DIR} /usr/share/espeak-ng-data' returned a non-zero code: 2
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/narandill/Projects/fph/Internal-AI-Base-Station-Server/third_party/jetson-containers/jetson_containers/build.py", line 112, in <module>
    build_container(args.name, args.packages, args.base, args.build_flags, args.build_args, args.simulate, args.skip_tests, args.test_only, args.push, args.no_github_api, args.skip_packages)
  File "/home/narandill/Projects/fph/Internal-AI-Base-Station-Server/third_party/jetson-containers/jetson_containers/container.py", line 147, in build_container
    status = subprocess.run(cmd.replace(_NEWLINE_, ' '), executable='/bin/bash', shell=True, check=True)  
  File "/usr/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'DOCKER_BUILDKIT=0 docker build --network=host --tag fph/nexus:r36.4.0-cu126-cp310-piper-tts --file /home/narandill/Projects/fph/Internal-AI-Base-Station-Server/third_party/jetson-containers/packages/speech/piper-tts/Dockerfile --build-arg BASE_IMAGE=fph/nexus:r36.4.0-cu126-cp310-faster-whisper /home/narandill/Projects/fph/Internal-AI-Base-Station-Server/third_party/jetson-containers/packages/speech/piper-tts 2>&1 | tee /home/narandill/Projects/fph/Internal-AI-Base-Station-Server/third_party/jetson-containers/logs/20241219_195846/build/fph_nexus_r36.4.0-cu126-cp310-piper-tts.txt; exit ${PIPESTATUS[0]}' returned non-zero exit status 2.

Even that onnxruntime-gpu was installed in the container, the headers are not found in the predefined directory:

root@fa518dfc0282:/opt# pip3 show onnxruntime-gpu
Name: onnxruntime-gpu
Version: 1.20.1
Summary: ONNX Runtime is a runtime accelerator for Machine Learning models
Home-page: https://onnxruntime.ai
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT License
Location: /usr/local/lib/python3.11/dist-packages
Requires: coloredlogs, flatbuffers, numpy, packaging, protobuf, sympy
Required-by:
root@fa518dfc0282:/opt# ls /usr/local/include/
ctranslate2  half_float  nlohmann
root@fa518dfc0282:/opt#

Changed the ONNXRUNTIME_DIR location from:

ONNXRUNTIME_DIR=/usr/local

to /opt/onnxruntime/install to point to the correct onnxruntime headers location which is set here:

install_dir="/opt/onnxruntime/install"

Now the build ends successfully :)

@m-gangloff
Copy link

I encountered the same issue which was solved by the proposed changes

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.

2 participants