-
The error occurs when including the ncrystal.h file in a newly-written Vitess module - YES, we're trying to include NCrystal in the package! - I get an error due to the library having architecture arm64, where the required one for my Mac is x86_64. So to me it seems that NCrystal is failing to build the x86_64 arch. Can you assist resolving this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments
-
That sounds weird, you should not need to mess around with MAKE_OSX_ARCHITECTURES unless you are cross compiling, I would have thought. How did you install NCrystal? From PyPI or conda-forge packages? |
Beta Was this translation helpful? Give feedback.
-
Btw., sounds great about vitess+ncrystal plans :-) |
Beta Was this translation helpful? Give feedback.
-
Btw., I would have thought M3 would imply arm64, not x86_64? |
Beta Was this translation helpful? Give feedback.
-
I cloned the repo and installed manually with cmake. Yeah, sorry, my Mac has arm64 not x86_64. The Vitess build is looking for both. |
Beta Was this translation helpful? Give feedback.
-
Yes of course it can, we are routinely using it on mac in both environments. We also have both PyPI and conda-forge packages available for both: So if you are either in a python or conda environment, you should simply be able to install with a single command without any need to mess around with manual cmake commands. However if you need to, it simply sounds to me like you have a bit of a mixed and unusual development environment, so your problem most likely comes from that. It is hard for me to debug your environment for you though, I don't have any experience with osx and universal binaries. But I suspect your issue would be the same if you try to build other projects than NCrystal, since NCrystal's CMake code really doesn't have many platform-specific hacks in this regard. cheers, |
Beta Was this translation helpful? Give feedback.
-
Alright, thanks for your help so far. We will investigate locally. |
Beta Was this translation helpful? Give feedback.
-
@nviolini what toolchain are you using to build ncrystal (i.e. "bare macOS dev tools + cmake", a conda env, homebrew or something else)? I tried myself using my "usual" conda setup - which however turned out to have an arm64-only libc. I'have instead now installed CMake to /Applications and unloaded any "non-vanilla" systems and simply run CMake + developer tools - and this seems to work:
|
Beta Was this translation helpful? Give feedback.
-
@willend Thanks for investigating this. cmake . -DCMAKE_INSTALL_PREFIX=/.../ncrystal_package and tried also with the option -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" but in my case the library is still arm64 only:
Anyways, for now I compile Vitess not for universal, but for arm64 only and it seems at least to not prompt errors anymore. |
Beta Was this translation helpful? Give feedback.
-
@nviolini Do you by any chance have any sort of homebrew/ports/conda/... environment active on your machine? How did you install CMake? Same way as Peter? What does Perhaps if you post your cmake output Peter will be able to spot something useful? |
Beta Was this translation helpful? Give feedback.
-
No conda env of any kind on my Mac. |
Beta Was this translation helpful? Give feedback.
-
cmake . -DCMAKE_INSTALL_PREFIX=/.../ncrystal_package |
Beta Was this translation helpful? Give feedback.
-
/usr/local/bin/cmake sounds a bit like homebrew or something like that. Do you have the command "brew" available in your shell? Perhaps you could try to download a fresh CMake application bundle, and then invoke it with the full path |
Beta Was this translation helpful? Give feedback.
-
Ok, it seems to have solved now. then built with cmake giving the full path to cmake: and finally
|
Beta Was this translation helpful? Give feedback.
-
I didn't install cmake again, but I think giving the full path was the key. |
Beta Was this translation helpful? Give feedback.
-
Great! :-) But I am pretty sure that it made no difference that you gave the full path. However, what IS always important with CMake (especially if something is not working) is to ALWAYS clear the entire build directory and try again. Otherwise you have no idea what you are debugging. In fact, I would recommend doing a proper I am going to rename this issue and convert it into a discussion, to serve as documentation for anyone else wanting to build universal binaries on OSX. |
Beta Was this translation helpful? Give feedback.
@nviolini what toolchain are you using to build ncrystal (i.e. "bare macOS dev tools + cmake", a conda env, homebrew or something else)?
I tried myself using my "usual" conda setup - which however turned out to have an arm64-only libc.
I'have instead now installed CMake to /Applications and unloaded any "non-vanilla" systems and simply run CMake + developer tools - and this seems to work: