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

Expected to work on M1? #29

Closed
jsphweid opened this issue Feb 4, 2024 · 3 comments
Closed

Expected to work on M1? #29

jsphweid opened this issue Feb 4, 2024 · 3 comments

Comments

@jsphweid
Copy link

jsphweid commented Feb 4, 2024

Is this expected to build on Mac M1?

When using riegeli, it seems to have issues compiling highwayhash.

ld: warning: ignoring duplicate libraries: '-lc++', '-lm', '-lpthread'
ld: Undefined symbols:
  highwayhash::HighwayHash<16u>::operator()(unsigned long long const (&) [4], char const*, unsigned long, unsigned long long*) const, referenced from:
      unsigned int highwayhash::InstructionSets::Run<highwayhash::HighwayHash, unsigned long long const (&) [4], char const*, unsigned long, unsigned long long*>(unsigned long long const (&) [4], char const*&&, unsigned long&&, unsigned long long*&&) in libhash.a[2](hash.o)
  highwayhash::HighwayHashCat<16u>::operator()(unsigned long long const (&) [4], highwayhash::StringView const*, unsigned long, unsigned long long*) const, referenced from:
      unsigned int highwayhash::InstructionSets::Run<highwayhash::HighwayHashCat, unsigned long long const (&) [4], highwayhash::StringView*, unsigned long, unsigned long long*>(unsigned long long const (&) [4], highwayhash::StringView*&&, unsigned long&&, unsigned long long*&&) in libhash.a[2](hash.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error in child process '/usr/bin/xcrun'. 1
external/local_config_cc/cc_wrapper.sh: line 69: 25217 Abort trap: 6           "$(/usr/bin/dirname "$0")"/wrapped_clang "$@"

I have no issues on my x86 ubuntu machine. But the above is what I get on mac. I'm not immediately sure why it can't find these definitions, although I suspect it has to do with some potential weirdness in highwayhash.BUILD -- something with highwayhash/highwayhash_target.cc where I believe those definitions are located -- it's being included in textual_hdrs which seems odd (ex. https://github.com/google/riegeli/blob/master/third_party/highwayhash.BUILD#L178).

Would be curious if anyone else on M1 has this issue.

@jan-wassenberg
Copy link
Member

Hi, it indeed looks like the build file is not deciding to include the hh_neon target.
We base this on "@platforms//cpu:arm64": [],. I'm not very familiar with Bazel's platform detection; is there something else we should be checking for M1?

@jsphweid
Copy link
Author

jsphweid commented Feb 4, 2024

Thanks for the quick response. I'm not too familiar with this stuff either outside vanilla usage. Here's what I found.

If I change "aarch64" here to "darwin_arm64" instead, it works. I think that's what I'll do. I'm not immediately sure whether this is a general problem or one somehow related to my setup.

I found I could also define that config_setting with constraint_values instead in which case ["@platforms//cpu:aarch64"], ["@platforms//cpu:arm64"] and probably others work as well.

Potentially related: bazelbuild/bazel#15175.

@jsphweid jsphweid closed this as completed Feb 4, 2024
@jan-wassenberg
Copy link
Member

Thanks for letting us know :)

QrczakMK added a commit that referenced this issue Feb 8, 2024
Fixes #29.

PiperOrigin-RevId: 605422573
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

No branches or pull requests

2 participants