# TinyPiXDepends **Repository Path**: tinypixos/TinyPiXDepends ## Basic Information - **Project Name**: TinyPiXDepends - **Description**: 第三方依赖 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2025-10-17 - **Last Updated**: 2026-01-27 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TinyPiXDepends #### 介绍 用于生成TinyPiXOS的第三方依赖的Sysroot,构建后生成的sysroot目录为编译环境依赖,install目录为OS部署所需安装的文件 #### 安装教程 1. 安装NIX,建议切换到普通用户执行:curl -L https://nixos.org/nix/install | sh -s -- --daemon 2. 配置NIX隔离构建,打开/etc/nix/nix.conf,增加一行:sandbox = relaxed 3. 启用实验性功能,mkdir -p ~/.config/nix \ echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf 4. 重启NIX:sudo systemctl restart nix-daemon #### 使用说明 1. ./create-bundle.sh <架构> 生成sysroot。 2. ./create-depend.sh <架构> 生成install,若不需要部署可以不执行此步骤。 3. 在交叉编译时需要设置sysroot到./sysroot/<架构>。 4. 在编译TinyPiXApp的时候需要手动拷贝生成的库和头文件到sysroot的相关目录下(若本机目录有include可不进行头文件的拷贝)。 5. 由于SDL和ffmpeg直接使用nix构造会存在依赖项太多不可控的情况,flake中取消了sdl和ffmpeg,x264/265的构建,需要使用source下的sdl和ffmpeg以及x264/265库自主交叉编译并复制到soources的指定目录。 6. 项目同时使用了openssl1和openssl3,为了避免冲突,TinyPiXOS直接使用的openssl3使用了静态库,而其他第三方库使用的openssl1则使用NIX生成动态库。 7. nix缓存会持续存在,每次构建都会多生成一份,可以使用以下命令清理 \ 清除无效依赖:nix-collect-garbage \ 强制清理包括所有依赖:nix-store --gc #### sdl交叉编译参考 注意:需要自行更换sysroot路径,并且由于drm的依赖问题,需要修改drm.pc文件,去掉“Requires.private: valgrind >= 3.10.0”这一行 \ ``` ./configure CC="arm-linux-gnueabihf-gcc --sysroot=/home/pix/library/arm32-sysroot" CXX="arm-linux-gnueabihf-g++ --sysroot=/home/pix/library/arm32-sysroot" --host=arm-linux-gnueabihf --with-sysroot=/home/pix/library/arm32-sysroot --prefix=$(pwd)/install CPPFLAGS="-I/home/pix/library/arm32-sysroot/include" LDFLAGS="-L/home/pix/library/arm32-sysroot/lib" --enable-video-kmsdrm --enable-video-fbcon --disable-video-x11 --disable-video-wayland --disable-video-vulkan --disable-video-opengl --disable-render-opengl --disable-render-d3d --disable-pulseaudio --disable-video-dummy --disable-video-offscreen --disable-oss --disable-alsa --disable-esd --disable-arts --disable-ibus --disable-joystick --disable-haptic --disable-sensor --disable-video-directfb --disable-video-opengles --disable-video-opengles1 --disable-video-opengles2 --disable-render-opengles --disable-render-opengles2 ``` #### ffmpeg交叉编译参考 注意:需要自行更换sysroot路径 \ 由于配置会使用pkg-config会使用arm-linux-gnueabihf-pkg-config,但是常规是没有的,直接创建个脚本指向pkg-config就行 \ 创建一个脚本vim /usr/local/bin/arm-linux-gnueabihf-pkg-config \ ``` #!/bin/bash # arm-linux-gnueabihf-pkg-config export PKG_CONFIG_LIBDIR="${SYSROOT:-/home/pix/pix_depend/TinyPiXDepends/sysroot/arm_32}/lib/pkgconfig" export PKG_CONFIG_SYSROOT_DIR="${SYSROOT:-/home/pix/pix_depend/TinyPiXDepends/sysroot/arm_32}" /usr/bin/pkg-config "$@" ``` 修改arm-linux-gnueabihf-pkg-config权限为可执行 mkdir build \ cd build \ ``` PKG_CONFIG=/usr/local/bin/arm-linux-gnueabihf-pkg-config ../configure --enable-cross-compile --cross-prefix=arm-linux-gnueabihf- --arch=arm --cpu=generic --target-os=linux --sysroot=/home/pix/pix_depend/TinyPiXDepends/sysroot/arm_32 --prefix=$(pwd)/install --extra-cflags="-march=armv7-a -mfpu=neon -mfloat-abi=hard -I/home/pix/pix_depend/TinyPiXDepends/sysroot/arm_32/include" --extra-ldflags="-march=armv7-a -mfpu=neon -mfloat-abi=hard -L/home/pix/pix_depend/TinyPiXDepends/sysroot/arm_32/lib -lstdc++ -ldl -lrt -lpthread -lm" --enable-shared --enable-gpl --enable-version3 --enable-libvpx --enable-libopus --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-demuxers --enable-decoders --enable-encoders --enable-filters --disable-programs --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages ``` 另外 \ --enable-avcodec --enable-avformat --enable-avutil --enable-swscale --enable-swresample --enable-avfilter --enable-avdevice --enable-network --enable-protocols \ 这些是默认启用,可以设置可以不设置 #### rime交叉编译参考 ``` vim aarch64_toolchain.cmake ``` 填入以下内容 ``` set(CMAKE_SYSTEM_NAME Linux) set(CMAKE_SYSTEM_PROCESSOR aarch64) # 交叉编译器 set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) # 目标环境根目录(如果有) set(CMAKE_FIND_ROOT_PATH /home/pix/pix_depend/tinyPiXNix_2.0/sysroot/arm_64) # 只在目标目录中查找库 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) ``` 退出保存,开始构建 ``` mkdir build \ cd build cmake .. \ -DCMAKE_TOOLCHAIN_FILE=../aarch64_toolchain.cmake \ -DBOOST_ROOT=/home/pix/pix_depend/tinyPiXNix_2.0/sysroot/arm_64 \ -DBUILD_STATIC=OFF \ -DBUILD_TEST=OFF make make install DESTDIR=$(pwd)/install ``` #### x264编译参考 由于新版的直接在nix中配置生成了x264,此步骤可以省略 ``` cd x264 mkdir build cd build ../configure \ --host=arm-linux \ --cross-prefix=arm-linux-gnueabihf- \ --prefix=$(pwd)/install --enable-static \ --enable-shared \ --disable-opencl \ --disable-cli make make install ``` #### x265编译参考 由于新版的直接在nix中配置生成了x265,此步骤可以省略 ``` cd x265/build mkdir build cd build vim ../arm-linux/crosscompile.cmake ``` 修改: CMAKE_SYSTEM_PROCESSOR改为armv7l, arm-linux-gnueabi改为arm-linux-gnueabihf ``` vim ../../source/CMakeLists.txt ``` 修改-mfloat-abi=soft为-mfloat-abi=hard,(直接在cmake 指定硬件浮点不会生效,只有修改这个地方才行) ``` cmake -G "Unix Makefiles" \ -DCMAKE_TOOLCHAIN_FILE=../arm-linux/crosscompile.cmake \ -DCMAKE_INSTALL_PREFIX=$(pwd)/install_arm32 \ -DX265_ARM_USE_HARD_FLOAT=ON \ -DCMAKE_C_FLAGS="-mfpu=neon -mfloat-abi=hard" \ -DCMAKE_CXX_FLAGS="-mfpu=neon -mfloat-abi=hard" \ ../../source 注:若不需要动态库可以加上-DENABLE_SHARED=OFF make make install ``` #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request