j4s0n-c / trowaSoft-VCV

trowaSoft Modules for VCV Rack
Other
105 stars 17 forks source link

Build failure when cross-compiling for arm64 platform #74

Closed cschol closed 1 year ago

cschol commented 1 year ago

The builds fails with the following errors on macOS arm64:

In file included from lib/oscpack/osc/OscReceivedElements.cpp:37:                                                                                          
lib/oscpack/osc/OscReceivedElements.h:104:In file included from lib/oscpack/osc/OscOutboundPacketStream.cpp:37:
lib/oscpack/osc/OscOutboundPacketStream.h:109:27:5: error:  error: constructor cannot be redeclared
class member cannot be redeclared                                                                                                                          
    OutboundPacketStream& operator<<( int rhs )                           
    ReceivedPacket( const char *contents, int size )
    ^                          ^             

lib/oscpack/osc/OscOutboundPacketStream.h:106:27: note: previous declaration is here
lib/oscpack/osc/OscReceivedElements.h:95:5: note: previous definition is here                                                                              
    ReceivedPacket( const char *contents, osc_bundle_element_size_t size )
    ^                      
    OutboundPacketStream& operator<<( int32 rhs );                                                                                                         
                          ^                       
In file included from lib/oscpack/osc/OscPrintReceivedElements.cpp:37:
In file included from lib/oscpack/osc/OscPrintReceivedElements.h:42:
lib/oscpack/osc/OscReceivedElements.h:104:5: error: constructor cannot be redeclared
    ReceivedPacket( const char *contents, int size )
    ^                                                                                                                                                      
lib/oscpack/osc/OscReceivedElements.h:95:1 error generated.
5: note: previous definition is here
    ReceivedPacket( const char *contents, osc_bundle_element_size_t size )                                                                                 
    ^                                                                     
make[1]: *** [/home/build/rack-plugin-toolchain/Rack-SDK-mac-arm64/compile.mk:87: build/lib/oscpack/osc/OscOutboundPacketStream.cpp.o] Error 1
make[1]: *** Waiting for unfinished jobs....    
1 error generated.                                     
make[1]: *** [/home/build/rack-plugin-toolchain/Rack-SDK-mac-arm64/compile.mk:87: build/lib/oscpack/osc/OscReceivedElements.cpp.o] Error 1
1 error generated.                                                                                                                                         
make[1]: *** [/home/build/rack-plugin-toolchain/Rack-SDK-mac-arm64/compile.mk:87: build/lib/oscpack/osc/OscPrintReceivedElements.cpp.o] Error 1
In file included from src/Module_oscCVExpander.cpp:7:
In file included from src/Module_oscCVExpander.hpp:9:                                                                                                      
src/../lib/oscpack/osc/OscOutboundPacketStream.h:109:27: error: class member cannot be redeclared
    OutboundPacketStream& operator<<( int rhs )
                          ^                     
src/../lib/oscpack/osc/OscOutboundPacketStream.h:106:27: note: previous declaration is here
    OutboundPacketStream& operator<<( int32 rhs );      
                          ^                                                                                                                                
In file included from src/Module_oscCVExpander.cpp:7:
In file included from src/Module_oscCVExpander.hpp:11:
src/../lib/oscpack/osc/OscReceivedElements.h:104:5: error: constructor cannot be redeclared
    ReceivedPacket( const char *contents, int size )                      
    ^
src/../lib/oscpack/osc/OscReceivedElements.h:95:5: note: previous definition is here
    ReceivedPacket( const char *contents, osc_bundle_element_size_t size )                                                                                 
    ^              

Patch to resolve issues:

diff --git a/lib/oscpack/osc/OscOutboundPacketStream.h b/lib/oscpack/osc/OscOutboundPacketStream.h
index 3cc2835..34f2d7b 100644
--- a/lib/oscpack/osc/OscOutboundPacketStream.h
+++ b/lib/oscpack/osc/OscOutboundPacketStream.h
@@ -105,7 +105,7 @@ public:
     OutboundPacketStream& operator<<( const InfinitumType& rhs );
     OutboundPacketStream& operator<<( int32 rhs );

-#if !(defined(__x86_64__) || defined(_M_X64))
+#if !(defined(ARCH_ARM64)) && !(defined(__x86_64__) || defined(_M_X65))
     OutboundPacketStream& operator<<( int rhs )
             { *this << (int32)rhs; return *this; }
 #endif
diff --git a/lib/oscpack/osc/OscReceivedElements.h b/lib/oscpack/osc/OscReceivedElements.h
index b6205f3..f776919 100644
--- a/lib/oscpack/osc/OscReceivedElements.h
+++ b/lib/oscpack/osc/OscReceivedElements.h
@@ -100,7 +100,7 @@ public:
         : contents_( contents )
         , size_( ValidateSize( (osc_bundle_element_size_t)size ) ) {}

-#if !(defined(__x86_64__) || defined(_M_X64))
+#if !(defined(ARCH_ARM64)) && !(defined(__x86_64__) || defined(_M_X64))
     ReceivedPacket( const char *contents, int size )
         : contents_( contents )
         , size_( ValidateSize( (osc_bundle_element_size_t)size ) ) {}
chichian commented 1 year ago

Thanks. Hopefully it work now.

cschol commented 1 year ago

It does. Thank you.