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

Compatibility with iOS #46

Closed
mikesun opened this issue Apr 14, 2017 · 4 comments
Closed

Compatibility with iOS #46

mikesun opened this issue Apr 14, 2017 · 4 comments

Comments

@mikesun
Copy link

mikesun commented Apr 14, 2017

Able to build on iOS but run into runtime issues.

Run into memory access issues (EXC_BAD_ACCESS) involving the allocator/deallocator macros, e.g.

#define YOJIMBO_NEW( a, T, ... ) ( new ( (a).Allocate( sizeof(T), __FILE__, __LINE__ ) ) T(__VA_ARGS__) )

Stack trace:

#0    0x0000000103c6b7fc in yojimbo::ClientServerPacketFactory::CreatePacket(int) at /Users/Dom/Desktop/libyojimbo/./yojimbo_client_server_packets.h:263
#1    0x0000000103c7fb04 in yojimbo::PacketFactory::Create(int) at /Users/Dom/Desktop/libyojimbo/yojimbo_packet.cpp:266
#2    0x0000000103c64b54 in yojimbo::Client::CreatePacket(int) at /Users/Dom/Desktop/libyojimbo/yojimbo_client.cpp:305
#3    0x0000000103c655f0 in yojimbo::Client::SendPackets() at /Users/Dom/Desktop/libyojimbo/yojimbo_client.cpp:321
#4    0x00000001000596d8 in ::copr_pump_frame(double *, double) at /Users/Dom/Desktop/interspace-ios/Classes/copr_client.cpp:268
#5    0x0000000100059510 in ::copr_connect(double *, double, uint32_t, uint64_t, const char *, uint16_t) at /Users/Dom/Desktop/interspace-ios/Classes/copr_client.cpp:125
#6    0x00000001001e9b20 in ::CoprClient_copr_connect_m3420134110(Il2CppObject *, double *, double, uint32_t, uint64_t, String_t *, uint16_t, const MethodInfo *) at /Users/Dom/Desktop/interspace-ios/Classes/Native/Bulk_Assembly-CSharp_0.cpp:23636
#7    0x00000001001e668c in ::CoprClient_CoprThreadRun_m141907639(Il2CppObject *, const MethodInfo *) at /Users/Dom/Desktop/interspace-ios/Classes/Native/Bulk_Assembly-CSharp_0.cpp:23067
#8    0x00000001031a4b54 in ::ThreadStart_Invoke_m225334093(ThreadStart_t124146534 *, const MethodInfo *) at /Users/Dom/Desktop/interspace-ios/Classes/Native/Bulk_mscorlib_7.cpp:45558
#9    0x0000000103927838 in RuntimeInvoker_Void_t2863195528(MethodInfo const*, void*, void**) at /Users/Dom/Desktop/interspace-ios/Classes/Native/Il2CppInvokerTable.cpp:1065
#10    0x00000001045ff064 in il2cpp::vm::Runtime::DelegateInvoke(Il2CppDelegate*, void**, Il2CppException**) ()
#11    0x00000001045d9248 in ::RunThreadWrapper() at /Users/builduser/buildslave/unity/build/Runtime/Threads/Thread.cpp:57
#12    0x00000001045e16e0 in ::RunThreadWrapper() at /Users/builduser/buildslave/unity/build/Runtime/Threads/Thread.cpp:52
#13    0x00000001045e74ec in il2cpp::os::ThreadImpl::ThreadStartWrapper(void*) ()
#14    0x000000018480575c in _pthread_body ()
#15    0x000000018480566c in _pthread_start ()
#16    0x0000000184802d84 in thread_start ()

From debugger:

In a hack, replaced the allocator macros with just plain new and delete which seems to get around the EXC_BAD_ACCESS issue, but clients are unable to establish connections with the server.

The code works on Mac (x86_64), Linux (x86_64) and Windows (x86_64).

@gafferongames
Copy link
Contributor

Thanks for reporting this!

Could you possibly create a minimal xcode project that reproduces this issue in an iOS build?

cheers

  • Glenn

@gafferongames
Copy link
Contributor

Out of curiousity, is your project multithreaded?

@mikesun
Copy link
Author

mikesun commented Apr 14, 2017

Have isolated the issue to be with Unity using the library. Will update when things are figured out.

Yes, project is multi-threaded, but accesses libyojimbo in safe manner.

@gafferongames
Copy link
Contributor

OK sounds good. Let me know what you find!

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

2 participants