-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Building on macOS #85
Comments
Thank you so much for this write up. Before, it was slightly more involved to compile on Apple, due to llvm's c++ standard library not fully supporting c++17. This meant one had to install gcc (though it was just one more As for the flags, almost all of them are optional, apart from a
Just adding something like this is probably not a good idea, looking at that path I assume the location of the library will be different if the user does not use homebrew to install openssl. I think users should probably know/research where their libraries are and update their Likewise, I will not include instructions on how to install Xcode or openssl in the README of this project: those belong on their own respective project pages. Besides, I can't really keep those things up-to-date as I don't own a Mac. But I will link to your post in the README, that way macOs users should be able to follow your instructions to compile, and add more information if the instructions change with new versions. Thanks again! |
Yep, that all makes sense. I have to admit that I hadn't read through your README in detail, I had gotten the suggestion to run the build script from the README for You're most welcome! |
Fix bepaald#9 Fix bepaald#85 Fix bepaald#70 Fix bepaald#53 Fix bepaald#38 Fix bepaald#4 Fix bepaald#1 Note: we could easily add support for g++-8 by copy/pasting the following changes: https://github.com/InfiniTimeOrg/InfiniSim/pull/83/files
Fix bepaald#9 Fix bepaald#85 Fix bepaald#70 Fix bepaald#53 Fix bepaald#38 Fix bepaald#4 Fix bepaald#1 Note: we could easily add support for g++-8 by copy/pasting the following changes: https://github.com/InfiniTimeOrg/InfiniSim/pull/83/files
Hello, thanks so much for making this project. Here's what I had to do to build it on a Mac.
There are some things you could add to the README, and part of the build process needs tweaking, I think. As a proviso, I'm not a C++ developer and everything here I found out on the fly, so please forgive me if there's anything silly.
Building requires installing the Xcode command line tools, otherwise the build script will die with an error that
xcrun
is missing. You could link to the downloads page and the support table for which version of Xcode you need to work with your installed version of macOS. Alternatively they can be installed withxcode-select --install
but I didn't find that out until I'd already done it manually, so not sure if that way takes the OS version into account.On that point, I encountered a bit of an edge case - as I had to download an older version of the Xcode command line tools (in my case 13.4, to work with macOS 12.3), I ended up with a version of
clang
that doesn't understand-march=native
in the build script. Apparently support for that arrived inclang
15. As I'm on a MacBook with an M1 processor, the workaround was to replace that flag with-mcpu=apple-m1
which became available inclang
13 (info via StackOverflow). I'm not sure what the case would be for other processors. Perhaps you could detect the installedclang
version and CPU architecture and switch the flag in this situation?Next up the user needs to install OpenSSL with
brew install openssl
. Thenclang
needs to be told where it is. After a lot of scrubbing through outdated answers on StackOverflow mentioning directories that are in different places now, I found this works:Maybe you can avoid that by adding something like
-I/opt/homebrew/opt/openssl@3/include/openssl
to the build steps? (This is pure speculation)Finally, the linker invocation failed which required two fixes. Firstly it also needed to be told where OpenSSL is, which required adding
-L/opt/homebrew/opt/openssl@3/lib
.Secondly there were some unrecognised flags. Currently it begins with:
-Wall -Wextra -Wl,-z,now -Wl,--as-needed -O3
That causes:
Stripping out
-s
andWl,-z,now
causes:ld: unknown option: --as-needed
. Strip that out too and it links successfully.The text was updated successfully, but these errors were encountered: