heroiclabs / nakama-cpp

Generic C/C++ client for Nakama server.
https://heroiclabs.com/docs/cpp-client-guide
Apache License 2.0
69 stars 25 forks source link

Linux build fails #20

Closed ascherbakhov closed 5 years ago

ascherbakhov commented 5 years ago

Hi there! I have a following backtrace with SIGSEGV on creating defaultClient(release 2.10 build)

std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) 0x00007fa5303b719f Nakama::RestClient::RestClient(Nakama::NClientParameters const&, std::shared_ptr<Nakama::NHttpTransportInterface>) 0x00007fa5327116d7 Nakama::createRestClient(Nakama::NClientParameters const&, std::shared_ptr<Nakama::NHttpTransportInterface>) 0x00007fa5326dc079 NCocosHelper::createDefaultClient NCocosHelper.cpp:32 HelloWorld::InitNetwork HelloWorldScene.cpp:141 HelloWorld::init HelloWorldScene.cpp:49 HelloWorld::create HelloWorldScene.h:41 HelloWorld::createScene HelloWorldScene.cpp:34 AppDelegate::applicationDidFinishLaunching AppDelegate.cpp:121 cocos2d::Application::run CCApplication-linux.cpp:70 main main.cpp:38 __libc_start_main 0x00007fa52f95cb97 _start 0x0000556e2dc5640a

I haven't built yet nakama-cpp with debug symbols. Maybe you have any ideas before I have to check it

Dimon4eg commented 5 years ago

Hi, it crashes because you use Nakama library with another compiler version. Please build nakama-cpp for Linux with your compiler.

Use following settings to build for Cocos2d: build/build_config.py

BUILD_REST_CLIENT = True
BUILD_GRPC_CLIENT = False
BUILD_HTTP_CPPREST = False
BUILD_WEBSOCKET_CPPREST = False
BUILD_NAKAMA_STATIC = False
BUILD_NAKAMA_SHARED = True
ascherbakhov commented 5 years ago

I've done it, and it actually works, thank you! By the way, what about gRPC client for cocos2d-x? I'm a little bit confused with "gRPC client is off." in Nakama-cocos2d-x release page/

mofirouz commented 5 years ago

@ascherbakhov We've not turned on compilation of the client library with gRPC C++ Client library - as this uses HTTP/2 and is currently problematic. Instead, we are using the standard RESTful API that Nakama exposes which uses HTTP/1.1 just like every client library we have.

ascherbakhov commented 5 years ago

Thank you! What about compiling in cpprest mode? I failed to compile it: compiler didn't find cppprest headers, though rest client compiles successfully. Maybe i need to to additional actions rather than changing mode in build_config.py?

Dimon4eg commented 5 years ago

@ascherbakhov please post your config and error log. for cocos2d you don't need cpprest.

Dimon4eg commented 5 years ago

I think fixed the error in https://github.com/heroiclabs/nakama-cpp/commit/0ab96965a6e71a0d13ea2265a64de37ae1187b77 Please pull latest changes and try again.

ascherbakhov commented 5 years ago

Yes, now it works, thank you.