Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Support MacOS Intel and M1 #128

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cemlyn007
Copy link

Good evening,

I have managed to get Reverb to build on MacOS Intel and on the M1, I have tested this with a built version of Launchpad (M1) on Acme with Python 3.9. Hoping that we can work together to get this in!

Looking forward to hearing from anybody interested in collaborating!

Kind regards,

Cemlyn

@google-cla
Copy link

google-cla bot commented May 17, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@cemlyn007 cemlyn007 changed the title feat: build for mac intel Draft: Support MacOS Intel and M1 May 17, 2023
@cemlyn007 cemlyn007 mentioned this pull request May 17, 2023
@cemlyn007 cemlyn007 marked this pull request as ready for review May 18, 2023 11:33
@cemlyn007
Copy link
Author

(I did not mean to click ready for review 👀)

@ebrevdo
Copy link
Collaborator

ebrevdo commented May 18, 2023

Hi @cemlyn007 - first of all, thank you for adding this support! This is a really useful PR for the external community. Unfortunately we lack the internal infrastructure to be able to run unit/integration tests and the resources to ensure that the MacOS build stays healthy.

We could add a section in the README.md linking to your forked github repo. If you want, you can rename it to something explicit like reverb-macos but that's up to you! Let us know if this sounds good to you. If so, I'll close this PR and we can update the README in a separate PR.

@cemlyn007
Copy link
Author

Hi @ebrevdo, good to hear from you! Yeah I would be happy to maintain reverb-macos, if I did this would be okay to also publish a PyPi package with the name reverb-macos?

@ebrevdo
Copy link
Collaborator

ebrevdo commented Jun 1, 2023

The choice of PyPi package name is up to you. We could also add a pointer to that. Please make it clear on your GitHub readme and PyPi package readme that the fork and associated packages are not maintained by Google/DeepMind and any questions or support requests should go directly to you and your github Issues page.

@maxosmith
Copy link

maxosmith commented Aug 30, 2023

Hi Cemlyn,

I'm hoping to also get an easy set-up of reverb and launchpad for local testing and development on M1. I am unable to build this branch, and I was hoping you might be able to help. Alongside this I'm trying to compile a quick step-by-step to getting all of the software consistently working correctly.

  1. Set-up miniforge, this is needed instead of anaconda for Apple dependencies. You will likely get a lot of package-not-found errors if you do not have the ARM-specific installations being used.
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-MacOSX-arm64.sh
chmod 777 Mambaforge-MacOSX-arm64.sh
./Mambaforge-MacOSX-arm64.sh
conda env create -f tf-metal-arm64.yaml
conda activate tf-metal

Where tf-metal-arm64.yaml is as follows:

name: tf-metal
channels:
  - apple
  - conda-forge
dependencies:
  - python=3.9  ## specify desired version
  - pip
  - tensorflow-deps

  ## uncomment for use with Jupyter
  ## - ipykernel

  ## PyPI packages
  - pip:
    - tensorflow-macos
    - tensorflow-metal  ## optional, but recommended
  1. Ensure that you have valid versions of python/conda that are built for ARM:
import platform
platform.platform()
which conda
which python
  1. Bazel 5.3.0 built for ARM is needed to compile Reverb:
curl -fLO https://releases.bazel.build/5.3.0/release/bazel-5.3.0-darwin-arm64 && chmod +x bazel-5.3.0-darwin-arm64
  1. Download the ARM fork of Reverb and built:
git clone https://github.com/deepmind/reverb
cd reverb
gh pr checkout 128
python configure.py
/oss_build.sh --clean true --clear_bazel_cache true --tf_dep_override "tensorflow~=2.12.0" --release --python "3.9"

I also tried doing this specifying explicitly the following versions (based on the dates of the package releases and the comments in on these PRs):

tensorflow-macos==2.12.0
tensorflow-metal==0.8.0

I surprisingly get an SSL-themed error:

ERROR: /private/var/tmp/_bazel_maxsmith/42858cc935d0f8a77bf887408b1437d5/external/boringssl/BUILD:146:11: Compiling src/ssl/bio_ssl.cc failed: (Exit 1): cc_wrapper.sh failed: error executing command external/local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics ... (remaining 46 arguments skipped)
external/boringssl/src/ssl/bio_ssl.cc:16:37: error: member access into incomplete type 'BIO' (aka 'bio_st')
  return reinterpret_cast<SSL *>(bio->ptr);
                                    ^
/usr/local/include/openssl/types.h:89:16: note: forward declaration of 'bio_st'
typedef struct bio_st BIO;
               ^
external/boringssl/src/ssl/bio_ssl.cc:104:27: error: unexpected type name 'SSL': expected expression
        OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                          ^
external/boringssl/src/ssl/bio_ssl.cc:104:32: error: use of undeclared identifier 'ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED'
        OPENSSL_PUT_ERROR(SSL, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
                               ^
external/boringssl/src/ssl/bio_ssl.cc:112:10: error: member access into incomplete type 'BIO' (aka 'bio_st')
      bio->shutdown = static_cast<int>(num);
         ^

I was wondering if you might have an idea of how to resolve this error and/or if I missed anything in my set-up notes? I'd be trying to get your branch of LaunchPad to work next. Thank you regardless for your effort on both packages.

@cemlyn007
Copy link
Author

cemlyn007 commented Aug 30, 2023

Hi Max,

A bit about my setup:

conda create -n py39
conda activate py39
conda install python=3.9 -c conda-forge
pip install tensorflow-macos==2.12.0

Note I have not tried experimenting with tensorflow-metal yet, can we try to get a more minimal setup to work first before we explore using metal?
I setup bazelisk from source using go as documented here (including add to PATH).

Next I would manually set the oss_build.sh, I did a lot of hacking

./oss_build.sh --release

This all works for me (just tested in case).

Looking at your error, it looks like a local copy of openssl has been detected (/usr/local/include/openssl), I don't appear to have this on my M1 (suspect you got it using brew or something?), there might be a variable that you can set to stop Bazel / (a Reverb build dependency) from using this OpenSSL?

@cemlyn007
Copy link
Author

cemlyn007 commented Aug 30, 2023

I think this is a similar issue with the same problem, although you may want to find a solution that doesn't break other things for you

-- EDIT --
I think there is a setting to disable default compile flags, that might help you exclude your system found copy of openssl? (if that is the problem) Search something like Bazel default_compile_flags (sorry but I cannot remember how to disable the feature via the cli)

@maxosmith
Copy link

maxosmith commented Aug 31, 2023

Thanks for the quick reply!

So, it's a bit hacky, but I got it to work by temporarily uninstalling openssl. I had: OpenSSL 3.1.2 1 Aug 2023 (Library: OpenSSL 3.1.2 1 Aug 2023) installed.

Strangely, which openssl linked to one in my conda directory, but whereis openssl only showed the system installations.

conda create -n py39
conda activate py39
conda install python=3.9 -c conda-forge
pip install tensorflow-macos==2.12.0
go get github.com/bazelbuild/bazelisk
go install github.com/bazelbuild/bazelisk@latest
export PATH=$PATH:$(go env GOPATH)/bin
git clone https://github.com/deepmind/reverb
cd reverb
gh pr checkout 128
./oss_build.sh --release

Apple M1 Pro
Ventura 13.5.1
Python 3.9.18
Bazel 6.3.2

absl-py==1.4.0
astunparse==1.6.3
cachetools==5.3.1
certifi==2023.7.22
charset-normalizer==3.2.0
dm-reverb @ file:///tmp/reverb/dist/dm_reverb-0.11.0-cp39-cp39-macosx_11_0_arm64.whl#sha256=4e636ba553e14b911c895ff63f217fe870bea9696596f86bae1346b98bc55559
dm-tree==0.1.8
flatbuffers==23.5.26
gast==0.4.0
google-auth==2.22.0
google-auth-oauthlib==1.0.0
google-pasta==0.2.0
grpcio==1.57.0
h5py==3.9.0
idna==3.4
importlib-metadata==6.8.0
jax==0.4.14
keras==2.12.0
libclang==16.0.6
Markdown==3.4.4
MarkupSafe==2.1.3
ml-dtypes==0.2.0
numpy==1.23.5
oauthlib==3.2.2
opt-einsum==3.3.0
packaging==23.1
portpicker==1.6.0
protobuf==4.24.2
psutil==5.9.5
pyasn1==0.5.0
pyasn1-modules==0.3.0
requests==2.31.0
requests-oauthlib==1.3.1
rsa==4.9
scipy==1.11.2
six==1.16.0
tensorboard==2.12.3
tensorboard-data-server==0.7.1
tensorflow-estimator==2.12.0
tensorflow-macos==2.12.0
termcolor==2.3.0
typing_extensions==4.7.1
urllib3==1.26.16
Werkzeug==2.3.7
wrapt==1.14.1
zipp==3.16.2

Thank you so much again. I have spent an unfortunate amount of time trying to get this to work locally (trying a view docker options as well). I'm going to verify LaunchPad now.

@maxosmith
Copy link

maxosmith commented Aug 31, 2023

I was wrong about the Bazel version. I used 4.2.1 to build Reverb, but then I had to use 7.0.0 to build LaunchPad (from your PR google-deepmind/launchpad#40). LaunchPad also required me to have OpenSSL uninstalled. I'm kind of curious why OpenSSL is so painful, but it's honestly such a relief to have this all working after how much time I've sunk into trying to get it all working (tried docker, emulated docker, etc.).

I love the Google software stack, but it can be incredibly painful to use externally.

LaunchPad's build, unmodified, "completes successfully" but has some clear errors in the final deliverable. I haven't had the time to dig into exactly what's happening here, but I'm documenting it here. Essentially, it looks like a setuptools issue because I get spammed with:

/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/setuptools/command/build_py.py:204: _Warning: Package 'launchpad.nodes.reverb' is absent from the `packages` configuration.
!!

        ********************************************************************************
        ############################
        # Package would be ignored #
        ############################
        Python recognizes 'launchpad.nodes.reverb' as an importable package[^1],
        but it is absent from setuptools' `packages` configuration.

        This leads to an ambiguous overall configuration. If you want to distribute this
        package, please make sure that 'launchpad.nodes.reverb' is explicitly added
        to the `packages` configuration field.

        Alternatively, you can also rely on setuptools' discovery methods
        (for example by using `find_namespace_packages(...)`/`find_namespace:`
        instead of `find_packages(...)`/`find:`).

        You can read more about "package discovery" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

        If you don't want 'launchpad.nodes.reverb' to be distributed and are
        already explicitly excluding 'launchpad.nodes.reverb' via
        `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
        you can try to use `exclude_package_data`, or `include-package-data=False` in
        combination with a more fine grained `package-data` configuration.

        You can read more about "package data files" on setuptools documentation page:

        - https://setuptools.pypa.io/en/latest/userguide/datafiles.html


        [^1]: For Python, any directory (with suitable naming) can be imported,
              even if it does not contain any `.py` files.
              On the other hand, currently there is no concept of package data
              directory, all directories are treated like packages.
        ********************************************************************************

for everything in the launchpad namespace. So it quietly doesn't build everything but the final build is successful because everything is skipped. Then when you try and use launchpad:

>>> import launchpad as lp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/launchpad/__init__.py", line 36, in <module>
    from launchpad.nodes.courier.node import CourierHandle
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/launchpad/nodes/courier/node.py", line 21, in <module>
    import courier
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/__init__.py", line 29, in <module>
    from courier.python.py_server import Server  # pytype: disable=import-error
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/python/py_server.py", line 31, in <module>
    from courier.python import server
ImportError: dlopen(/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/python/server.so, 0x0002): symbol not found in flat namespace '__ZN3tsl8profiler8internal13g_trace_levelE'

If you modify the setup so that packages=setuptools.find_namespace_packages() this removes the pile of warnings, but results in similar errors:

>>> import launchpad as lp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/launchpad/__init__.py", line 36, in <module>
    from launchpad.nodes.courier.node import CourierHandle
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/launchpad/nodes/courier/node.py", line 21, in <module>
    import courier
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/__init__.py", line 29, in <module>
    from courier.python.py_server import Server  # pytype: disable=import-error
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/python/py_server.py", line 31, in <module>
    from courier.python import server
ImportError: dlopen(/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/python/server.so, 0x0002): symbol not found in flat namespace '__ZN3tsl8profiler8internal13g_trace_levelE'

@cemlyn007
Copy link
Author

cemlyn007 commented Aug 31, 2023

Just in case, can you make sure to test importing launchpad in a current working directory that doesn't have launchpad as a relative Python module in it's folder?
mkdir /tmp123 && cd /tmp123 && python -c "import tensorflow; from courier.python import server"

(The little code snippet is just to see if your import error is fixed by being somewhere where there is no folder called courier)

-- EDIT --

My advice above is probably wrong, please could you try importing tensorflow before importing launchpad etc?

@maxosmith
Copy link

Yeah, I had made the mistake of running reverb in the reverb directory before, so your original intuition on common mistakes was not far off. :)

It appears that does fix it. How did you intuit that was the issue? If you import lp before tf, they both fail, but the other way around they work just fine (shown below). The error codes seem pretty unrelated as well.

Thank you so much again for your help.

(py39) [14:28:06] maxsmith@MaxBook-Pro:~
$mkdir /tmp/123 && cd /tmp/123 && python -c "import tensorflow; from courier.python import server"
(py39) [14:28:28] maxsmith@MaxBook-Pro:/tmp/123
$python
Python 3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:53:08)
[Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import launchpad as lp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/launchpad/__init__.py", line 36, in <module>
    from launchpad.nodes.courier.node import CourierHandle
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/launchpad/nodes/courier/node.py", line 21, in <module>
    import courier
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/__init__.py", line 29, in <module>
    from courier.python.py_server import Server  # pytype: disable=import-error
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/python/py_server.py", line 31, in <module>
    from courier.python import server
ImportError: dlopen(/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/courier/python/server.so, 0x0002): symbol not found in flat namespace '__ZN3tsl8profiler8internal13g_trace_levelE'
>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/tensorflow/__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/tensorflow/python/__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/tensorflow/python/eager/context.py", line 31, in <module>
    from tensorflow.python import pywrap_tfe
  File "/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/tensorflow/python/pywrap_tfe.py", line 25, in <module>
    from tensorflow.python._pywrap_tfe import *
ImportError: dlopen(/Users/maxsmith/mambaforge/envs/py39/lib/python3.9/site-packages/tensorflow/python/_pywrap_tfe.so, 0x0002): symbol not found in flat namespace '__ZN10tensorflow13DeviceFactory19GetAnyDeviceDetailsEiPNSt3__113unordered_mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES8_NS1_4hashIS8_EENS1_8equal_toIS8_EENS6_INS1_4pairIKS8_S8_EEEEEE'
>>> quit()
(py39) [14:28:48] maxsmith@MaxBook-Pro:/tmp/123
$python
Python 3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:53:08)
[Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> import launchpad as lp
>>>

@cemlyn007
Copy link
Author

Interesting, I've never tried to import launchpad then tensorflow on Mac, surprised that it looks like you cannot successfully import tensorflow after failing to import launchpad. I suspect Reverb has the same issue?

I do suspect I have a mistake in my build implementation where TensorFlow is not automatically being imported upon importing Launchpad.

For the time being I just get always remember to import tensorflow before trying to import launchpad or reverb (sometimes by adding import tensorflow to the init.py for reverb and launchpad. If you know of a better solution please let me know

@maxosmith
Copy link

Reverb actually works totally fine without importing tensorflow beforehand. So the problem is isolated to launchpad. We might be able to compare the build files across the two packages to see if there's anything to remedy the issue.

@maxosmith
Copy link

Apologies for the delay.

I spent some time fiddling with this to see if I could get it to work. The first takeaway I have is that I can confirm that the same build instructions work for python==3.10, which is excellent.

Now, as for the error that tensorflow needs to be imported before launchpad. The required change to remedy the first error is likely in the courier package. If you directly import courier you get the error (below), and if you import launchpad it successfully loads submodules up until it loads courier (below).

Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:41:52) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from launchpad import courier
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/launchpad/__init__.py", line 36, in <module>
    from launchpad.nodes.courier.node import CourierHandle
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/launchpad/nodes/courier/node.py", line 21, in <module>
    import courier
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/__init__.py", line 29, in <module>
    from courier.python.py_server import Server  # pytype: disable=import-error
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/py_server.py", line 31, in <module>
    from courier.python import server
ImportError: dlopen(/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/server.so, 0x0002): symbol not found in flat namespace '__ZN3tsl8profiler8internal13g_trace_levelE'
>>> from launchpad import LaunchType
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/launchpad/__init__.py", line 36, in <module>
    from launchpad.nodes.courier.node import CourierHandle
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/launchpad/nodes/courier/node.py", line 21, in <module>
    import courier
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/__init__.py", line 29, in <module>
    from courier.python.py_server import Server  # pytype: disable=import-error
  File "/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/py_server.py", line 31, in <module>
    from courier.python import server
ImportError: dlopen(/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/server.so, 0x0002): symbol not found in flat namespace '__ZN3tsl8profiler8internal13g_trace_levelE'

The file exists, so it's upset about finding the presumably first symbol 0x0002 in the file.

$ls /Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/
__pycache__/    client.py       client_test.py  py_client.so*   py_server.py    pybind.so*      router.so*      server.so*

It is not dependent on tensorflow:

$dyld_info -dependents /Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/server.so
/Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/server.so [arm64]:
    -dependents:
        attributes     load path
                       @rpath/libserver.dylib
                       @rpath/libcourier_service_cc_grpc_proto.dylib
                       @rpath/libcourier_service_cc_proto.dylib
                       @rpath/librouter.dylib
                       @rpath/libtf_serialize.dylib
                       @rpath/libgrpc_utils.dylib
                       @rpath/liblogging.dylib
                       @rpath/libstatus_macros.dylib
                       /usr/lib/libSystem.B.dylib
                       /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
                       /usr/lib/libc++.1.dylib
                       /usr/lib/libobjc.A.dylib

I don't think it's directly the fault of server, because I can't find profiler or trace_level in the symbol list. Which I'm presuming are from `tensorflow.

$nm /Users/maxsmith/mambaforge/envs/py310/lib/python3.10/site-packages/courier/python/server.so | grep profiler

If you look at server:

So anyways, that's what I've fiddled with to this point. I'm hoping I can look around a bit more later this week. Let me know if this inspires any thoughts or if I made any mistakes in reasoning!

@cemlyn007
Copy link
Author

Hi @ebrevdo, we're still using the Mac ARM64 wheel at InstaDeep, with GitHub offering Mac runners, do you think there is more of an appetite at DeepMind to support Mac?

I think it would wonderful if we could get Reverb to officially support Mac ARM64 as it would streamline the user experience for playing around with other DeepMind & Google-Research libraries like RLDS?

Of course I would be incredibly enthusiastic for collaborating in achieving this.

@cemlyn007
Copy link
Author

@maxosmith please could I ask if you are still able to compile reverb from your end?

I am getting:

INFO: Analyzed target //reverb/pip_package:build_pip_package (149 packages loaded, 4800 targets configured).
INFO: Found 1 target...
ERROR: /private/var/tmp/_bazel_cemlyn/6d25cb98d18e594cb2060c000dba8b7b/external/upb/upbc/BUILD:99:10: Compiling upbc/protoc-gen-upbdefs.cc [for tool] failed: (Exit 1): wrapped_clang_pp failed: error executing command (from target @upb//upbc:protoc-gen-upbdefs) external/local_config_cc/wrapped_clang_pp '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG ... (remaining 59 arguments skipped)
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:301:36: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
    : std::integral_constant<bool, __has_trivial_destructor(T) &&
                                   ^
external/com_google_absl/absl/meta/type_traits.h:350:36: error: builtin __has_trivial_constructor is deprecated; use __is_trivially_constructible instead [-Werror,-Wdeprecated-builtins]
    : std::integral_constant<bool, __has_trivial_constructor(T) &&
                                   ^
external/com_google_absl/absl/meta/type_traits.h:494:17: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
          bool, __has_trivial_assign(typename std::remove_reference<T>::type) &&
                ^
external/com_google_absl/absl/meta/type_traits.h:559:8: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:560:8: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:559:8: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<short>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:155:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<short>' requested here
                  type_traits_internal::is_trivially_copyable<Source>::value &&
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned short, Source = short]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:143:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned short, Source = int16_t, $2 = (no value)]
  return bit_cast<int16_t>(FromHost16(bit_cast<uint16_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:560:8: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:301:36: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
    : std::integral_constant<bool, __has_trivial_destructor(T) &&
                                   ^
external/com_google_absl/absl/meta/type_traits.h:562:7: note: in instantiation of template class 'absl::is_trivially_destructible<short>' requested here
      is_trivially_destructible<ExtentsRemoved>::value &&
      ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<short>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:155:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<short>' requested here
                  type_traits_internal::is_trivially_copyable<Source>::value &&
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned short, Source = short]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:143:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned short, Source = int16_t, $2 = (no value)]
  return bit_cast<int16_t>(FromHost16(bit_cast<uint16_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:559:8: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<unsigned short>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:156:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<unsigned short>' requested here
                  type_traits_internal::is_trivially_copyable<Dest>::value
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned short, Source = short]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:143:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned short, Source = int16_t, $2 = (no value)]
  return bit_cast<int16_t>(FromHost16(bit_cast<uint16_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:560:8: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:301:36: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
    : std::integral_constant<bool, __has_trivial_destructor(T) &&
                                   ^
external/com_google_absl/absl/meta/type_traits.h:562:7: note: in instantiation of template class 'absl::is_trivially_destructible<unsigned short>' requested here
      is_trivially_destructible<ExtentsRemoved>::value &&
      ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<unsigned short>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:156:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<unsigned short>' requested here
                  type_traits_internal::is_trivially_copyable<Dest>::value
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned short, Source = short]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:143:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned short, Source = int16_t, $2 = (no value)]
  return bit_cast<int16_t>(FromHost16(bit_cast<uint16_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:559:8: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<int>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:155:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<int>' requested here
                  type_traits_internal::is_trivially_copyable<Source>::value &&
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned int, Source = int]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:146:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned int, Source = int32_t, $2 = (no value)]
  return bit_cast<int32_t>(FromHost32(bit_cast<uint32_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:560:8: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:301:36: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
    : std::integral_constant<bool, __has_trivial_destructor(T) &&
                                   ^
external/com_google_absl/absl/meta/type_traits.h:562:7: note: in instantiation of template class 'absl::is_trivially_destructible<int>' requested here
      is_trivially_destructible<ExtentsRemoved>::value &&
      ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<int>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:155:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<int>' requested here
                  type_traits_internal::is_trivially_copyable<Source>::value &&
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned int, Source = int]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:146:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned int, Source = int32_t, $2 = (no value)]
  return bit_cast<int32_t>(FromHost32(bit_cast<uint32_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:559:8: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<unsigned int>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:156:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<unsigned int>' requested here
                  type_traits_internal::is_trivially_copyable<Dest>::value
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned int, Source = int]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:146:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned int, Source = int32_t, $2 = (no value)]
  return bit_cast<int32_t>(FromHost32(bit_cast<uint32_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:560:8: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:301:36: error: builtin __has_trivial_destructor is deprecated; use __is_trivially_destructible instead [-Werror,-Wdeprecated-builtins]
    : std::integral_constant<bool, __has_trivial_destructor(T) &&
                                   ^
external/com_google_absl/absl/meta/type_traits.h:562:7: note: in instantiation of template class 'absl::is_trivially_destructible<unsigned int>' requested here
      is_trivially_destructible<ExtentsRemoved>::value &&
      ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<unsigned int>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:156:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<unsigned int>' requested here
                  type_traits_internal::is_trivially_copyable<Dest>::value
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned int, Source = int]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:146:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned int, Source = int32_t, $2 = (no value)]
  return bit_cast<int32_t>(FromHost32(bit_cast<uint32_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:559:8: error: builtin __has_trivial_copy is deprecated; use __is_trivially_copyable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_copy(ExtentsRemoved) || !kIsCopyOrMoveConstructible) &&
       ^
external/com_google_absl/absl/meta/type_traits.h:571:70: note: in instantiation of static data member 'absl::type_traits_internal::is_trivially_copyable_impl<long long>::kValue' requested here
          bool, type_traits_internal::is_trivially_copyable_impl<T>::kValue> {};
                                                                     ^
external/com_google_absl/absl/base/casts.h:155:41: note: in instantiation of template class 'absl::type_traits_internal::is_trivially_copyable<long long>' requested here
                  type_traits_internal::is_trivially_copyable<Source>::value &&
                                        ^
external/com_google_absl/absl/base/casts.h:163:23: note: while substituting prior template arguments into non-type template parameter [with Dest = unsigned long long, Source = long long]
inline constexpr Dest bit_cast(const Source& source) {
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
external/com_google_absl/absl/base/internal/endian.h:149:39: note: while substituting deduced template arguments into function template 'bit_cast' [with Dest = unsigned long long, Source = int64_t, $2 = (no value)]
  return bit_cast<int64_t>(FromHost64(bit_cast<uint64_t>(x)));
                                      ^
In file included from external/upb/upbc/protoc-gen-upbdefs.cc:32:
In file included from external/upb/upbc/common.h:34:
In file included from external/com_google_absl/absl/strings/substitute.h:81:
In file included from external/com_google_absl/absl/strings/escaping.h:32:
In file included from external/com_google_absl/absl/strings/str_join.h:59:
In file included from external/com_google_absl/absl/strings/internal/str_join_internal.h:42:
In file included from external/com_google_absl/absl/strings/internal/resize_uninitialized.h:26:
external/com_google_absl/absl/meta/type_traits.h:560:8: error: builtin __has_trivial_assign is deprecated; use __is_trivially_assignable instead [-Werror,-Wdeprecated-builtins]
      (__has_trivial_assign(ExtentsRemoved) || !kIsCopyOrMoveAssignable) &&
       ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Error in child process '/usr/bin/xcrun'. 1
Target //reverb/pip_package:build_pip_package failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /private/var/tmp/_bazel_cemlyn/6d25cb98d18e594cb2060c000dba8b7b/external/com_github_cncf_udpa/xds/type/v3/BUILD:5:18 Middleman _middlemen/@com_Ugithub_Ucncf_Uudpa_S_Sxds_Stype_Sv3_Cpkg.upbdefs-BazelCppSemantics_build_arch_darwin_arm64-opt failed: (Exit 1): wrapped_clang_pp failed: error executing command (from target @upb//upbc:protoc-gen-upbdefs) external/local_config_cc/wrapped_clang_pp '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -g0 -O2 -DNDEBUG ... (remaining 59 arguments skipped)
INFO: Elapsed time: 15.223s, Critical Path: 1.82s
INFO: 111 processes: 71 internal, 40 local.
FAILED: Build did NOT complete successfully

@cemlyn007
Copy link
Author

My crude hack to get it to compile was to modify this file:
image

@cemlyn007
Copy link
Author

The same seems to have worked for Launchpad so never mind:
image

@vyeevani
Copy link

I had the same issue @cemlyn007 and your hot fix worked for me also

@vyeevani
Copy link

vyeevani commented May 28, 2024

@cemlyn007 the issue was resolved in: abseil/abseil-cpp#1289. I've tried it with the following patches to your recipe.

  1. upgrade absl
    ABSL_COMMIT = "fb3621f4f897824c0dbe0615fa94543df6192f30"
    ABSL_SHA256 = "0320586856674d16b0b7a4d4afb22151bdc798490bb7f295eddd8f6a62b46fea"
  2. to use newer absl, you need to increase tf. I jumped to tf v2.16.1 so minimal working recipe becomes
conda create -n py39
conda activate py39
conda install python=3.9 -c conda-forge
pip install tensorflow-macos==2.16.1
  1. need to fix: ./reverb/cc/support/tf_util.h:32:32: error: no member named 'error_message' in 'absl::Status' by applying the following patch
// Converts a tensorflow::Status object to an absl::Status object.
inline absl::Status FromTensorflowStatus(const tensorflow::Status& status) {
  return status;
}

// Converts an absl::Status object to a tensorflow::Status object.
inline tensorflow::Status ToTensorflowStatus(const absl::Status& status) {
  return status;
}

@vyeevani
Copy link

Put up a PR cemlyn007#1

@cemlyn007
Copy link
Author

Put up a PR cemlyn007#1

Appreciate you contributing the PR, merging it now, hope you have a good week!

@drakon
Copy link

drakon commented Aug 14, 2024

Hi there!

Thanks for this PR/fix! I also got it running on M1 Pro Sonoma 14.6!

I had some small issues though:

  1. I didn't have go, gh or bazel installed (easy with brew, just wanted to mention it for others that haven't used any of those tools)
  2. "go get [...]" didn't work. I found that it it's not supported anymore ('go get' is no longer supported outside a module.), so I just ignored it (und used the "go install [...]“)
  3. Bazel installed version 7.2.1 but when it notices that the projects uses a different one, it gives you a command to install the needed version as well
  4. This was the weirdest issue: For some reason even with the bazel version required by this (5.3.0), I failed during compilation (something about a .h file missing in Eigen). To circumvent, I changed the bazel version to 4.2.1 (as mentioned above). The funny thing is that after that was done, I can rebuild it (with --clean) even with bazel version 5.3.0. Even in a new conda environment. Only when I remove all the conda environments I can reproduce this issue.

So, when point 4) is considered these steps worked:

brew install go gh bazel
go install github.com/bazelbuild/bazelisk@latest
export PATH=$PATH:$(go env GOPATH)/bin

conda create -n py39
conda activate py39
conda install python=3.9 -c conda-forge
pip install tensorflow-macos==2.16.1
git clone https://github.com/deepmind/reverb
cd reverb
gh pr checkout 128
./oss_build.sh --release --clean true

One other question I had was about the versioning:

  • Now when this is complied and installed, pip list will say the version of dm-reverb is 0.11.0.
  • The problem now is that dm-reverb==0.11.0 is pined with tensorflow==2.12.0. But when I interpret this correctly the only issue why that is, is because of the absl version that needs to be aligned between reverb and tensorflow.
  • When I look at the diff, it seems that the absl version that you patched, is aligned with tensorflow==2.15 (as they bumped in reverb as well). So at least in regards to this, the dm-reverb version is actually comparable to 0.14.0 (latest version)
  • I checked tensorflow==2.16.2 and it seems to use the same absl version still
  • Another complication is that I came here because I want to use tf-agents, which vor version 0.19.0 requires tensorflow==2.15.0 and dm-reverb==0.14.0. It seems to work also with tensorflow==2.16.1 though (there's no newer release of tf-agents that would cover 2.16.x...)

So, my question is if this reasoning is correct, that the things work, or do you see any issues (e.g. I didn't see anything related to protoc)? Is there a way to test if versions do align or would that only be visible if something breaks? Would integrating the commits reverb is ahead of this PR improve things? (I see there are conflicts but don't know how severe they are)

@cemlyn007
Copy link
Author

Hi there!

Thanks for this PR/fix! I also got it running on M1 Pro Sonoma 14.6!

I had some small issues though:

  1. I didn't have go, gh or bazel installed (easy with brew, just wanted to mention it for others that haven't used any of those tools)
  2. "go get [...]" didn't work. I found that it it's not supported anymore ('go get' is no longer supported outside a module.), so I just ignored it (und used the "go install [...]“)
  3. Bazel installed version 7.2.1 but when it notices that the projects uses a different one, it gives you a command to install the needed version as well
  4. This was the weirdest issue: For some reason even with the bazel version required by this (5.3.0), I failed during compilation (something about a .h file missing in Eigen). To circumvent, I changed the bazel version to 4.2.1 (as mentioned above). The funny thing is that after that was done, I can rebuild it (with --clean) even with bazel version 5.3.0. Even in a new conda environment. Only when I remove all the conda environments I can reproduce this issue.

So, when point 4) is considered these steps worked:

brew install go gh bazel
go install github.com/bazelbuild/bazelisk@latest
export PATH=$PATH:$(go env GOPATH)/bin

conda create -n py39
conda activate py39
conda install python=3.9 -c conda-forge
pip install tensorflow-macos==2.16.1
git clone https://github.com/deepmind/reverb
cd reverb
gh pr checkout 128
./oss_build.sh --release --clean true

One other question I had was about the versioning:

  • Now when this is complied and installed, pip list will say the version of dm-reverb is 0.11.0.
  • The problem now is that dm-reverb==0.11.0 is pined with tensorflow==2.12.0. But when I interpret this correctly the only issue why that is, is because of the absl version that needs to be aligned between reverb and tensorflow.
  • When I look at the diff, it seems that the absl version that you patched, is aligned with tensorflow==2.15 (as they bumped in reverb as well). So at least in regards to this, the dm-reverb version is actually comparable to 0.14.0 (latest version)
  • I checked tensorflow==2.16.2 and it seems to use the same absl version still
  • Another complication is that I came here because I want to use tf-agents, which vor version 0.19.0 requires tensorflow==2.15.0 and dm-reverb==0.14.0. It seems to work also with tensorflow==2.16.1 though (there's no newer release of tf-agents that would cover 2.16.x...)

So, my question is if this reasoning is correct, that the things work, or do you see any issues (e.g. I didn't see anything related to protoc)? Is there a way to test if versions do align or would that only be visible if something breaks? Would integrating the commits reverb is ahead of this PR improve things? (I see there are conflicts but don't know how severe they are)

Hi @drakon, hope you're having a good week!

My draft MR is by no means in a great condition, just a ~working condition ;)! It certainly has some hardcoded stuff that at the moment I'd expect the builder (you, me et al) to edit before compiling but I suspect we could make it less hardcoded and MRs are certainly welcome and I'd be happy to review and merge them if it helps the cause!

I think but might be wrong as it has been some time since I have modified this MR, that protoc comes from downloading the particular version of gRPC used. I'd say the current "test" is to compile it and see if the compiled wheel can be used to run the Reverb tests?

As for supporting newer versions of TensorFlow, am happy for this MR to be brought up to date, if we can maintain compatibility with TensorFlow 2.12 and onwards that would be great but might not be a hard requirement.

As for your Bazel versioning issues, sorry I'm not a massive Bazel / C++ compiling expert but I guess it sounds like your conda environment was interfering a bit? Maybe it was modifying some path environment variables causing Bazel to not detect some files properly but that's a wild guess on my part.

As for the go get, I think the go team deprecated and removed go get in favour of go install, but you can get better documentation on installing Bazelisk from their GitHub readme.

@drakon
Copy link

drakon commented Aug 16, 2024

Hi @cemlyn007 thanks for your answer! Hope you having/had a good week too! :)

Sure, just wanted to share what issue I had; in case someone else runs into the same (self-caused?) things. Could be the conda environment yes. I haven't really used it for something else so maybe I haven't "reset" it properly. Might test that again to see. My thought went more into the direction that you both might have the same issue as I believe you both compiled with 4.2.1 and only after that later with 5.3.0 and might not have started with a clean environment.

Regarding PR: I was considering trying to improve and help but to be honest I realised that at this point I'm way too unfamiliar with bazel, packaging in general and in particular specific changes you made to be of any help and not making things worse.

But I'm glad it seems to work now. When I get to familiarising myself more and change something, happy to report back/create PR!

Thanks again for the work you already put into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants