How is OS X development proceeding?

The place to discuss creating, porting and modifying Celestia's source code.
HankR

Post #121by HankR » 27.07.2003, 03:36

I believe that the problem with the declarations not being at the beginning of a block is due to the fact that this is allowed in C++ (and Java) but not in C. Apparently the previous developer tools release let me get away with it.

In 'CelestiaSelection.mm', it should work if you add an explicit cast:

return [[[CelestiaGalaxy alloc] initWithGalaxy:((Galaxy*)[self selection].deepsky())] autorelease];

- Hank

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

Further code progress: everything compiles, now link problem

Post #122by scienceman » 27.07.2003, 04:49

OK, this went fine.

Futher similar order-of-declaration problems occurred in SetTimeWindowController.m . Fixed these by moving all declarations of the code block related to dateString, etc. to the beginning of that block. and moving the sim= statement to just after these declarations. (Let me know if you need the code block, it should be obvious.)

Now everything compiles start to finish just fine, and at the link stage I have the following missing symbols to report:

    StandaloneExecutable.LinkUsingFileList /Users/.../Development/celcvs/celestia/macosx/build/Celestia.app/Contents/MacOS/Celestia
    /usr/bin/g++2 -o /Users/.../Development/celcvs/celestia/macosx/build/Celestia.app/Contents/MacOS/Celestia "-L/Users/.../Development/celcvs/celestia/macosx/build" "-L/usr/lib/gcc/darwin/3.1" "-L./Frameworks" "-F/Users/.../Development/celcvs/celestia/macosx/build" -filelist /Users/.../Development/celcvs/celestia/macosx/build/celestia.build/celestia.build/Objects-normal/LinkFileList "-arch" "ppc" "-L/sw/lib" "-Wl,-no_arch_warnings" "-framework" "Cocoa" "-framework" "OpenGL" "-lstdc++" "-lpng"
    /usr/bin/ld: Undefined symbols:
    _copy__t18string_char_traits1ZcPcPCcUl
    __._8ifstream
    ___8ifstreamiPCcii
    ___ls__7ostreamPCc
    ___ls__7ostreamc
    ___ls__7ostreami
    _assign__t18string_char_traits1ZcRcRCc
    _bad__C3ios
    _close__11fstreambase
    _cout
    _eos__t18string_char_traits1Zc
    _get__7istreamRc
    _good__C3ios
    _length__t18string_char_traits1ZcPCc
    _move__t18string_char_traits1ZcPcPCcUl
    _read__7istreamPci
    _set__t18string_char_traits1ZcPcRCcUl
    _eq__t18string_char_traits1ZcRCcn1
    ___nt__C3ios
    _gcount__7istream
    __._8ofstream
    ___8ofstreamiPCcii
    ___ls__7ostreamUi
    ___ls__7ostreamd
    ___ls__7ostreamf
    ___ls__H1Zi_R7ostreamRCt6smanip1ZX01_RB0
    _abs__Fd
    _abs__Ff
    _cerr
    _compare__t18string_char_traits1ZcPCcn1Ul
    _setf__3iosUl
    _setprecision__Fi
    _write__7ostreamPCci
    _setfill__Fi
    _setw__Fi
    __._10istrstream
    ___10istrstreamiPCci
    _eof__C3ios
    __._3ios
    __._9streambuf
    ___3iosP9streambufP7ostream
    ___7ostreamiP9streambufPB0
    ___9streambufi
    ___tf7ostream
    ___tf9streambuf
    ___ti7ostream
    ___ti9streambuf
    ___vt_7ostream.3ios
    _doallocate__9streambuf
    _pbackfail__9streambufi
    _seekoff__9streambufxQ23ios8seek_diri
    _seekpos__9streambufxi
    _setbuf__9streambufPci
    _sync__9streambuf
    _sys_close__9streambuf
    _sys_read__9streambufPci
    _sys_seek__9streambufxQ23ios8seek_dir
    _sys_stat__9streambufPv
    _sys_write__9streambufPCci
    _uflow__9streambuf
    _underflow__9streambuf
    _xsgetn__9streambufPci
    _xsputn__9streambufPCci
    ___rs__7istreamRd
    _flush__7ostream
    ___rs__7istreamRUi
    _ipfx1__7istream
    _isfx__7istream
    _rdbuf__C3ios
    _sbumpc__9streambuf
    _setstate__3iosi
    ___rs__7istreamRUc
    _seekg__7istreamxQ23ios8seek_dir
    _get__7istream
    ___ls__7ostreaml
    ___opPv__C3ios
    ___rs__7istreamRf
    _ipfx0__7istream
    _is_del__t18string_char_traits1Zcc
    _sungetc__9streambuf
    _width__3iosi
    ...failed StandaloneExecutable.LinkUsingFileList /Users/.../Development/celcvs/celestia/macosx/build/Celestia.app/Contents/MacOS/Celestia ...


A messy list, but they seem to be related only to stream buffering and character traits. Guesses how to proceed?

hank
Developer
Posts: 645
Joined: 03.02.2002
With us: 22 years 9 months
Location: Seattle, WA USA

HankR

Post #123by hank » 27.07.2003, 07:17

In the Ceelstia project window in the 'Groups & Files' list under 'Frameworks/Linked Frameworks' there's a 'libstdc++.a' library which in the info window shows an absolute path of '/usr/lib/gcc/darwin/2.95.2/libstdc++.a'. Maybe you should change it to '/usr/lib/gcc/darwin/3.1/libstdc++.a' ?

- Hank

Guest

Post #124by Guest » 27.07.2003, 12:34

Better, remove it completely and add -lstdc++ to the linker flags in the Target settings.

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

Still link problems

Post #125by scienceman » 28.07.2003, 22:01

Hi,

Did so, still same problem.

HankR

Post #126by HankR » 29.07.2003, 17:06

These undefined symbols seem to be in the '/usr/lib/gcc/darwin/2.95.2/libstdc++.a' library. I'm not sure where the references are coming from. Possibly from the png library? Is it corrrect that you not have 2.95.2 installed?

- Hank

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

Contents of /usr/lib/gcc/darwin area

Post #127by scienceman » 29.07.2003, 23:10

Hi,

This area contains:
    % ls -al /usr/lib/gcc/darwin/*
    total 0
    drwxr-xr-x 5 root wheel 170 Jan 1 2003 .
    drwxr-xr-x 3 root wheel 102 Jan 1 2003 ..
    drwxr-xr-x 8 root wheel 272 Jan 13 2003 2.95.2
    drwxr-xr-x 12 root wheel 408 Jan 13 2003 3.1
    lrwxr-xr-x 1 root wheel 3 Jan 1 2003 default -> 3.1

    /usr/lib/gcc/darwin/2.95.2:
    total 1288
    drwxr-xr-x 8 root wheel 272 Jan 13 2003 .
    drwxr-xr-x 5 root wheel 170 Jan 1 2003 ..
    -r--r--r-- 1 root wheel 102488 Sep 27 2002 libcc.a
    -r--r--r-- 1 root wheel 132068 Sep 27 2002 libcc_dynamic.a
    -r--r--r-- 1 root wheel 41972 Sep 27 2002 libcc_kext.a
    -r--r--r-- 1 root wheel 68832 Sep 27 2002 libcc_noc++.a
    -r--r--r-- 1 root wheel 475812 Sep 27 2002 libg2c.a
    -r--r--r-- 1 root wheel 480932 Sep 27 2002 libstdc++.a

    /usr/lib/gcc/darwin/3.1:
    total 1800
    drwxr-xr-x 12 root wheel 408 Jan 13 2003 .
    drwxr-xr-x 5 root wheel 170 Jan 1 2003 ..
    -r--r--r-- 1 root wheel 2516 Jan 11 2003 crtbegin.o
    -r--r--r-- 1 root wheel 66112 Jan 11 2003 libcc_kext.a
    -r--r--r-- 1 root wheel 130008 Jan 11 2003 libcc_noc++.a
    -rw-r--r-- 1 root wheel 1688 Jan 11 2003 libfrtbegin.a
    -rw-r--r-- 1 root wheel 478052 Jan 11 2003 libg2c.a
    -r--r--r-- 1 root wheel 130008 Jan 11 2003 libgcc.a
    -r--r--r-- 1 root wheel 98996 Jan 11 2003 libgcc_static.a
    -r--r--r-- 1 root wheel 778776 Jan 11 2003 libstdc++.a
    -r--r--r-- 1 root wheel 137744 Jan 11 2003 libsupc++.a
    drwxr-xr-x 4 root wheel 136 Jan 13 2003 private


I conclude that there might be order-of-use-vs-definition problems, since it did the same thing with the original project definitions (using 2.95.2) and with the default. Hmm...

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

How to determine location of missing symbols?

Post #128by scienceman » 31.07.2003, 07:58

Hi,

How are you determining what library should provide the missing symbols? If I try
    % find /usr/lib -type f | xargs grep 'streambuf'
I get
    Binary file /usr/lib/gcc/darwin/2.95.2/libstdc++.a matches
    Binary file /usr/lib/gcc/darwin/3.1/libstdc++.a matches
    Binary file /usr/lib/gcc/darwin/3.1/private/A/libstdc++.dylib matches
    Binary file /usr/lib/sasl2/dhx.so matches

This would tend to confirm your guess that -lstdc++ should do it in the linker arguments... but clearly that is not enough.

What else can be used to locate missing symbols?

HankR

Post #129by HankR » 31.07.2003, 18:15

I used:

% nm -gj libstdc++.a | grep stream

- Hank

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

It builds!!!

Post #130by scienceman » 01.08.2003, 09:24

To be sure of the link order, I eliminated ALL explicit search paths under "Settings .. Simple View ... Search Paths" for all libraries (in the rightmost panel under ProjectBuilder), and added the libpng.dylib and libstdc++ under the left panel under "Linked Frameworks" in addition to the Cocoa and OpenGL ones that were already there. (moved all of these to "Linked Frameworks to be sure, and made sure these and only these were checked).

Under "Build Phases ... Frameworks and Libraries" in the right panel of ProjectBuilder, I made sure these were listed in the following order:

    Frameworks/libpng.dylib
    /usr/lib/gcc/darwin/3.1/libstdc++.a
    Cocoa.framework
    OpenGL.framework


Under "Settings ... GCC Compiler Settings" I made sure the "GCC 3.1" option was selected. I checked the option box for using GCC 3 "PFE" pre-compiled headers.

There were no linker settings used.

I left the rest of the settings as in the original. The result is that it now builds completely from scratch and runs!!

Now I have to figure out how to merge these changes with anything new in cvs since I started, and/or get you and/or the other lurkers on this list to reproduce this success! Hooray for having a buildable copy of the cvs version of Celestia under the latest (Dec. 2002) Developer Tools!! We have to get this out quick -- before Panther comes.

Now on to the next project -- trying to get some of the add-ons to build. Thanks thanks thanks for your patience, Hank, and for the many suggestions along the way to this success.

(Note: before hitting on the above steps -- it was the elimination of the explicit search paths that caused the link step to work -- I replaced my own copy of libpng.dylib and the associated png.h and pngconf.h files with the ones from the latest libpng (1.2.5), pulling them from my copy via Fink. It might be nice to include the newer png elements as above in any cvs updates that are made, though this may make very little practical difference in the application as it runs.)

HankR

Post #131by HankR » 01.08.2003, 17:29

Glad to hear you've got a successful build!

Can you confirm whether the build works with the old png files?

- Hank

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

Testing with original cvs version of libpng, search path

Post #132by scienceman » 02.08.2003, 06:51

I verified that it does in fact build with the originally packaged version of libpng as distributed from cvs. In the process of studying this, while making sure that none of my usual environmental variables were affecting the build, I found that it had been picking up libpng in fact from my Fink copy, since the LDFLAGS variable had been set to /sw/lib by default by my Fink setup.

To make sure it was a clean build, I unset LDFLAGS and CFLAGS completely before opening the celestia.pbproj project, and rebuilt from scratch after cleaning all targets as usual during this testing. This showed that previously removing ALL search paths was overly aggressive; I had to add the local "Frameworks" area (under celcvs/celestia/macosx) to the search path for "Libraries" (note, confusingly enough NOT for the search path for "Frameworks" since what we are adding is really the location of the libpng.dylib library). This once again produced a clean compile-and-link from scratch where we are certain that it is using the original version of libpng. Of course, as I said, it would be nice to include the latest libpng if this is really to be distributed.

I would really like to see someone else, perhaps you, reproduce this and get a current version of the built app out into the community so that we can once again be caught up with the MacOS X version. (If you like, send me a private message and we can make an exchange of any needed cvs information.)

Thanks once again for your help.

HankR

Post #133by HankR » 02.08.2003, 17:53

So is it possible that the problem was caused by your Fink setup? In other words, if the Fink variables had not been set could you have built with the original project? Also, did we ever determine where those undefineds were being referenced from and why? Also, are you using the latest Developer Tools (i.e. including the December 2002 gcc Updater (which adds gcc 3.3 support to the December 2002 Mac OS X Developer tools)?

- Hank

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

Build conditions

Post #134by scienceman » 02.08.2003, 20:57

Hi,

No, the libpng essentially has nothing to do with it (either version will work).

For other reasons I am just using the straight Developer Tools 2002 version, and have not yet moved to the optional further update that includes support for gcc 3.3 (probably no harm in doing so for this project, but I have not done it yet).

The step that made the build work (after fixing the declaration order and cast problems) involved going though the ProjectBuilder setup item by item and making sure there were no references to the gcc 2.95 areas. I found that the only search path I really needed was the one to point to the version of libpng.dylib in Libraries that I described above.)

Hope this helps.

HankR

Post #135by HankR » 02.08.2003, 22:34

What do you get now from a cvs diff on celestia.pbproj?

- Hank

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

cvs diff on celestia.pbproj

Post #136by scienceman » 03.08.2003, 00:45

Lots, the most important of which are these:
    253c257,258
    < LIBRARY_SEARCH_PATHS = "/usr/lib/gcc/darwin/3.1 ./Frameworks";
    ---
    > LIBRARY_SEARCH_PATHS = Frameworks;
    > OPTIMIZATION_CFLAGS = "-O3";
    256a262
    > PRECOMPILE_PREFIX_HEADER = YES;
    259d264
    < USE_GCC3 = YES;
This one is trivial -- just thought it would be good to include some version info. (Better to put in the real #, though):
    284a290,291
    > <key>CFBundleName</key>
    > <string>Celestia </string>
    286a294,295
    > <key>CFBundleShortVersionString</key>
    > <string>cvs 1.3.x</string>
    290c299
    < <string>0.1</string>
    ---
    > <string>1.3.x</string>
And finally, have to resolve the gcc library versions: I have
    > 4CF626A604D9787600000103 = {
    > isa = PBXFileReference;
    > name = "libstdc++.a";
    > path = "/usr/lib/gcc/darwin/3.1/libstdc++.a";
    > refType = 0;
    > };
and you have:
    < F5040AFC02A46537014901DC = {
    < isa = PBXFileReference;
    < name = "libstdc++.a";
    < path = "/usr/lib/gcc/darwin/2.95.2/libstdc++.a";
    < refType = 0;
    < };

The rest I think are trivial.

abush
Posts: 4
Joined: 27.07.2003
With us: 21 years 3 months

From CVS to working build

Post #137by abush » 03.08.2003, 13:22

Hello,

I just wanted to share that I was able to reproduce the working build that was achieved in this thread. I too, like scienceman, am using the December 2002 developer tools and had the same problems getting the CVS source to compile and link. A summary of the steps I followed is:

Download the CVS Source:

Code: Select all

$ 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


Click the broom to "Clean Active Target"

Patch CelestiaOpenGLView.m:
- by adding opening and closing braces "{" and "}" around local and appCore declarations and the line that follows them. (approx. 5 places)

Patch FavoritesDrawerController.m:
- by adding opening and closing braces "{" and "}" around appCore declaration and 3 lines that follow it. (1 place)

Patch CelestiaSelection.mm:
- by adding an explicit cast on line 91:

Code: Select all

return [[[CelestiaGalaxy alloc] initWithGalaxy:((Galaxy*)[self selection].deepsky())] autorelease];

Patch SetTimeWindowController.m:
- by editing "- (IBAction)setTime:(id)sender"

Code: Select all

    // Moved the following three lines from beneath that "sim = [[Celest..." statement.
    NSString* fmtString = @"%m/%d/%Y %H:%M:%S";
    NSString* dateString = [dateField stringValue];
    NSString* timeString = [timeField stringValue];
    // Moved the following two lines from beneath the else block below
    NSString* inputString = [ [  dateString stringByAppendingString: @" " ] 
                             stringByAppendingString: timeString ]; 
    NSCalendarDate* cdate = [NSCalendarDate dateWithString: inputString calendarFormat: fmtString ];
    // Moved the following one line from above the "[sim setDate: jd];" line
    NSNumber* jd = [ Astro julianDate: cdate];


Fix Linking problems by:
1) Locating "libstdc++.a" under "Groups & Files" -> "Frameworks" -> "Link Frameworks," viewing the file info ("Project" -> "Show Info") and changing the path to "/usr/lib/gcc/darwin/3.1/libstdc++.a"

2) Under "Targets" -> "Settings" -> "Simple View" -> "Search Paths" I did the following:
Under "Headers" I deleted "../src"
Under "Libraries" I deleted "/usr/lib/gcc/darwin/3.1" and "./Frameworks"
Under "Libraries" I added "Frameworks"

3) Under "Targets" -> "Build Phases" -> "Frameworks & Libraries" made sure the following order was used:
Frameworks/libpng.dylib
/usr/lib/gcc/darwin/3.1/libstdc++.a
Cocoa.framework
OpenGL.framework

I hope this is helpful.

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

CVS updates: who will do?

Post #138by scienceman » 06.08.2003, 02:45

Excellent! It's nice to see this confirmed independently. I've gotten further feedback via private messages (the pm icon) that this is working for other people.

I don't have write access to cvs. Is someone going to make these updates and get a MacOS X version of 1.3.x (whatever we are up to) released?

Nice thread -- it's nice to see things converge so quickly.

HankR

Post #139by HankR » 06.08.2003, 04:11

The latest released version for MacOS X (as for Windows) is 1.3.0, which dates from last April. There have been a number of Windows prereleases of 1.3.1 since then (the latest is pre9), but so far no prereleases for MacOS X. I've been waiting for 1.3.1 to stabilize, but that darn Chris just keeps on adding new features! I'll try to see about getting a new MacOS X version out sometime soon.

- Hank

homerS

errors in compile

Post #140by homerS » 06.10.2003, 00:37

I received the following errors when I tried to build Celestia using OS 10.2.8 and Gcc 3.1 and the build quit.

/usr/bin/g++2 -c -F/Library/CVS/celcvs/celestia/macosx/build -I/Library/CVS/celcvs/celestia/macosx/build/include -I../src -I../src/celengine -arch ppc -fno-common -fpascal-strings -O0 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -pipe -g -precomp-trustfile /Library/CVS/celcvs/celestia/macosx/build/celestia.build/celestia.build/TrustedPrecomps.txt -Wp,-header-mapfile,/Library/CVS/celcvs/celestia/macosx/build/celestia.build/celestia.build/Celestia.hmap "-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" "-DDEBUG=1" ../src/celengine/texture.cpp -o /Library/CVS/celcvs/celestia/macosx/build/celestia.build/celestia.build/Objects-normal/ppc/texture.o
../src/celengine/texture.cpp: In method `ImageTexture::ImageTexture(Image &, Texture::AddressMode, Texture::MipMapMode)':
../src/celengine/texture.cpp:407: passing `unsigned int *' as argument 2 of `glGenTextures(long int, GLuint *)'
../src/celengine/texture.cpp: In method `TiledTexture::TiledTexture(Image &, int, int, Texture::MipMapMode)':
../src/celengine/texture.cpp:548: passing `unsigned int *' as argument 2 of `glGenTextures(long int, GLuint *)'
../src/celengine/texture.cpp: In method `CubeMap::CubeMap(Image **)':
../src/celengine/texture.cpp:738: passing `unsigned int *' as argument 2 of `glGenTextures(long int, GLuint *)'
../src/celengine/texture.cpp:407: passing `unsigned int *' as argument 2 of `glGenTextures(long int, GLuint *)'
../src/celengine/texture.cpp:548: passing `unsigned int *' as argument 2 of `glGenTextures(long int, GLuint *)'
../src/celengine/texture.cpp:738: passing `unsigned int *' as argument 2 of `glGenTextures(long int, GLuint *)'


Return to “Development”