Skip to content

Commit

Permalink
Fix macOS build failure by adding export ARCHFLAGS="-arch x86_64" (…
Browse files Browse the repository at this point in the history
…#1168)

See giampaolo/psutil#1832

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
  • Loading branch information
teskobif7 authored Nov 1, 2020
1 parent 7898771 commit 598261e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ jobs:
echo "Bring /usr/bin to front as GitHub does not use system python3 by default"
export PATH=/usr/bin:$PATH
echo $PATH
echo "Note the following is to fix a bug in Apple's python 3.7.3"
sudo sed -i.bak 's/sys.modules.values()/list(sys.modules.values())/g' /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/linecache.py
python3 --version
python3 -c 'import site; print(site.getsitepackages())'
python3 .github/workflows/build.instruction.py --sudo=true README.md "#### macOS" > source.sh
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,25 @@ $ bazel run //tools/lint:lint -- black pyupgrade -- tensorflow_io/core/python/o

#### macOS

On macOS Catalina or higher, it is possible to build tensorflow-io with
system provided python 3 (3.7.3). Both `tensorflow` and `bazel` are needed.
On macOS Catalina 10.15.7, it is possible to build tensorflow-io with
system provided python 3.8.2. Both `tensorflow` and `bazel` are needed.

NOTE: Xcode installation is needed as tensorflow-io requires Swift for accessing
Apple's native AVFoundation APIs. Also there is a bug in macOS's native python 3.7.3
that could be fixed with https://github.com/tensorflow/tensorflow/issues/33183#issuecomment-554701214
NOTE: The system default python 3.8.2 on macOS 10.15.7 will cause `regex` installation
error caused by compiler option of `-arch arm64 -arch x86_64` (similar to the issue
mentioned in https://github.com/giampaolo/psutil/issues/1832). To overcome this issue
`export ARCHFLAGS="-arch x86_64"` will be needed to remove arm64 build option.

```sh
#!/usr/bin/env bash

# Disable arm64 build by specifying only x86_64 arch.
# Only needed for macOS's system default python 3.8.2 on macOS 10.15.7
export ARCHFLAGS="-arch x86_64"

# Use following command to check if Xcode is correctly installed:
xcodebuild -version

# macOS's default python3 is 3.7.3
# Show macOS's default python3
python3 --version

# Install Bazel version specified in .bazelversion
Expand Down

0 comments on commit 598261e

Please sign in to comment.