ARM 크로스 컴파일의 경우 Docker를 사용하는 것이 좋습니다. 더 쉽게 사용할 수 있기 때문입니다.
크로스 빌드 환경을 설정합니다. 또한 target 옵션이 필요합니다.
설계할 수 있습니다
Makefile tensorflow/lite/tools/pip_package/Makefile에 도우미 도구가 있습니다.
사전 정의된 Docker 컨테이너를 사용하여 빌드 명령어를 호출할 수 있습니다.
Docker 호스트 머신에서 빌드하면 다음과 같이 빌드 명령어를 실행할 수 있습니다.
생성된 바이너리가 타겟과 호환되지 않는 경우
직접 빌드하거나 커스텀 빌드 플래그를 제공할 수 있습니다. (확인
이
대상 환경을 파악) 이 경우
tensorflow/lite/tools/cmake/download_toolchains.sh로 자체 도구 모음을 사용합니다.
도구 모음 스크립트는
build_pip_package_with_cmake.sh 스크립트.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-24(UTC)"],[],[],null,["# Build LiteRT Python Wheel Package\n\nThis page describes how to build the LiteRT `tflite_runtime` Python\nlibrary for x86_64 and various ARM devices.\n\nThe following instructions have been tested on Ubuntu 16.04.3 64-bit PC (AMD64)\n, macOS Catalina (x86_64) and TensorFlow devel Docker image\n[tensorflow/tensorflow:devel](https://hub.docker.com/r/tensorflow/tensorflow/tags/).\n| **Note:** This feature is available since version 2.4.\n\n#### Prerequisites\n\nYou need CMake installed and a copy of the TensorFlow source code. Please check\n[Build LiteRT with CMake](./cmake)\npage for the details.\n\nTo build the PIP package for your workstation, you can run the following\ncommands. \n\n PYTHON=python3 tensorflow/lite/tools/pip_package/build_pip_package_with_cmake.sh native\n\n| **Note:** If you have multiple Python interpreters available, specify the exact Python version with `PYTHON` variable. (Currently, it supports Python 3.7 or higher)\n\nARM cross compilation\n---------------------\n\nFor ARM cross compilation, it's recommended to use Docker since it makes easier\nto setup cross build environment. Also you needs a `target` option to figure out\nthe target architecture.\n\nThere is a helper tool in Makefile `tensorflow/lite/tools/pip_package/Makefile`\navailable to invoke a build command using a pre-defined Docker container. On a\nDocker host machine, you can run a build command as followings. \n\n make -C tensorflow/lite/tools/pip_package docker-build \\\n TENSORFLOW_TARGET=\u003ctarget\u003e PYTHON_VERSION=\u003cpython3 version\u003e\n\n| **Note:** Python version 3.7 or higher is supported.\n\n### Available target names\n\n`tensorflow/lite/tools/pip_package/build_pip_package_with_cmake.sh` script needs\na target name to figure out target architecture. Here is the list of supported\ntargets.\n\n| Target | Target architecture | Comments |\n|---------|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------|\n| armhf | ARMv7 VFP with Neon | Compatible with Raspberry Pi 3 and 4 |\n| rpi0 | ARMv6 | Compatible with Raspberry Pi Zero |\n| aarch64 | aarch64 (ARM 64-bit) | [Coral Mendel Linux 4.0](https://coral.ai/) Raspberry Pi with [Ubuntu Server 20.04.01 LTS 64-bit](https://ubuntu.com/download/raspberry-pi) |\n| native | Your workstation | It builds with \"-mnative\" optimization |\n| default | Your workstation | Default target |\n\n### Build examples\n\nHere are some example commands you can use.\n\n#### armhf target for Python 3.7\n\n make -C tensorflow/lite/tools/pip_package docker-build \\\n TENSORFLOW_TARGET=armhf PYTHON_VERSION=3.7\n\n#### aarch64 target for Python 3.8\n\n make -C tensorflow/lite/tools/pip_package docker-build \\\n TENSORFLOW_TARGET=aarch64 PYTHON_VERSION=3.8\n\n#### How to use a custom toolchain?\n\nIf the generated binaries are not compatible with your target, you need to use\nyour own toolchain or provide custom build flags. (Check\n[this](./cmake_arm#check_your_target_environment)\nto understand your target environment) In that case, you need to modify\n`tensorflow/lite/tools/cmake/download_toolchains.sh` to use your own toolchain.\nThe toolchain script defines the following two variables for the\n`build_pip_package_with_cmake.sh` script.\n\n| Variable | Purpose | example |\n|----------------|--------------------------|---------------------------------|\n| `ARMCC_PREFIX` | defines toolchain prefix | arm-linux-gnueabihf- |\n| `ARMCC_FLAGS` | compilation flags | -march=armv7-a -mfpu=neon-vfpv4 |\n\n| **Note:** `ARMCC_FLAGS` might need to contain Python library include path. See the `download_toolchains.sh` for the reference."]]