Skip to content

--apple_bitcode flag ineffective on iOS targets #4982

Closed

Description

@th0br0

(originally posted as bazelbuild/rules_apple#163)

When creating an apple_static_library target like [1] and building this via bazel build --apple_bitcode=embedded --ios_multi_cpus=arm64 -c opt //:myappletarget the bitcode is not being included in the actual build causing issues when trying to run the code on-device similar to:

/Project/myapplelibrary.a(lib1.o) does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64

However, specifying --copt=-fembed-bitcode causes a conflict with the -fdata-sections and -ffunction-sections flags that bazel uses by default.

How can this be resolved? Is there some way I can resolve this temporarily?
This is for bazel 0.11.1 running on MacOS with latest released XCode.

The references to b/73546952 and b/35091927 at https://github.com/bazelbuild/rules_apple/blob/master/test/ios_application_test.sh#L838 and https://github.com/bazelbuild/rules_apple/blob/master/test/configurations.bzl#L21 make me believe you're tracking this issue internally already?

[1]

cc_library(
  name="mynativedependency"],
  srcs=["lib1.c"], hdrs=["lib1.h"])

apple_static_library(
    name="myappletarget",
    deps=[":mynativedependency"],
    platform_type="ios",
    minimum_os_version="9.0",
    visibility = ["//visibility:public"])

Activity

  1. removed their assignment
    on Nov 17, 2018
  2. sergiocampama commented on Nov 17, 2018

    @sergiocampama
    Contributor

    this is an issue with cc_library not detecting the --apple_bitcode flag and/or the C++ crosstool being incompatible with bitcode

  3. added
    team-Rules-CPP
    untriaged
    and removed on Nov 17, 2018
  4. added
    P2
    and removed
    untriaged
    on Jan 3, 2019
  5. keith commented on Feb 5, 2019

    @keith
    Member

    I've started to take a stab at this #7356

  6. stristr commented on Mar 26, 2019

    @stristr

    This appears to be solved in 0.24.

  7. keith commented on Mar 26, 2019

    @keith
    Member

    Yep! Thanks!

  8. rajivshah3 commented on Apr 7, 2019

    @rajivshah3

    @TemRich does #7623 fix the issue for you? I may have run into the same issue when I built Bazel from source off of f8e38d1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2team-Rules-CPPtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions