oberluz / pycoral

Python API for ML inferencing and transfer-learning on Coral devices
https://coral.ai
Apache License 2.0
34 stars 2 forks source link

Building for Ubuntu 24.04: external/ruy/ruy/block_map.cc:395:25: error: 'numeric_limits' is not a member of 'std' #16

Open aseering opened 1 month ago

aseering commented 1 month ago

Is your feature request related to a problem? Please describe. I'm attempting to build for Ubuntu 24.04 (Python 3.12). I've made a few changes to get the Docker Container to build (see aseering/pycoral@master), but now I'm running into compilation issues. I'm wondering if anyone else has run into anything similar, and might have any pointers.

Describe the solution you'd like pycoral compiled for Python 3.12 (Ubuntu 24.04)

Describe alternatives you've considered I could use an older version of Python, but I'd like to use the system default Python if I can.

Additional context The specific failure is:

external/ruy/ruy/block_map.cc: In function 'void ruy::MakeBlockMap(int, int, int, int, int, int, int, int, const CpuCacheParams&, BlockMap*)':
external/ruy/ruy/block_map.cc:395:25: error: 'numeric_limits' is not a member of 'std'
  395 |   int best_score = std::numeric_limits<int>::min();
      |                         ^~~~~~~~~~~~~~
external/ruy/ruy/block_map.cc:395:40: error: expected primary-expression before 'int'
  395 |   int best_score = std::numeric_limits<int>::min();
      |                                        ^~~

The fix to that file seems simple enough. But the file isn't in this repository. Nor is it a direct dependency. I believe it's a dependency of Tensorflow. (Not sure if it's pulled in for any other reason as well?) I tried updating to the latest Tensorflow release (2.17.0); it didn't seem to help. This looks similar to rocm-arch/tensorflow-rocm#31, but that was addressed quite a while ago.

aseering commented 1 month ago

Digging in more deeply, I figured out the immediate problem. Actually it was a little bit silly: libedgetpu (therefore tensorflow) is referenced in two places, and I missed this and only tried updating one of them. The other pointed at an old tensorflow still containing this issue.

I tried updating both, and I ran into a deeper problem: Either Tensorflow is too old, in which case it runs into the above or other issues; or it's new enough to contain all fixes for newer compilers, in which case it fails to build with Python-related dependency issues in the workspace.

It looks like the latter, or at least similar, is a known issue? tensorflow/tensorflow#62340

virnik0 commented 1 month ago

Hi, any update on this? I am trying to build pycoral for python3.12 as well, so far unsuccessful. Well - I was successful once, after tweaking your fork, but then the version I built didn't install, as pip didn't detect already installed tensorflow (I used both your whl as well as the one I built). No dice so far.

I am on Ubuntu 24.04, x86_64

virnik0 commented 1 month ago

Hey, I've fixed it! Well, not me - I spoke to feranick, and learned that I was doing multiple things wrong. First of all, you need to downgrade bazel to version 6.5.0. Second, install CLang, and set it as default C++ compiler.

Next, download feranick's repository for pycoral, and just do: TF_PYTHON_VERSION=3.12 make pybind TF_PYTHON_VERSION=3.12 make wheel

You can download the wheel I built here: https://github.com/virnik0/pycoral_builds

Tested, works!