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

Get builds working on OSX #837

Merged
merged 10 commits into from
Apr 16, 2020
Merged

Get builds working on OSX #837

merged 10 commits into from
Apr 16, 2020

Conversation

daviddrysdale
Copy link
Contributor

Checklist

  • Pull request affects core Oak functionality (e.g. runtime, SDK, ABI)
    • I have written tests that cover the code changes.
    • I have checked that these tests are run by Cloudbuild
    • I have updated documentation accordingly.
    • I have raised an issue to
      cover any TODOs and/or unfinished work.
  • Pull request includes prototype/experimental work that is under
    construction.

@daviddrysdale daviddrysdale added the WIP Work in progress label Apr 10, 2020
@daviddrysdale daviddrysdale removed the WIP Work in progress label Apr 15, 2020
@daviddrysdale daviddrysdale marked this pull request as ready for review April 15, 2020 13:57
@@ -42,6 +42,6 @@ enum Level {
ERROR = 1;
WARN = 2;
INFO = 3;
DEBUG = 4;
DEBUGGING = 4;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"This avoids clashes with C++ builds that use DEBUG as a preprocessor macro." (from the commit message)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really see the comments while reviewing, unless I review one by on. Am I just an idiot and didn't notice where they are displayed (when looking at all the changes for the PR)?

'--keep_going'
)

if [[ "${OSTYPE}" == "darwin"* ]]; then
Copy link
Contributor

@anghelcovici anghelcovici Apr 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the * doing? Some kind of matching all? My bash knowledge is failing me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It matches anything starting with darwin (e.g. my OSTYPE is darwin19).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Bash skills

//! host functions by the Oak Runtime; however, the Runtime is not available
//! when compiling on the host platform.
//!
//! On some host platforms (e.g. `target_os = "linux"`), linking a library that
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite annoying :(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. It took a little bit of figuring out, so I thought a nice big comment would help for the future.

build:clang --cpu=k8

# Darwin's default compiler is clang, so no need for a crosstool
build:darwin --config=clang-base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the advantage of specifying a "cross" compiler was that it will force a certain version of clang (the one we download) instead of the one available on the system. Not really a big problem, depends how much we want to control that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a known version would be nice, but the wrapper scripts in toolchain/ didn't seem to quite work for a MacOS build, and just falling back to the native toolchain was the easy way out.

I can revisit what was going wrong with --config=clang but I might need your help with toolchain wrangling…

Copy link
Contributor

@rbehjati rbehjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although //oak/server:wasm_node_test fails on my machine.

exec ${PAGER:-/usr/bin/less} "$0" || exit 1
Executing tests from //oak/server:wasm_node_test
-----------------------------------------------------------------------------
[libprotobuf ERROR external/com_google_protobuf/src/google/protobuf/descriptor_database.cc:120] File already exists in database: google/protobuf/any.proto
[libprotobuf FATAL external/com_google_protobuf/src/google/protobuf/descriptor.cc:1356] CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):
libc++abi.dylib: terminating with uncaught exception of type google::protobuf::FatalException: CHECK failed: GeneratedDatabase()->Add(encoded_file_descriptor, size):
external/bazel_tools/tools/test/test-setup.sh: line 310: 26462 Abort trap: 6           "${TEST_PATH}" "$@" 2>&1

@daviddrysdale
Copy link
Contributor Author

Yeah, I didn't fix that because it was due for deletion in #801 – and has now been deleted.

This avoids clashes with C++ builds that use DEBUG as a preprocessor
macro.
The `readlink -f` path-canonicalization utility is not available on
OS X by default.
In .bazelrc, separate common options for clang-based build from the
options used to force an override of the host compiler to be clang.
This is only available on Bash versions >= 4.2, which is (in
particular) not available by default on OS X.
Earlier versions of Bash give errors rather than coping with empty
arrays, so check for no-arguments explicitly.
@daviddrysdale daviddrysdale merged commit b4a29e8 into project-oak:master Apr 16, 2020
@daviddrysdale daviddrysdale deleted the osx branch April 16, 2020 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants