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

Fix macOS build failure by adding export ARCHFLAGS="-arch x86_64" #1168

Merged
merged 1 commit into from
Nov 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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