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

Issue with oscpack #50

Open
hannahwolfe opened this issue Jun 6, 2022 · 15 comments
Open

Issue with oscpack #50

hannahwolfe opened this issue Jun 6, 2022 · 15 comments

Comments

@hannahwolfe
Copy link
Contributor

Trying to install and run allolib. Examples that do not require graphics work fine (eg: example_math_random) but examples that require Parameter OSC Handshake server like all the graphics examples do not. This issue has been produced on two of the new macs with M1 chips, but could not be reproduced with a mac with an i9 processor.

Assertion failed: (sizeof(osc::int32) == 4), function OutboundPacketStream, file /[path]/C++/allolib/external/oscpack/osc/OscOutboundPacketStream.cpp, line 166.
Abort trap: 6

Heres the error message generated by the macOS system:
Process: example_graphics_cieColor [75498]
Path: /Users/USER/Desktop/*/example_graphics_cieColor
Identifier: example_graphics_cieColor
Version: 0
Code Type: ARM-64 (Native)
Parent Process: bash [75445]
Responsible: Terminal [75442]
User ID: 502

Date/Time: 2022-05-30 13:53:19.048 -0400
OS Version: macOS 11.3.1 (20E241)
Report Version: 12

@mantaraya36
Copy link
Contributor

mantaraya36 commented Jun 6, 2022

@MyunginLee Have you seen this issue when compiling for M1s?

Since it is an assertion, I am guessing that release builds don't catch this issue, as we have built on M1 devices. The issue is only for ints, so we have not seen issues as their use is less common.

I am guessing the source of the problem is here external/oscpack/osc/OscTypes.h:64 :

#if defined(__x86_64__) || defined(_M_X64)

typedef signed int int32;
typedef unsigned int uint32;

#else

typedef signed long int32;
typedef unsigned long uint32;

#endif

Can you try changing:

typedef signed long int32;
typedef unsigned long uint32;

to

#include <ctypes>
typedef int32_t int32;
typedef uint32_t uint32;

@mantaraya36
Copy link
Contributor

If the M1 for some reason passes this test:

#if defined(__x86_64__) || defined(_M_X64)

can you try changing the contents of that branch?

@MyunginLee
Copy link
Member

MyunginLee commented Jun 6, 2022

Hi, I didn't specifically experienced that issue maybe because I have Rosetta 2 installed.
So codes using Parameter OSC Handshake server works fine for me.
I noticed my system goes to else instead of:

#if defined(__x86_64__) || defined(_M_X64)

and

typedef int32_t int32;
typedef uint32_t uint32;

didn't work since int32_t is undefined.

Including this didn't work:

#include <ctypes>

so I tried:

#include <ctype.h>

and it showed:

In file included from /Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscTypes.cpp:37:
/Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscTypes.h:73:9: error: unknown type name 'int32_t'; did you mean '__int32_t'?
typedef int32_t int32;
        ^~~~~~~
        __int32_t
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include/arm/_types.h:20:33: note: '__int32_t' declared here
typedef int                     __int32_t;
                                ^
In file included from /Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscTypes.cpp:37:
/Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscTypes.h:74:9: error: unknown type name 'uint32_t'
typedef uint32_t uint32;
        ^
2 errors generated.

@mantaraya36
Copy link
Contributor

mantaraya36 commented Jun 6, 2022 via email

@younkhg
Copy link
Contributor

younkhg commented Jun 6, 2022 via email

@mantaraya36
Copy link
Contributor

mantaraya36 commented Jun 6, 2022 via email

@MyunginLee
Copy link
Member

MyunginLee commented Jun 6, 2022

Including <cstdint> or <stdint.h> gives:

In file included from /Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscReceivedElements.cpp:37:
/Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscReceivedElements.h:104:5: error: constructor cannot be redeclared
    ReceivedPacket( const char *contents, int size )
    ^
/Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscReceivedElements.h:95:5: note: previous definition is here
    ReceivedPacket( const char *contents, osc_bundle_element_size_t size )
    ^
1 error generated.
make[3]: *** [../../../../../build/Release/external/CMakeFiles/oscpack.dir/oscpack/osc/OscReceivedElements.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from /Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscOutboundPacketStream.cpp:37:
/Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscOutboundPacketStream.h:109:27: error: class member cannot be redeclared
    OutboundPacketStream& operator<<( int rhs )
                          ^
/Users/ben/Desktop/projects/allolib_playground/allolib/external/oscpack/osc/OscOutboundPacketStream.h:106:27: note: previous declaration is here
    OutboundPacketStream& operator<<( int32 rhs );
                          ^
1 error generated.

@younkhg
Copy link
Contributor

younkhg commented Jun 6, 2022

int == int32_t, one of the overloads should be disabled. It's our local copy so it should be fine. Maybe pick one that would be more frequently used?

@mantaraya36
Copy link
Contributor

mantaraya36 commented Jun 7, 2022 via email

@younkhg
Copy link
Contributor

younkhg commented Jun 7, 2022

Yes, using al_Socket for networking and using smaller one to only serialize/deserialize would be a good option.

@kybr
Copy link
Member

kybr commented Jun 7, 2022 via email

@mantaraya36
Copy link
Contributor

mantaraya36 commented Jun 7, 2022 via email

@mantaraya36
Copy link
Contributor

mantaraya36 commented Jun 7, 2022 via email

@kybr
Copy link
Member

kybr commented Jun 7, 2022 via email

@hannahwolfe
Copy link
Contributor Author

Thank you for the information, this directed us to a temporary solution, modifying the oscpack library.

So it looks like the below conditional needs to return true on their machines:
(defined(x86_64) || defined(_M_X64))

This meant making modifications to the conditionals in the following files
oscType.h line 64
oscReceiveElements.h line 103
oscOutBoundPacketStream.h line 108

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