Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Cross-Platform Development => Topic started by: blowfish on March 11, 2008, 10:58:56 pm

Title: Unable to compile in Xcode - FIXED
Post by: blowfish on March 11, 2008, 10:58:56 pm
Well, I recently got the source code from CVS, and tried to compile.  I got a few errors about missing files which I fixed, but now I get 636 warnings and 46 errors when I compile, none of which point to any specific section of code, and none of which I know the source of.  I think it is safe to assume that these errors are all the result of a few basic problems, but does anyone know what these problems are?

Just for reference, some of the warnings and errors:
Code: [Select]
ld: warning gr_set_clip(int, int, int, int, bool)has different visibility (2) in /Users/joeydwong/fs2_open/projects/Xcode/build/Debug/libcode.a(missionweaponchoice.o) and (1) in /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open.build/Debug/FS2_Open.build/Objects-normal/ppc/freespace.o

ld: warning gr_set_bitmap(int, int, int, float)has different visibility (2) in /Users/joeydwong/fs2_open/projects/Xcode/build/Debug/libcode.a(missionweaponchoice.o) and (1) in /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open.build/Debug/FS2_Open.build/Objects-normal/ppc/freespace.o

...

  "fs2netd_get_valid_missions()", referenced from:
      multi_update_valid_missions()     in libcode.a(multiutil.o)

  "fs2netd_update_ban_list()", referenced from:
      multi_create_game_do()     in libcode.a(multiui.o)
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 23, 2008, 08:03:57 pm
I just retried from SVN and I have to ask - When was the last time the XCode project file was updated?  I get a lot of errors regarding files that don't exist and aren't referenced anywhere
Title: Re: Unable to compile in Xcode.
Post by: taylor on March 23, 2008, 10:03:48 pm
It has been quite a while since it was updated actually.  I've got a newer/working project set up, but it's for my Xt tree, which is different from what's in SVN, so it wouldn't work if I committed.

But the main problem with the newer project setup is that I ended up having to modify a couple of buggy Apple system headers to make it all compile correctly (as it compiles 10.3+/PCC and 10.4+/x86 now).  That's the main reason that I haven't committed an updated project file, because I have yet to be able to figure out how to get it building properly without fixing Apple's broken headers first (from the 10.3 SDK specifically).
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 23, 2008, 10:19:03 pm
All right then ... I guess I'll just have to wait until someone does update it for me to be able to screw around with the code.  There are compile errors other than the ones I mentioned, and I'm not familiar enough with the code to know how to fix them.
Title: Re: Unable to compile in Xcode.
Post by: karajorma on March 30, 2008, 01:23:58 pm
It has been quite a while since it was updated actually.  I've got a newer/working project set up, but it's for my Xt tree, which is different from what's in SVN, so it wouldn't work if I committed.

The current one doesn't work. If the errors would be easier to fix, commit it anyway. :lol:
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 30, 2008, 01:38:39 pm
The following files appear in the project but do not actually exist and are not referenced anywhere (the last time I checked).  Can they be removed from the project?

client.cpp
client.h
fs2ox.cpp
fs2ox.h
irc.cpp
irc.h
prtocol.h
storybook.cpp
storybook.h
TCP_Client.cpp
TCP_Socket.cpp
TCP_Socket.h
udpsocket.cpp
udpsocket.h
Title: Re: Unable to compile in Xcode.
Post by: Backslash on March 30, 2008, 02:20:37 pm
Probably.  Though according to my (admittedly, MSVC) project, a few of those exist under fs2netd -- protocol.h, tcp_client.cpp, tcp_client.h, tcp_socket.cpp, tcp_socket.h .  This section/folder used to be called fs2open_pxo.

You'll probably also need to add:
   lua/linit.c
   lua/loslib.c
   lua/lua.c
   lua/luac.c
   lua/luaconf.h
   lua/print.c
   code/object/objectshield.cpp
   code/object/objectshield.h
   code/object/waypoint.cpp
   code/object/waypoint.h
   code/missionui/fictionviewer.cpp
   code/missionui/fictionviewer.h
   code/io/trackir.cpp
   code/io/trackir.h
depending on what's in there already, and maybe a few more things depending on the age of the project.

Good luck.  I hope you can get it working -- it's not a little frustrating to want to help and yet be stuck with such an issue.  I was like that the year before I joined the SCP ;).
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 30, 2008, 02:38:30 pm
Thanks for the help.  It seems though, that the list of errors I get is endless (now its complaining about modelread.cpp).  I could post all of the errors I can't fix here, but do you really want me to do that?
Title: Re: Unable to compile in Xcode.
Post by: Backslash on March 30, 2008, 03:38:10 pm
Maybe...

I find errors like these end up showing ridiculous numbers of errors, for just one or two little problems like a file missing.  Don't bother pasting the whole thing yet, but do the first few lines -- we want to find something specific about WHY it has problems with modelread.cpp and eliminate such things one by one.  I'm guessing modelread is referring to some other file not in the project yet, or using some function from said other file.  Ignore warnings.

Hmm...model\modelanim.h is not in the project.pbxproj... try adding that.  It's probably more than that ;)
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 30, 2008, 03:45:01 pm
OK.  Here are the errors I get:

Code: [Select]
error: 'MC_pm' was not declared in this scope [line 5408]
error: 'offset' was not declared in this scope [line 5408]
error: 'mc_check_sldc' was not declared in this scope [line 5438]

Looks like its stuff having to do with shield collision tree.  I've done searches and it doesn't look like is has to do with a missing header or something.

Title: Re: Unable to compile in Xcode.
Post by: Backslash on March 30, 2008, 04:00:04 pm
Ack.  That looks like more of a code bug, but one I don't run into (or know anything about) because I'm not on anything BIG_ENDIAN.  Hopefully taylor or Kazan can weigh in here.
Title: Re: Unable to compile in Xcode.
Post by: karajorma on March 30, 2008, 04:43:07 pm
You could try reverting revision 4444 (http://svn.icculus.org/fs2open?view=rev&revision=4444) for now and see if that will compile.
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 30, 2008, 05:01:21 pm
Still won't compile.  Looking at the two versions, I don't really see much difference in that particular section of modelread.cpp.  Actually, looking at the revision log, modelread.cpp is the same in both versions.

MC_pm isn't declared anywhere except in modelcollide.cpp.
Title: Re: Unable to compile in Xcode.
Post by: Backslash on March 30, 2008, 05:31:58 pm
Yeah it's not that revision, trying to find it.

Of course, afaik that stuff isn't used anyway yet... or rather, no models have been created that have it.  It's crazy and silly, but try commenting out the lines that error.  Only a temporary fix, but if it works...
Title: Re: Unable to compile in Xcode.
Post by: karajorma on March 30, 2008, 06:08:21 pm
http://svn.icculus.org/fs2open/branches/fs2_open_3_6_9/fs2_open/code/model/modelread.cpp?r1=4444&r2=4443&pathrev=4444

It's that revision that added the changes which seem to be causing your problems. It added the swap_sldc_data() function.

Remove
Code: [Select]
swap_sldc_data(pm->shield_collision_tree);
And add revert the changes here (http://svn.icculus.org/fs2open/branches/fs2_open_3_6_9/fs2_open/code/model/modelcollide.cpp?r1=4444&r2=4443&pathrev=4444)


You can put them back once the code works but for now it probably will cure your problem.
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 30, 2008, 06:32:15 pm
OK after removing swap_sldc_data, it seems to do fine with modelread.cpp, but then I get these two errors:

Code: [Select]
ld: duplicate symbol _main in /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/ppc/lua.o and /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/ppc/SDLMain.o

ld: duplicate symbol _main in /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/i386/lua.o and /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/i386/SDLMain.o

AND

Code: [Select]
ld: duplicate symbol _main in /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/ppc/luac.o and /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/ppc/SDLMain.o

ld: duplicate symbol _main in /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/i386/luac.o and /Users/joeydwong/fs2_open/projects/Xcode/build/FS2_Open_test.build/Debug/FS2_Open.build/Objects-normal/i386/SDLMain.o

If I remove lua.c and luac.c (or just comment out the main() functions in those files), then I get the same type of unidentifiable errors I experienced in my first post.

Title: Re: Unable to compile in Xcode.
Post by: taylor on March 30, 2008, 08:39:03 pm
I just updated all of the OS X stuff, so it should be up to date and working now.  Just grab an update and you should be good to go.
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 30, 2008, 09:04:19 pm
THANK YOU SO MUCH!!! :nod: :yes:

But I must ask, how did you fix the errors I encountered?
Title: Re: Unable to compile in Xcode.
Post by: taylor on March 30, 2008, 09:42:13 pm
Those modelread.cpp issues appeared to be a copy&paste issue, so I took out the Mc_pm stuff and replaced it with the passed buffer ptr, took out the offset var that wasn't needed, and took out the mc_check_sldc() calls since those aren't needed for serialization.  For the main() stuff I didn't do anything special.  I didn't add in luac.c, but that's about it.  Other than that I just replaced the frameworks with the newer setup I have for the Xt builds, updated the version numbers everywhere, added all new files and removed all old ones, and then did the builds as normal.

I'm pretty used to constantly having to fix the Xcode project setup though, so I'm sure that I can make it look easier than it actually is. :)
Title: Re: Unable to compile in Xcode.
Post by: blowfish on March 30, 2008, 09:47:45 pm
You SCP guys amaze me.
Title: Re: Unable to compile in Xcode - FIXED
Post by: Echelon9 on March 31, 2008, 02:16:34 am
THANK YOU SO MUCH!!

I've been able to successfully build FS2_Open for the first time with the latest SVN commits. In return, a number of patches I'd done to remove redundant code, and offer better performance paths will be released once I confirm they all work fine against the latest SVN - so far I had to work on them in my head and approximate the effect on the compiled code. :/

This removes the impediment on us with Mac skills from readily helping on fs2_open and mods like BtRL.

I had a similar thread on the Xcode 3.0 project issues, which can be adjusted to "- FIXED" as well, http://www.hard-light.net/forums/index.php/topic,51340.0.html