[ENet-discuss] Mac Xcode project with Universal Binaries

metaldrummer610 metaldrummer610 at gmail.com
Fri Aug 7 09:06:00 PDT 2009


Hi Everyone,
I'm currently working on a school project and have decided to use enet  
for the networking. I ran into some trouble while building on my mac  
using xcode (OS X 10.5.8 and Xcode 3.1). The problem I ran into was  
when I tried to build a universal binary. The only architecture  
libenet.a supported was x86_64, which is the architecture of my  
machine. I'm assuming that there is probably a way to tell gcc to  
compile for different architectures, but I didn't really want to look  
into it.

Instead, I just created an xcode project that builds the enet library  
as a universal binary. Since it's now an xcode project, the extension  
is now .dylib instead of .a. When I tried linking this against my  
project, everything worked just fine. I did have to modify a few  
files, namely the header files and unix.c (below are the changes that  
I made).

Changes:

Modified unix.c on line 33.

old:
#ifndef HAS_SOCKLEN_T
typedef int socklen_t;
#endif

new:
#ifndef _SOCKLEN_T
typedef int socklen_t;
#endif

I changed this because it was conflicting with socket.h. Xcode was  
complaining about how socklen_t was being redefined. I looked in the  
configure file and found where HAS_SOCKLEN_T is being defined. I'm  
sure there is a better way to do that change, but for simplicity's  
sake and not knowing how to change it, I did that.

All the header files that have the line: #include "enet/*.h" were  
changed to #include "*.h". I'm not sure how the header includes worked  
with the makefile, but when i tried to build with xcode, it didn't  
like that all the header files wanted to include each other using the  
syntax above. The .c files are just fine and projects using this  
configuration don't have to change anything.

I'm sure that there are better ways to do this than the way I did it.  
If anyone has any thoughts, questions or comments on this, please let  
me know. I would like to make this a good, working project for enet.  
If it comes down to just modifying the makefile instead of using the  
xcode project, then that's cool too.

I won't attach the zip of the project to the email because I'm not  
sure if the mailing list will like that. I've never shared files  
online, so how would you guys suggest I get it to you?

Thanks,
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20090807/891523e4/attachment.htm>


More information about the ENet-discuss mailing list