larku / RakNet

RakNet is a cross platform, open source, C++ networking engine for game programmers.
Other
60 stars 27 forks source link

Building SwigDLL on Mac OS X? #37

Open jeremieweldin opened 8 years ago

jeremieweldin commented 8 years ago

I'm trying to build the C# wrappers on Mac OS X.

This is what I get: `Jeremies-MacBook-Air:~ jeremieweldin$ cd Projects/RakNet/DependentExtensions/Swig/ Jeremies-MacBook-Air:Swig jeremieweldin$ ./MakeSwig.sh /Users/jeremieweldin/Projects/RakNet/Source/ Performing Swig build without SQLiteClientLogger /Users/jeremieweldin/Projects/RakNet/Source/RakNetDefines.h:28: Warning 305: Bad constant value (ignored). /Users/jeremieweldin/Projects/RakNet/Source/RakPeer.h:57: Warning 401: Nothing known about base class 'RNS2EventHandler'. Ignored. /Users/jeremieweldin/Projects/RakNet/Source/NatTypeDetectionClient.h:45: Warning 401: Nothing known about base class 'RNS2EventHandler'. Ignored. /Users/jeremieweldin/Projects/RakNet/Source/NatTypeDetectionServer.h:55: Warning 401: Nothing known about base class 'RNS2EventHandler'. Ignored. /Users/jeremieweldin/Projects/RakNet/Source/RakWString.h:40: Warning 503: Can't wrap 'operator wchart' unless renamed to a valid identifier. Swig build complete Removing and replacing the sample cs files with fresh ones mv: rename ./SwigLinuxCSharpSample/TestMain.cs to ./SwigLinuxCSharpSample/TestMain.txt: No such file or directory rm: ./SwigLinuxCSharpSample/_.cs: No such file or directory mv: rename ./SwigLinuxCSharpSample/TestMain.txt to ./SwigLinuxCSharpSample/TestMain.cs: No such file or directory usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory Building the Swig Dynamic Link Building without SQLiteClientLogger DirectoryDeltaTransfer.cpp:45:21: warning: address of array 'onFileStruct->fileName' will always evaluate to 'true' [-Wpointer-bool-conversion] if (onFileStruct->fileName && onFileStruct->fileData && ...


DirectoryDeltaTransfer.cpp:61:26: warning: address of array
      'fps->onFileStruct->fileName' will always evaluate to 'true'
      [-Wpointer-bool-conversion]
                if (fps->onFileStruct->fileName && subdirLen < strlen(fp...
                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~ ~~
2 warnings generated.
DynDNS.cpp:222:9: warning: address of array 'existingHost' will always evaluate
      to 'true' [-Wpointer-bool-conversion]
                                if (existingHost && strcmp(existingHost...
                                    ^~~~~~~~~~~~ ~~
1 warning generated.
../DependentExtensions/Swig/SwigOutput/CplusDLLIncludes/RakNet_wrap.cxx:339:8: warning: 
      extra tokens at end of #endif directive [-Wextra-tokens]
# endif SWIGWIN

```
   ^
   //
```

In file included from ../DependentExtensions/Swig/SwigOutput/CplusDLLIncludes/RakNet_wrap.cxx:409:
./DS_Multilist.h:1004:12: warning: enumeration value
      'ML_VARIABLE_DURING_RUNTIME' not handled in switch [-Wswitch]
                        switch (newType)
                                ^
./DS_Multilist.h:1022:12: warning: enumeration value
      'ML_VARIABLE_DURING_RUNTIME' not handled in switch [-Wswitch]
                        switch (newType)
                                ^
./DS_Multilist.h:1040:12: warning: enumeration value
      'ML_VARIABLE_DURING_RUNTIME' not handled in switch [-Wswitch]
                        switch (newType)
                                ^
./DS_Multilist.h:1066:12: warning: enumeration value
      'ML_VARIABLE_DURING_RUNTIME' not handled in switch [-Wswitch]
                        switch (newType)
                                ^
In file included from ../DependentExtensions/Swig/SwigOutput/CplusDLLIncludes/RakNet_wrap.cxx:377:
In file included from ./RakPeer.h:22:
In file included from ./ReliabilityLayer.h:32:
./DS_BPlusTree.h:1003:42: warning: format specifies type 'int' but the argument
      has type 'DataStructures::Table::Row *' [-Wformat]
                        RAKNET_DEBUG_PRINTF(" %i. %i\n", i+1, leaf->data[i]);
                                                  ~~          ^~~~~~~~~~~~~
./DS_BPlusTree.h:1008:15: note: in instantiation of member function
      'DataStructures::BPlusTree<unsigned int, DataStructures::Table::Row *,
      16>::PrintLeaf' requested here
                ForEachLeaf(PrintLeaf);
                            ^
../DependentExtensions/Swig/SwigOutput/CplusDLLIncludes/RakNet_wrap.cxx:26303:11: note: 
      in instantiation of member function 'DataStructures::BPlusTree<unsigned
      int, DataStructures::Table::Row *, 16>::PrintLeaves' requested here
  (arg1)->PrintLeaves();
          ^
6 warnings generated.
Undefined symbols for architecture x86_64:
  "operator+(RakNet::RakWString const&, RakNet::RakWString const&)", referenced from:
      _CSharp_OpPlus__SWIG_1 in RakNet_wrap-519591.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
There was an error durion the DLL build`
jmderuty commented 8 years ago

There is currently an issue with Raknet & Swig because the operator + is declared for the RakWString class, but not implemented. That's not an issue when compiling the cpp library because the operator is never used (so the compiler doesn't need it). However, swig creates wrappers for every available symbols, including the operator.

The solution: Remove the operator+(RakNet::RakWString const&, RakNet::RakWString const&) declaration from rakwstring.h and regenerate the swig library.

jeremieweldin commented 8 years ago

Thanks!