Re: [Fink-devel] Bus error on Mac OSX, again (long)
On Saturday, August 2, 2003, at 06:36 AM, Martin Costabel wrote: Peter O'Gorman wrote: I'd guess that there is a static constructor somewhere in one of the other objects which gets called before main() and does something odd You had the right idea: As it turns out, the crash does not happen in the main program at all, as I thought before, but inside a static constructor long before main() is run. The precise line in the scribus code is scribus/scfonts_encoding.cpp:23:if (tf.open(IO_ReadOnly)) It seems that Qt's QFile::open method works differently whether it is run in main() or from a static constructor. Why this would be so, and who is to blame, Qt or Darwin, is way beyond my non-existing C++ knowledge. I guess dyld hasn't bound the c++ mangled symbol open from Qt at this point, so it crashes. I don't recall if you posted scribus's link line, is the -bind_at_load flag passed to ld? Peter --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] Bus error on Mac OSX, again (long)
Peter O'Gorman wrote: I guess dyld hasn't bound the c++ mangled symbol open from Qt at this point, so it crashes. Hmm, it doesn't always crash (depending on LANG), and when it crashes, it does so after having descended rather far down into the bowels of the definition of QFile::open. I don't recall if you posted scribus's link line, is the -bind_at_load flag passed to ld? No it doesn't, but adding it doesn't change anything. -- Martin --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
[Fink-devel] Bus error on Mac OSX, again (long)
Hi, this is a belated update on the thread Bus error starting scribus from 3 weeks ago. Being the maintainer of Fink's scribus package, I was unfortunately absent for 3 weeks, so I wasn't aware of this thread on the Scribus list. The bus error is still there, although I found a workaround, see point 1 below. I have now narrowed this problem down to something where I am at my wit's end, and I am hoping for some idea from the Scribus list. Here is what I found: 1. The bus error at the startup of Scribus 1.0 on MacOSX happens when the environment variable LANG is set. When LANG is unset, scribus starts up normally. This gives a workaround: Unset LANG and start scribus with the option --lang to get localized versions. Not really satisfactory, of course. 2. The bus error comes from the QTextCodec::locale() method used in scribus/main.cpp. 3. The problem is not a bug in qt alone. It only appears in the scribus context. When the above method is used alone, it works as it should, i.e. when LANG is set, it gives its value. 4. As a proof for 3, I replaced the scribus/main.cpp by the following minimal one-line program: // /* Minimal main.cpp to illustrate the bus error */ #include qapplication.h #include qfont.h #include qstring.h #include qtranslator.h #include qfileinfo.h #include qdir.h #include qtextcodec.h #include splash.h #include scribus.h #include config.h #include iostream using namespace std; int main(int argc, char *argv[]) { cout \n\n QTextCodec::locale() \n\n\n; return 0; } // Now one observes the following strange behavior: 5. When this main.cpp is compiled in the scribus environment, i.e. scribus with the new main.cpp is built using make with the standard Makefile, the result is a scribus binary that exhibits the bus error just as the true scribus program, i.e. bus error if and only if the LANG environment variable is set. 6. When main.cpp is compiled alone, i.e the final linking command of scribus is replaced by a variant of the exact same command, namely /bin/sh ../libtool --mode=link --tag=CXX g++ -O2 -Ddlsym=dlsym_auto_underscore -I/sw/include -fno-exceptions -fno-check-new -L/sw/lib -o scribus -L/usr/X11R6/lib -L/sw/lib fontcombo.o scpreview.o [long list of *.o files omitted] scribus.o main.o -L/sw/lib -lfreetype -lcups -llcms -ldl -ltiff -lm -lqt-mt -lpng -lz -lm -lXext -lX11 -lSM -lICE -lpthread -lXext -lX11 but with all other *.o files except main.o removed, then there is no bus error. The scribus program then does what it is supposed to do, i.e. it prints C if LANG is unset, and en_GB if LANG is set to en_GB, etc. I cannot understand how linking with a bunch of object files that have nothing to do with the main program can cause a crash of this main program. I would be grateful for any idea about what kind of mechanism could cause such a behavior. Since this may, after all, be a problem with the Mac OSX compiler, linker, or dynamic library system, or even a problem specific to Fink's version of qt-3, I am crossposting this to the fink-devel mailing list. Maybe someone with experience with Mac OSX and qt, kde (or even scribus, rangerrick?) has an idea? -- Martin --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] Bus error on Mac OSX, again (long)
Am Donnerstag, 31.07.03 um 12:47 Uhr schrieb Martin Costabel: [...] I cannot understand how linking with a bunch of object files that have nothing to do with the main program can cause a crash of this main program. I would be grateful for any idea about what kind of mechanism could cause such a behavior. Oh that's very simple: if one of the .o files provides a symbol which overrides a symbol in one of the libs you link against ... e.g. in qt, or even in one of the OS system libs. In that case, you can get the oddest and worst behavior. Does it print any warnings during linking? Cheers, Max --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] Bus error on Mac OSX, again (long)
Martin, Ben Reed (rangerrick) is on vacation this week, so you won't be able to tap into his experience with qt right at the moment. -- Dave --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] Bus error on Mac OSX, again (long)
Max Horn wrote: Oh that's very simple: if one of the .o files provides a symbol which overrides a symbol in one of the libs you link against ... e.g. in qt, Yes, I have been looking for something like this, but nothing so far jumped out at me. I guess for finding such things systematically one would have to run kdevelop, the IDE scribus seems to have been written in. Too heavy for me :-) or even in one of the OS system libs. In that case, you can get the oddest and worst behavior. Does it print any warnings during linking? No. The funny thing is, there is no warning at all when all the object files are linked in (the bad case), but there are tons of symbol foo from /sw/lib/libfreetype.dylib, not from earlier library etc warnings when the main.o is linked alone (the good case). Nothing concerning libqt-mt, though. -- Martin --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
Re: [Fink-devel] Bus error on Mac OSX, again (long)
David R. Morrison wrote: Martin, Ben Reed (rangerrick) is on vacation this week, so you won't be able to tap into his experience with qt right at the moment. Thanks Dave, no hurry here. This thing has been lying around already for a long time. It could have come up much earlier, actually, because it affects older versions of scribus, too, but I guess not many people used to be interested in scribus until recently. And it hits only people who have LANG set. This reminds me of something: There must have been some other programs not working when LANG was set, because I see in my shell startup script the lines if ( $?LANG ) then unsetenv LANG endif I cannot remember any more why I put this there, but there must have been some reason. Someone with a better memory? -- Martin --- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa0013ave/direct;at.aspnet_072303_01/01 ___ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel