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

Can't build on macOS Big Sur #207

Open
uspasojevic96 opened this issue Mar 17, 2021 · 6 comments
Open

Can't build on macOS Big Sur #207

uspasojevic96 opened this issue Mar 17, 2021 · 6 comments

Comments

@uspasojevic96
Copy link

  1. Curl cries about The cmake option CMAKE_USE_DARWINSSL was renamed to CMAKE_USE_SECTRANSP
  2. can't find boost
  3. can't find asio
@lolriven
Copy link

lolriven commented Apr 1, 2021

Uncheck the box CMAKE_USE_DARWINSSL if using the CMake GUI. Or set the CACHE option to OFF in the Sleepy-Discord CMakeLists.txt.

@yourWaifu
Copy link
Owner

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.

@Jerick120
Copy link

Jerick120 commented Apr 1, 2021

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.

@mischaskaya
Copy link

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.

@uspasojevic96
Copy link
Author

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?

@mischaskaya
Copy link

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

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

5 participants