Can't build on macOS Big Sur
uspasojevic96 opened this issue · 6 comments
- Curl cries about
The cmake option CMAKE_USE_DARWINSSL was renamed to CMAKE_USE_SECTRANSP
- can't find boost
- can't find asio
Uncheck the box CMAKE_USE_DARWINSSL if using the CMake GUI. Or set the CACHE option to OFF in the Sleepy-Discord CMakeLists.txt.
Building for macOS is kind of a disaster right now to be honest. I honestly recommend a Linux VM for now if you can. The issues are being worked out by others tho.
Yep!
Could not build on MacOS or even Windows10 whatsoever, had to resort to dual booting linux on one of my laptops.
Even if you end up fixing most of the errors on a mac, you'll most likely end up getting caught in an OpenSSL error since apple has disabled OpenSSL backend for cmake and theres basically no way, that i could find, to enable it.
You can build it on MacOS. I've done it with the GUI version of CMake using both vcpkg and building openssl from the source code. There's just some extra steps you have to take. But if you join the discord I can assist you with it.
I have OpenSSL through brew, after changing half of CMakeLists.txt it still can't find ASIO and Boost even though they exist and are exported (everything is also installed through brew). I have sleepy-discord added as 3rd-party dependency but I just can't get it to build, after couple hours I simply gave up trying. When I think about the delay between me opening the issue and someone responding, I am not even sure I want to try it again.
@mischaskaya why not tell the steps here so that it's visible for everyone instead of making me join some server to tell me there?
I have OpenSSL through brew, after changing half of CMakeLists.txt it still can't find ASIO and Boost even though they exist and are exported (everything is also installed through brew). I have sleepy-discord added as 3rd-party dependency but I just can't get it to build, after couple hours I simply gave up trying. When I think about the delay between me opening the issue and someone responding, I am not even sure I want to try it again.
@mischaskaya why not tell the steps here so that it's visible for everyone instead of making me join some server to tell me there?
Because it's a long set of steps, but if you prefer I'd post them here and you'd like to try it then sure.
Steps for compiling Sleepy Discord with CMake GUI on MacOS
Clone vcpkg from GitHub
Terminal : git clone https://github.com/microsoft/vcpkg.git
Navigate to vcpkg folder
Terminal : cd vcpkg
Build it
Terminal : ./bootstrap-vcpkg.sh
Install openssl dynamic (for some reason it has to be dynamic..)
Terminal : ./vcpkg install openssl:x64-osx-dynamic
create source directory for our project
terminal : cd ..
terminal : mkdir source
navigate to source
terminal : cd source
create build directory
terminal : mkdir build
create deps directory
terminal : mkdir deps
create our source.cpp
terminal : touch source.cpp
Edit source.cpp with example from GitHub
#include <sleepy_discord/sleepy_discord.h>
class MyClientClass : public SleepyDiscord::DiscordClient {
public:
using SleepyDiscord::DiscordClient::DiscordClient;
void onMessage(SleepyDiscord::Message message) override {
if (message.startsWith("whcg hello"))
sendMessage(message.channelID, "Hello " + message.author.username);
}
};
int main() {
myClientClass client("token", SleepyDiscord::USER_CONTROLED_THREADS);
client.run();
}
create our CMakeLists.txt
terminal : touch CMakeLists.txt
Edit CMakeLists.txt with example from sleepy_discord documentation page
cmake_minimum_required (VERSION 3.6)
project(source)
add_executable(source source.cpp)
add_subdirectory(deps/sleepy-discord)
target_link_libraries(source sleepy-discord)
Navigate to deps
terminal : cd deps
clone sleepy_discord from github
terminal : git clone https://github.com/yourWaifu/sleepy-discord.git
Launch cmake GUI (/path/to/vcpkg/downloads/tools/cmake-3.19-2-osx/cmake-3.19.2-macos-univeral)
Set source directory (/path/to/source)
Set build directory (/path/to/source/build)
Configure for unix make file,
Uncheck CMAKE_USE_DARWINSSL
Add Entry
Name: OPENSSL_INCLUDE_DIR
Type: path
Value: /path/to/vcpkg/installed/x64-osx-dynamic/include
Configure
Two new fields will appear (make sure advanced box is checked/ticked)
Edit OPENSSL_CRYPTO_LIBRARY to /path/to/vcpkg/installed/x64-osx-dynamic/lib/libcrypto.dylib
Edit OPENSSL_SSL_LIBRARY to /path/to/vcpkg/installed/x64-osx-dynamic/lib/libssl.dylib
Configure
Generate
Navigate to the build directory
terminal : cd /path/to/source/build
Set LIBRARY_PATH for terminal session
Terminal: export LIBRARY_PATH=/path/to/vcpkg/installed/x64-osx-dynamic/lib
compile
terminal : make
done