Skip to content

Raspberry Pi Bazel Build "Define appropriate PLATFORM macro" error #3469

Closed

Description

@samjabrahams

When building TensorFlow on Raspberry Pi with Bazel, the pre-compiler end up throwing this error:

Define the appropriate PLATFORM_<foo> macro for this platform

From what I've been able to gather, here's the cause of the issue:

  1. Because Raspberry Pi uses an ARM CPU, the IS_MOBILE_PLATFORM macro is defined in `tensorflow/core/platform/platform.h
  2. Later, when trying to compile png.h, gif.h, or jpeg.h, the if/else statements fall through, leaving with the default option to throw an error.

Environment info

Operating System: Raspbian GNU/Linux, version 8.0

Installed version of CUDA and cuDNN: N/A

Installed from source.

  1. The commit hash : e95f4e7
  2. The output of bazel version :
Build label: 0.2.1-2016-06-13 (@447f7f3)
Build target: bazel-out/local_linux-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Jun 13 19:05:24 2016 (1465844724)
Build timestamp: 1465844724
Build timestamp as int: 1465844724

Steps to reproduce

  1. Build TensorFlow from source on Raspberry Pi as described in this guide without deleting this line from tensorflow/core/platform/platform.h, which defines IS_MOBILE_PLATFORM when compiling on ARM devices.

What have you tried?

  1. Deleted the line mentioned above, which fixes the problem for local builds

Logs or other output that would be helpful

define_macro_error.txt

Activity

  1. samjabrahams commented on Jul 22, 2016

    @samjabrahams
    ContributorAuthor

    According to this post on StackExchange, it looks like there's no reliable, automatic way to detect if building for Raspberry Pi.

    Would it be possible to add in a #if !defined(PLATFORM_RASPBERRY_PI) line in platform.h and define the macro manually in Bazel with --copt="-D PLATFORM_RASPBERRY_PI"?

  2. danbri commented on Sep 7, 2016

    @danbri

    @petewarden any thoughts?

  3. petewarden commented on Sep 17, 2016

    @petewarden
    Contributor

    No update on this one I'm afraid. I've been focused on the makefile approach to building for the Pi, and I'm not familiar enough with Bazel to suggest the right way to handle this.

  4. drpngx commented on Jan 23, 2017

    @drpngx
    Contributor

    Closing this -- we only support Makefile builds right now.

  5. samjabrahams commented on Jan 23, 2017

    @samjabrahams
    ContributorAuthor

    Ok, no worries- I'll keep maintaining my repo for those who want a Python interface on their Raspberry Pi.

  6. EddieOne commented on Jul 25, 2017

    @EddieOne

    Long build process on the Raspberry Pi.

    When you wake up the next morning and it's finished compiling

    At this stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions