fstream bug on 10.2.8

Dingo
Unregistered
 
Post: #1
I've been having a hard time building my games lately. After a lot of fiddling I've isolated a strange problem which I can reproduce from an empty project.

I create a new carbon project and add this line to the main function (along with appropriate fstream include):

ofstream* fout = new ofstream() ;

It compiles and links fine but then I get an "exited due to signal 10 (SIGBUS)" error.

This error ONLY happens when I'm doing cross develop to 10.2.8 and when set for "Deployment". Which is a pain because these are the exact settings I need to release my games. It does compile fine under 10.3, or if I am working in "Development".

I'm using 10.3.9 with the latest version of xcode and tools available for this system.

I searched around and couldn't find any info about this. I am stumped, anyone have any ideas? Any help would be appreciated. Smile
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
paste the stacktrace.
Quote this message in a reply
Dingo
Unregistered
 
Post: #3
#0 0x00012b30 in std::locale::operator=(std::locale const&)
#1 0x0000ea3c in std::ios_base::_M_init()
#2 0x0000f4a8 in std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)
#3 0x0000851c in main
#4 0x000081dc in _start at crt.c:267
#5 0x0000805c in start
Quote this message in a reply
Dingo
Unregistered
 
Post: #4
No one has any idea? I really want my apps to be available for 10.2 but it is pretty hard when I can't read/write files.

Perhaps I'll try posting at iDevApps seeing as how this isn't game specific.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
You are building with GCC 3 right? C++ apps built with GCC 4 won't work on OSes prior to 10.3.9.
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #6
Just moving a post from dingo (from iDevApps) to here:

I posted this over at idevgames but didn't get much response. It's not game specific, so I thought someone here might have an idea.

I've been having a hard time building my games lately (after switching to a different system). After a lot of fiddling I've isolated a strange problem which I can reproduce from an empty project.

I create a new carbon project and add this line to the main function (along with appropriate fstream header at top of file):

ofstream* fout = new ofstream() ;

It compiles and links but when I run it I get an "exited due to signal 10 (SIGBUS)" error.

This error ONLY happens when I'm doing cross develop to 10.2.8 and when set for "Deployment". Which is a pain because these are the exact settings I need to release my games. It does compile fine under 10.3, or if I am working in "Development".

I'm using 10.3.9 with the latest version of xcode and tools available for this system.

I searched around and couldn't find any info about this. The only idea I have now is to upgrade to 10.4 but it's not actually my computer so I'm not sure if that's possible. I am stumped, anyone have any ideas? Is there any known bugs for fstream (Although I think I would have found that searching google). Any help would be appreciated. Smile

Stack Trace:
Code:
#0 0x00012b30 in std::locale::operator=(std::locale const&)
#1 0x0000ea3c in std::ios_base::_M_init()
#2 0x0000f4a8 in std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)
#3 0x0000851c in main
#4 0x000081dc in _start at crt.c:267
#5 0x0000805c in start

James Sayer
Dingo Games
http://www.dingogames.com/

"When you dream, there are no rules..."
Quote this message in a reply
Dingo
Unregistered
 
Post: #7
OneSadCookie Wrote:You are building with GCC 3 right? C++ apps built with GCC 4 won't work on OSes prior to 10.3.9.

Yes, GCC 3.3. I tried 3.1 and the same problem occurs. However, with GCC 2.95.2 the problem goes away. My little test app successfully runs with 2.95.2

Unfortunately I don't think I can use GCC 2.95.2 for my actual games because then I can't link against the game dev library that I'm using (PTK). I get a bunch of undefined PTK symbols in the linker when I do. I don't know why.. perhaps it is fixible. Or can libraries built with GCC 3 not link to programs build with GCC 2?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #8
GCC 2.95's C++ is radically incompatible with GCC 3.x's; and GCC 3.x's is subtly incompatible with GCC 4.x's; from now on it *should* remain compatible...

It should be perfectly possible to build a C++ app with GCC 3.x that works on 10.2.8, though. libstdc++ is statically linked with GCC 3.3.

You might want to run nm /path/to/your/executable | grep U | c++filt to see what functions you're dynamically linked to -- maybe locale is an exception somehow.
Quote this message in a reply
Dingo
Unregistered
 
Post: #9
Thanks for the help.

I couldn't get the "nm" command to work.. I checked out some more examples of it online but I kept getting errors (even on different apps)...

I ended up switching from fstream to older stdio.h stuff - FILE fopen() etc. This stuff works fine. I still don't know what is wrong with fstream/deployment/10.2.8/etc.

Now I'm trying to figure out why the heck my .webloc files are getting corrupted when compressing them. bah.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
Probably because all their data is in the resource fork. You'll need to use a resource-fork savvy compression scheme. DMG is best.
Quote this message in a reply
Post Reply