Skip to content

Commit 1c36665

Browse files
Merge pull request #124 from zboszor/fix-x86-build-main
Fix x86 build (main)
2 parents 615d915 + 091fffc commit 1c36665

File tree

6 files changed

+119
-0
lines changed

6 files changed

+119
-0
lines changed

.github/workflows/build_intel.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Bitbake intel
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
branches: [ main ]
12+
schedule:
13+
- cron: '0 12 * * 5'
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
env:
19+
TARGET_VERSION: master
20+
TARGET_INTEL_VERSION: master
21+
WORKING_DIR: /home/runner/work
22+
BUILD_DIR: /mnt/build
23+
DOWNLOAD_DIR: /mnt/build/downloads
24+
SSTATE_DIR: /mnt/build/sstate-cache
25+
26+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
27+
jobs:
28+
bitbake-intel:
29+
30+
strategy:
31+
matrix:
32+
target_machine: [genericx86-64, intel-corei7-64, intel-skylake-64]
33+
tensorflow_version: [2.19.0]
34+
fail-fast: false
35+
36+
# The type of runner that the job will run on
37+
runs-on: ubuntu-22.04
38+
39+
# Steps represent a sequence of tasks that will be executed as part of the job
40+
steps:
41+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
42+
- uses: actions/checkout@v2
43+
44+
# Install essential host packages
45+
- name: Install Packages
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get -y install gawk wget git diffstat unzip texinfo gcc build-essential \
49+
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \
50+
iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file \
51+
locales libacl1
52+
sudo apt-get clean
53+
sudo apt-get autoclean -y
54+
sudo locale-gen en_US.UTF-8
55+
56+
- name: Prepare build directory
57+
run: |
58+
sudo mkdir -p ${BUILD_DIR}
59+
sudo chown runner ${BUILD_DIR}
60+
- name: Restore cache
61+
id: ccache-restore
62+
uses: actions/cache/restore@v4
63+
with:
64+
path: |
65+
${{ env.DOWNLOAD_DIR }}
66+
${{ env.SSTATE_DIR }}
67+
key: cache-${{ matrix.target_machine }}-${{ env.TARGET_VERSION }}
68+
69+
# checkout repository
70+
- name: Clone poky, meta-intel, meta-openembedded
71+
run: |
72+
sudo chown runner /mnt
73+
git clone --depth 1 -b ${TARGET_VERSION} git://git.yoctoproject.org/poky.git
74+
git clone --depth 1 -b ${TARGET_INTEL_VERSION} https://git.yoctoproject.org/meta-intel.git
75+
git clone --depth 1 -b ${TARGET_VERSION} git://git.openembedded.org/meta-openembedded
76+
working-directory: /home/runner/work
77+
78+
# Run bitbake
79+
- name: Bitbake MACHINE=${{ matrix.target_machine }}, TensorFlow-Lite version ${{ matrix.tensorflow_version }}
80+
run: |
81+
source ${WORKING_DIR}/poky/oe-init-build-env ${BUILD_DIR}
82+
bitbake-layers add-layer ${WORKING_DIR}/meta-openembedded/meta-oe/
83+
bitbake-layers add-layer ${WORKING_DIR}/meta-openembedded/meta-python/
84+
bitbake-layers add-layer ${WORKING_DIR}/meta-tensorflow-lite/meta-tensorflow-lite/
85+
bitbake-layers add-layer ${WORKING_DIR}/meta-intel/
86+
cat <<EOF> conf/auto.conf
87+
BB_NUMBER_THREADS = "8"
88+
EOF
89+
cat conf/auto.conf
90+
MACHINE=${{matrix.target_machine}} bitbake python3-tensorflow-lite libtensorflow-lite \
91+
libtensorflow-lite-c python3-tensorflow-lite-example tensorflow-lite-label-image \
92+
tensorflow-lite-minimal tensorflow-lite-benchmark libedgetpu-std
93+
df -h
94+
working-directory: /mnt
95+
96+
# Remove all files that hasn't been access in 10 days
97+
- name: Clean SState Cache
98+
run: |
99+
find ${SSTATE_DIR} -type f -mtime +10 -delete
100+
- name: Save cache
101+
uses: actions/cache/save@v4
102+
if: always()
103+
with:
104+
path: |
105+
${{ env.DOWNLOAD_DIR }}
106+
${{ env.SSTATE_DIR }}
107+
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Please note that it is not official support.
2020
| :--------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------- |
2121
| [meta-raspberrypi](https://github.com/agherzan/meta-raspberrypi) | [![Bitbake raspberrypi](https://github.com/NobuoTsukamoto/meta-tensorflow-lite/actions/workflows/build_rpi.yml/badge.svg?branch=main)](https://github.com/NobuoTsukamoto/meta-tensorflow-lite/actions/workflows/build_rpi.yml) |
2222
| [meta-riscv](https://github.com/riscv/meta-riscv) | [![Bitbake qemuriscv](https://github.com/NobuoTsukamoto/meta-tensorflow-lite/actions/workflows/build_riscv.yml/badge.svg?branch=main)](https://github.com/NobuoTsukamoto/meta-tensorflow-lite/actions/workflows/build_riscv.yml) |
23+
| [meta-intel](https://git.yoctoproject.org/meta-intel) | [![Bitbake intel](https://github.com/NobuoTsukamoto/meta-tensorflow-lite/actions/workflows/build_intel.yml/badge.svg?branch=main)](https://github.com/NobuoTsukamoto/meta-tensorflow-lite/actions/workflows/build_intel.yml) |
2324

2425
## Available recipes
2526
- framework

recipes-framework/tensorflow-lite/libtensorflow-lite-c_2.19.0.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ EXTRA_OECMAKE:append:arm = " -DTFLITE_ENABLE_RUY=ON"
4848
EXTRA_OECMAKE:append:aarch64 = " -DTFLITE_ENABLE_XNNPACK=ON"
4949
EXTRA_OECMAKE:append:riscv32 = " -DTFLITE_ENABLE_XNNPACK=ON"
5050
EXTRA_OECMAKE:append:riscv64 = " -DTFLITE_ENABLE_XNNPACK=ON"
51+
EXTRA_OECMAKE:append:x86-64 = " -DTFLITE_ENABLE_XNNPACK=ON"
5152

53+
TENSORFLOW_TARGET_ARCH = "${TARGET_ARCH}"
5254
TENSORFLOW_TARGET_ARCH:raspberrypi = "armv6"
5355
TENSORFLOW_TARGET_ARCH:raspberrypi0 = "armv6"
5456
TENSORFLOW_TARGET_ARCH:raspberrypi0-wifi = "armv6"

recipes-framework/tensorflow-lite/libtensorflow-lite_2.19.0.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ EXTRA_OECMAKE:append:arm = " -DTFLITE_ENABLE_RUY=ON"
5050
EXTRA_OECMAKE:append:aarch64 = " -DTFLITE_ENABLE_XNNPACK=ON"
5151
EXTRA_OECMAKE:append:riscv32 = " -DTFLITE_ENABLE_XNNPACK=ON"
5252
EXTRA_OECMAKE:append:riscv64 = " -DTFLITE_ENABLE_XNNPACK=ON"
53+
EXTRA_OECMAKE:append:x86-64 = " -DTFLITE_ENABLE_XNNPACK=ON"
5354

55+
TENSORFLOW_TARGET_ARCH = "${TARGET_ARCH}"
5456
TENSORFLOW_TARGET_ARCH:raspberrypi = "armv6"
5557
TENSORFLOW_TARGET_ARCH:raspberrypi0 = "armv6"
5658
TENSORFLOW_TARGET_ARCH:raspberrypi0-wifi = "armv6"

recipes-framework/tensorflow-lite/python3-tensorflow-lite_2.19.0.bb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ DEPENDS += "\
2828
python3-pybind11 \
2929
protobuf-native \
3030
flatbuffers-native \
31+
patchelf-native \
3132
"
3233

3334
RDEPENDS:${PN} += " \
@@ -60,7 +61,9 @@ EXTRA_OECMAKE:append:arm = " -DTFLITE_ENABLE_RUY=ON"
6061
EXTRA_OECMAKE:append:aarch64 = " -DTFLITE_ENABLE_XNNPACK=ON"
6162
EXTRA_OECMAKE:append:riscv32 = " -DTFLITE_ENABLE_XNNPACK=ON"
6263
EXTRA_OECMAKE:append:riscv64 = " -DTFLITE_ENABLE_XNNPACK=ON"
64+
EXTRA_OECMAKE:append:x86-64 = " -DTFLITE_ENABLE_XNNPACK=ON"
6365

66+
TENSORFLOW_TARGET_ARCH = "${TARGET_ARCH}"
6467
TENSORFLOW_TARGET_ARCH:raspberrypi = "armv6"
6568
TENSORFLOW_TARGET_ARCH:raspberrypi0 = "armv6"
6669
TENSORFLOW_TARGET_ARCH:raspberrypi0-wifi = "armv6"
@@ -156,6 +159,8 @@ do_install() {
156159
${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} -m pip install --disable-pip-version-check -v \
157160
-t ${D}/${PYTHON_SITEPACKAGES_DIR} --no-cache-dir --no-deps \
158161
${S}/tensorflow/lite/tools/pip_package/gen/tflite_pip/python3/dist/tflite_runtime-${DPV}*.whl
162+
163+
patchelf --clear-execstack ${D}${PYTHON_SITEPACKAGES_DIR}/tflite_runtime/_pywrap_tensorflow_interpreter_wrapper.so
159164
}
160165

161166
FILES:${PN}-dev = ""

recipes-utils/tensorflow-lite/tensorflow-lite-benchmark_2.19.0.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ EXTRA_OECMAKE:append:arm = " -DTFLITE_ENABLE_RUY=ON"
5454
EXTRA_OECMAKE:append:aarch64 = " -DTFLITE_ENABLE_XNNPACK=ON"
5555
EXTRA_OECMAKE:append:riscv32 = " -DTFLITE_ENABLE_XNNPACK=ON"
5656
EXTRA_OECMAKE:append:riscv64 = " -DTFLITE_ENABLE_XNNPACK=ON"
57+
EXTRA_OECMAKE:append:x86-64 = " -DTFLITE_ENABLE_XNNPACK=ON"
5758

59+
TENSORFLOW_TARGET_ARCH = "${TARGET_ARCH}"
5860
TENSORFLOW_TARGET_ARCH:raspberrypi = "armv6"
5961
TENSORFLOW_TARGET_ARCH:raspberrypi0 = "armv6"
6062
TENSORFLOW_TARGET_ARCH:raspberrypi0-wifi = "armv6"

0 commit comments

Comments
 (0)