You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Bazel编译TensorFlow适配Spleeterpp时遇tensorflow_cc库未找到错误

Fixing "tensorflow_cc library not found" Error in Spleeterpp Docker Build

Let's break down why this error is happening and fix it step by step:

1. Library Path Mismatch

Your current Dockerfile copies TensorFlow shared libraries to $INSTALL_DIR/bin/, but most CMake modules (including add_tensorflow.cmake) expect libraries to live in a lib subdirectory under the install root, not bin. This is the primary reason the library isn't being detected.

2. Adjust the TensorFlow Library Installation Path

Update the TensorFlow installation step in your Dockerfile to place libraries in $INSTALL_DIR/lib instead of bin, and ensure we preserve symbolic links (critical for proper shared library resolution):

# tensorflow install
ENV INSTALL_DIR=install
ENV INCLUDE_DIR=$INSTALL_DIR/include
RUN cd tensorflow && \
    mkdir -p $INSTALL_DIR/lib && \
    cp -a bazel-bin/tensorflow/libtensorflow_cc.so* $INSTALL_DIR/lib/ && \
    mkdir -p $INSTALL_DIR/include && \
    rsync -a --prune-empty-dirs --include '*/' --include '*.h' --exclude '*' tensorflow/ $INCLUDE_DIR/tensorflow && \
    mkdir -p $INSTALL_DIR/include/third_party/eigen3/unsupported/ && \
    cp -r ./bazel-tensorflow/external/eigen_archive/unsupported/Eigen $INSTALL_DIR/include/third_party/eigen3/unsupported/Eigen && \
    cp -r ./bazel-tensorflow/external/eigen_archive/Eigen $INSTALL_DIR/include/third_party/eigen3/Eigen

Key changes here:

  • Swapped bin for lib as the library storage directory
  • Added the -a flag to cp to preserve symbolic links (since libtensorflow_cc.so is typically a symlink to a versioned library file)

3. Fix the Spleeterpp CMake Configuration

When running CMake for Spleeterpp, point TENSORFLOW_CC_INSTALL_DIR to the root $INSTALL_DIR (not the bin subdirectory). The CMake module will automatically look for libraries in $INSTALL_DIR/lib and headers in $INSTALL_DIR/include:

# spleeterpp build
RUN mkdir build && cd build && \
    cmake -DTENSORFLOW_CC_INSTALL_DIR=$INSTALL_DIR .. && \
    cmake --build .

4. Verify the Final Library Structure

After these changes, your $INSTALL_DIR should follow this structure, which aligns with what Spleeterpp's CMake module expects:

install/
├── lib/
│   ├── libtensorflow_cc.so
│   ├── libtensorflow_cc.so.1
│   └── libtensorflow_cc.so.1.14.0
└── include/
    ├── tensorflow/
    └── third_party/
        └── eigen3/

This should resolve the "tensorflow_cc library not found" error, as CMake can now locate the library in the standard lib directory under the specified install root.

内容的提问来源于stack exchange,提问作者loretoparisi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 09:16:44