# Suggestions for getting crc32c library working with CMAKE\_OSX\_ARCHITECTURES

**URL:** https://discourse.cmake.org/t/suggestions-for-getting-crc32c-library-working-with-cmake-osx-architectures/1794
**Category:** Usage
**Tags:** os:macos
**Created:** [September 8, 2020, 3:34pm UTC](https://discourse.cmake.org/t/suggestions-for-getting-crc32c-library-working-with-cmake-osx-architectures/1794 "2020-09-08T15:34:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![hjmallon](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hjmallon/32/819_2.png) [@hjmallon](https://discourse.cmake.org/u/hjmallon)
#### Post date: [September 8, 2020, 3:34pm UTC](https://discourse.cmake.org/t/suggestions-for-getting-crc32c-library-working-with-cmake-osx-architectures/1794/1 "2020-09-08T15:34:15Z")

</div>

Google’s crc32c library is pretty small and gives good performing crc32c implementations for arm and intel [https://github.com/google/crc32c](https://github.com/google/crc32c)

It currently builds for Intel (everywhere) and arm on linux. My PR here gets it working for ARM on macOS [https://github.com/google/crc32c/pull/43](https://github.com/google/crc32c/pull/43).

However it doesn’t work when using CMAKE\_OSX\_ARCHITECTURES=“arm64;x86\_64” for a few reasons:

- try\_compile of the intel or arm intrinsics fails when compiling the other platform so they return false
- if forced to true the arm compiler complains at being sent -msse4.2 for the intel file and the intel compile complains about the equivalent arm thing.

Does anyone have any good ideas of how to make a library like this work well?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 15, 2020, 2:57pm UTC](https://discourse.cmake.org/t/suggestions-for-getting-crc32c-library-working-with-cmake-osx-architectures/1794/2 "2020-11-15T14:57:13Z")

</div>

Hmm. I’m not sure how to send arch-specific flags to a macOS fat binary compilation.

Cc: @brad.king @gjasny

---

<div class="post-metadata">

### Author: ![gjasny](https://discourse.cmake.org/user_avatar/discourse.cmake.org/gjasny/32/187_2.png) [@gjasny](https://discourse.cmake.org/u/gjasny)
#### Post date: [November 16, 2020, 9:50am UTC](https://discourse.cmake.org/t/suggestions-for-getting-crc32c-library-working-with-cmake-osx-architectures/1794/3 "2020-11-16T09:50:45Z")

</div>

You could use `-Xarch_xyz` like: `-Xarch_i386 -fomit-frame-pointer`. The best documentation I could find is here: [DriverInternals](https://opensource.apple.com/source/lldb/lldb-69/llvm/tools/clang/docs/DriverInternals.html#int_overview).

Hope this helps!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 16, 2020, 10:47am UTC](https://discourse.cmake.org/t/suggestions-for-getting-crc32c-library-working-with-cmake-osx-architectures/1794/4 "2020-11-16T10:47:46Z")

</div>

Ah. Note that in actual usage, you’ll likely need to let CMake know that these are compound options like `"SHELL:-Xarch_i386 -fomit-frame-pointer"`.
