Building Mac OS X version with XCode under Panther

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
scienceman
Posts: 30
Joined: 29.06.2003
With us: 21 years 4 months

Building Mac OS X version with XCode under Panther

Post #1by scienceman » 07.11.2003, 07:24

I have tried building the cvs version of Celestia under Panther (Mac OS X 10.3) using the latest present version of XCode (the replacement for ProjectBuilder), with the following results.

Although the compilation went by with only minor warnings, the linking step produced several undefined symbols:

ld: Undefined symbols:
FormattedNumber::FormattedNumber[in-charge](double, unsigned, unsigned)
Console::setWindowRow(int)
Console::setWindowHeight(int)
Console::end()
Console::begin()
Console::render(int)
Console::setFont(TextureFont*)
Console::setScale(int, int)
Console::Console[in-charge](int, int)
Console::~Console [in-charge]()
Console::getWindowRow() const
Console::getHeight() const
operator<<(std::basic_ostream<char, std::char_traits<char> >&, FormattedNumber const&)
Tokenizer::getLineNumber()
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::replace(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char const*, char const*)
Image::getPixels()
Image::Image[in-charge](int, int, int, int)
Image::~Image [in-charge]()
Image::getSize() const
LoadImageFromFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
LoadVirtualTexture(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
Image::getMipLevel(int)
Image::getPixelRow(int)
Image::isCompressed() const
Image::getComponents() const
Image::getMipLevelSize(int) const
Image::computeNormalMap(float, bool) const
Image::getMipLevelCount() const
Image::getWidth() const
Image::getFormat() const
Image::getHeight() const

Also, under the "Project symbols" category in the XCode left hand window, I notice that at the bottom of this list of symbols, there is one defined only by a twiddle ( ~ ) that took me to this location in the code when I double-clicked on it:

    ~ (Variable) render.cpp:5191

    Renderer::StarVertexBuffer::~StarVertexBuffer()


So ... no cigar for Panther building right away. What could be going on here?

Orac

Building Mac OS X version with XCode under Panther

Post #2by Orac » 09.11.2003, 03:54

This is what I did to get it to build:

First I had to tell xcode that libstdc++.a is in /usr/lib/gcc/darwin/3.3 and not in /usr/lib/gcc/darwin/2.95.2. BTW I'm new to mac so if anyone can tell me how to do this without manuallly editing the project files, I would be grateful. I tried from the libstdc++.a inspector but the /usr directory is hidden and I can't navigate to it. I also changed the library search path in the target inspector to match.

Next, there appear to be several source files not included in the project so I added the following:
celengine/console.cpp
celengine/console.h
celengine/image.cpp
celengine/image.h
celengine/virtualtex.cpp
celengine/virtualtex.h
celutil/formatnum.cpp
celutil/formatnum.h

Under "celestia/Resources/Celestia Data" tick all the entries so they get copied to the build and finally crank the optimisation up to level 3.

I just did a fresh build from scratch using source checked out from CVS on 2003-09-24 to double check and it seemed to work. Good luck.

Topic author
scienceman
Posts: 30
Joined: 29.06.2003
With us: 21 years 4 months

Correct; success building with these changes

Post #3by scienceman » 09.11.2003, 08:58

Hi,

OK, I followed pretty much these steps, and it builds fine. Should have checked the libstdc++ settings earlier, as this was left over from the previous build effort (see thread on this topic elsewhere in this forum). I was able to change the path for this just by selecting it under "Targets... celestia... Frameworks & Libraries" and clicking the inspector button, then selecting the path under "choose..." to point to the gcc 3.3 version. Despite this, also had to edit the project by hand to change a 3.1 to 3.3 under build target settings, then it built fine after making the other changes you indicated. (Later found you can probably get to this setting by just double-clicking on "celestia" under "Targets" and then selecting the "linker settings" options. Probably this explicit setting of the gcc version can be eliminated in favor of taking the default.

There were still plenty of warnings during the compilation phase, but I assume these are intrinsic to the Celestia source.

Thanks for the suggestions! You learn pretty fast for being new to the platform -- I am still learning my way around XCode, having just barely goten familiar with ProjectBuilder, on which it is based. Am looking forward to using the Distributed Build feature once I get the hang of the basics.

BusError
Posts: 29
Joined: 07.03.2002
With us: 22 years 8 months

Post #4by BusError » 13.11.2003, 13:30

all it really need is a -lstdc++ line at the end of the link, one should not use absolute paths to those libraries.

Guest

Post #5by Guest » 16.12.2003, 17:11

I am still having trouble trying to get the source to build. Even after changing the target of libstdc++.a to the gcc3.3 version I still get the std errors in the linking phase listed by scienceman. Everything else seems to be fine. I am not too familiar with Xcode and coding so could someone explain it in more detail? I am using Xcode 1.0 on OS 10.3.1 thanks in advance for any help.

HankR

Post #6by HankR » 16.12.2003, 18:27

I'm still using ProjectBuilder and Jaguar, and I won't be upgrading to XCode and Panther until after I finish the Celestia 1.3.1 release for MacOS X. I expect to do the new Mac release soon after Chris finalizes the 1.3.1 version of Celestia, which should be any day now. There are still a few Mac-only code changes for 1.3.1 that are not in CVS at SourceForge yet. I'll let you all know when the CVS tree is updated, and perhaps someone can verify that everything works okay under XCode and Panther.

BTW, if anyone is planning to do actual development work for the public Mac version of Celestia, please let me know so that we can coordinate our efforts.

- Hank

HarrieS

Post #7by HarrieS » 16.12.2003, 20:16

Guest, is the checkbox after your libstdc++ checked? If not, it will not end up in the build. And make sure that the path to it is /usr/lib/gcc/darwin/3.3/libstdc++.a

Apart from that you should make sure that your search paths are set correctly. For that you should go to the Groups&Files column and open the Targets by clicking on the little triangle. Then double-click on the celestia item (not the triangle in front of it!) This will open the target settings. Here select the Search Paths and make sure that you have them as follows:

Under Headers:
../src

Under Libraries:
/usr/lib/gcc/darwin/3.3
./Frameworks

Frameworks and Java Classes should be empty.

Also check the GCC compiler settings. There is a rather extensive list of "Other C Compiler Flags". Mine are as follows:

-DWORDS_BIGENDIAN=1 -DMACOSX=1 -DPNG_SUPPORT=1 -DSTDC_HEADERS=1 -DCONFIG_DATA_DIR="/usr/local/share/celestia" -DHAVE_LIBJPEG=1 -DHAVE_LIBPNG=1 -DPACKAGE="celestia" -DVERSION="1.2.4" -DMACOSX_PB=1

Finally, make sure to do a clean build.

(The version number should perhaps be changed by now to a somewhat higher number...)

Hope this helps,

Harrie

alphap1us

Post #8by alphap1us » 17.12.2003, 06:03

HankR and HarrieS Due to your timely assistance, I have now gotten Celestia to compile without a hitch (except for those warnings, which I do not understand and therefore ignore.) The culprit was the gcc3.1 linked in the libraries which I couldn't find until I clicked on the advanced view tab. Soon I will post easy step-by-step, start-to finish instructions to building from source so that other neophytes like myself can report bugs on the recent changes I see (I figured out how to read cvs recently as well) I hope this will help the mac development along. If there is anything else I can do, just let me know. Celestia is amazing and the forum lurkers are amazingly helpful. Must be the music of the spheres harmonizing their souls.

HankR

Post #9by HankR » 19.12.2003, 21:29

I've updated the SourceForge CVS tree with my latest changes for the initial release of the 1.3.1 version of Celestia for MacOS X. I would welcome feedback from anyone who is willing to build and test it on their system. If all goes well I will upload a user installable version to SourceForge in a couple of days.

- Hank

homerS

Post #10by homerS » 21.12.2003, 22:02

Downloaded the CVS on Saturday and tried to compile it. Got an error in fragmentprog.cpp at the below location:

#endif 0
everything = 0 <-------------------error
cout << "All NV fragment programs loaded successfully.\n";

return new FragmentProcessorNV();

Removed the line that got the error and Celestia compiled and ran. Received a lot of warnings. Using 10.3.2 with xcode 1.1 and gcc 3.3. The things I have tried in Celestia seems to work.

alphap1us
Posts: 212
Joined: 17.12.2003
With us: 20 years 10 months
Location: Buenos Aires

Post #11by alphap1us » 22.12.2003, 02:02

These are what I hope to be foolproof instruction for building Celestia from Source on Panther 10.3.2 with XCode 1.1 using source checked out from CVS on 12/21/03. All that is assumed is a basic knowledge of the finder.
First open terminal.app which lives in the Utilities Folder in your Applications Folder. When the terminal opens up type the following. After each line press return. I recommend cutting and pasting the longer line into the terminal so you don't mis-type them.

cd
mkdir celcvs
cd celcvs
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/celestia login
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/celestia checkout celestia
cd celestia/macosx
open celestia.pbproj

After you type the first cvs line it will ask for a password. Just hit return. After the second line the terminal will start to do it's own things. Go to your kitchen and drink the beverage of your choice. This will take a bit.
After you type the last line and hit return, Xcode will open and ask you some trivial questions. Hit Return for each of them. It will then start indexing the project files. When it is done, scroll down the list of files in the project until you come to fragmentprog.cpp, which you should double-click. Find the line a little more than halfway down that says the following:
cout << "All NV fragment programs loaded successfully.\n";
Highlight this entire line and delete it. Exit the window. Then click on the hammer icon that says build. Xcode will start to churn. You can watch the status of the build by clicking on the "Build warnings and errors" button. It should complete with only some build warnings. Then I believe you need to download the Celestia binary release for Mac OSX and place the "CelestiaResources" folder in Home/Library/Application Support. The celestia.app file is in the "build" folder in the same folder as the Xcode project you opened. You now have the very latest OSX release of Celestia.

alphap1us
Posts: 212
Joined: 17.12.2003
With us: 20 years 10 months
Location: Buenos Aires

Post #12by alphap1us » 22.12.2003, 02:19

I hope the above instructions will allow more people to be able to test the updates between binary releases. As for me, I have some question and comments. The reorganized display menu is much more intuitive and takes up much less space, very nice. The preferences are also different and much better I think. On the whole this looks a very nice update. I have some questions though.
First what are virtual textures and are they included with the release I just built? Are they planned for the Mac port?
Are cel scripts working in this release? When I click on the links in the User's Guide I get an error that the links are not understood. I think cel scripts are an excellent pedagogical adn troubleshooting tool and I hope we get them in the mac port soon.
The recent progress is very exciting. I am trying to learn how I can help Celestia progress further but for now I guess explaining the things I understand and asking for the features I want are the best I can do.
Merry Christmass everyone.
-Joe

alphap1us
Posts: 212
Joined: 17.12.2003
With us: 20 years 10 months
Location: Buenos Aires

Post #13by alphap1us » 22.12.2003, 02:26

One more bug I found:
In the prefs dialog, I can adjust the size of the locations to be displayed. Unfortunately, by the time I hit the first tick, nothing is visible. By micro-adjusting the slider I can get a range of things visible, but they are all gone by the first mark in the slider. Hopefully this is a very simple fix.

HankR

Post #14by HankR » 22.12.2003, 05:37

Joe,

Virtual textures are supported by the application, but none are included in the standard data set. You have to install them as addons. I highly recommend it.

Cel scripts are supported. Use the "Run Script..." item from the "File" menu to choose a script to run. Lua scripts are not yet supported in the Mac version, but hopefully will be in the next release.

You cannot just click on "cel:" URLs because the browser doesn't understand them. But you can drag and drop (or cut and paste) a URL from the browser window to the Celestia window and Celestia will load the URL.

I agree that the sensitivity of the locations slider needs to be adjusted. But note that whatever the slider setting, as you zoom in more locations will become visible.

Thanks for the feedback. Let me know if you have any other questions or find any other problems.

- Hank

HarrieS

Post #15by HarrieS » 22.12.2003, 09:43

I got the newest version to compile by leaving out the fragmentprog.cpp altogether! There was no complaint from the linker so I asume it is not used at all in the Mac version. For the rest I only changed the gcc compiler version and the stdclib to 3.3. This allowed it to build under XCode 1.1.

Only problem so far is that selection of planets via the main keyboard number keys doesn't work. Selection by name does work so you can move around.

I was a bit confused by the OK button in the initial dialog box, You can use it to close the box but of course the preloading still has to come to its conclusion and therefore the program seems to hang. (I'm preloading all of the solar system textures, which takes a bit of time.) Perhaps it would be better to remove the button and have it close automatically when the preloading is finished. Other than that, the dialog box is a nice touch.

Thanks, Hank (and Chris of course!) for this delivery of a new version just before Christmas,

Harrie

HarrieS

Post #16by HarrieS » 22.12.2003, 09:49

One more word about the CelsestiaResources. They are included in the CVS when you download per instructions given above, at the root level. There is no need to get them from a separate download from a previous binary. In fact I believe that some important changes where made with respect to add-ons, so it is better to use the new set.

Harrie

HankR

Post #17by HankR » 22.12.2003, 18:35

Harrie,

Thanks for the feedback.

The data loading alert panel does go away automatically when loading is finished. The OK button just hides it early. Granted, it's not particularly useful. I'm thinking about changing it to a QUIT button, as currently there's no way to abort startup during loading (except via a forced quit).

The digit keys on the main keyboard select the planets as usual on my desktop system running 10.2. Did the keys work correctly on your Powerbook with the previous Celestia version?

It's definitely a good idea to get the latest CelestiaResources from the CVS tree, as they do change from time to time.

- Hank

HarrieS

Post #18by HarrieS » 23.12.2003, 18:35

Hank, on my Ti Powerbook (without numeric keypad) the keypad flag always seems to be set. I added the following to the keyDown handler in CelestiaOpenGLView.m:

BOOL isNumPad = ([theEvent modifierFlags] && NSNumericPadKeyMask);
if ( isNumPad ) NSLog( @"isNumPadKey");

and this puts "isNumPadKey" in the log for every key. Very strange.

Do other users with Powerbooks experience the same problem? (Or other users with small keyboards?)

Harrie

HankR

Post #19by HankR » 23.12.2003, 19:52

I wonder if the keyboard problem is caused by or could be fixed by an installed keyboard layout?

See http://developer.apple.com/technotes/tn2002/tn2056.html

- Hank

HarrieS

Post #20by HarrieS » 23.12.2003, 20:43

Hank, I just checked with the "official" 1.3.0-a1 version, the most recent version I have here of which I'm sure that I did not compile it. That works as it is supposed to. Are there any major differences between 1.3.0 and 1.3.1 for the keyboard input? If not, we must consider XCode to be the suspect. Is anyone else having problems with XCode builds? Unfortunately I'm far away from an OSX 1.2.8 machine at the moment, so I can't check with the older Developer Tools.

One clue might be found in the warnings that I get with the compile of CelestiaOpenGLView:

CelestiaOpenGLView.m:154: warning: `CelestiaAppCore' does not respond to `keyDown:withModifiers:'
CelestiaOpenGLView.m:163: warning: `CelestiaAppCore' does not respond to `keyUp:withModifiers:'

and in the link phase:

ld: warning suggest use of -bind_at_load, as lazy binding may result in errors or different symbols being used

How do I tell the linker to "bind at load"? The wrong modifierFlags do indeed suggest a wrongly initialized variable of some sort.

I'll play with it a bit more during the Christmas days (if my wife will let me...)
For the rest I will be mostly incommunicado until the weekend. It is a family week, after all.

Harrie

P.S. I also tried to build with the libstdc++ for gcc 3.1, as it was in the original Project Builder project. Same results.

P.S. 2 I have not modified any keyboard layouts but I'll check your link.[/i]


Return to “Development”