From: Charles Wilkins To: djgpp-workers AT delorie DOT com, libstdc++@gcc.gnu.org Newsgroups: comp.os.msdos.djgpp Subject: i686-pc-msdosdjgpp-g++ problems (long) Date: Thu, 07 Nov 2002 18:00:37 -0500 Message-ID: X-Mailer: Forte Agent 1.92/32.570 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Here is some overview and some history. I really hope somebody can assist me here. I am attempting to build a linux host crosscompiler to the msdosdjgpp target. Problems with this build seem to mostly pertain to pertain to libstdc++ and djgpp. After setting up the msdosdjgpp cross compiler directories and after a successful linux host build of binutils-2.13 using the i686-pc-msdosdjgpp target I ran into the following errors when making gcc-3.2 ... In file included from /root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/include/bits/locale_facets.h:63, from /root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/include/bits/basic_ios.h:41, from /root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/include/ios:51, from /root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/include/istream:44, from /root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/include/fstream:45, from ../../../../gcc-3.2-src/libstdc++-v3/src/globals.cc:30: /root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/include/i686-pc-msdosdjgpp/bits/ctype_base.h:46: ` _U' was not declared in this scope _L' was not declared in this scope ... many snips of the same error make[3]: *** [globals.lo] Error 1 make[3]: Leaving directory `/root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/src' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3' make[1]: *** [all-recursive-am] Error 2 make[1]: Leaving directory `/root/updates/gcc/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3' make: *** [all-target-libstdc++-v3] Error 2 This build failure takes place during the all-target-libstdc++-v3 part of the build. It was suggested by a recipient of the crossgcc mailing list that the symbolic links from ~/djgpp/cross/gcc-3.2-obj/i686-pc-msdosdjgpp/libstdc++-v3/include/i686-pc-msdosdjgpp/bits were incorrect and that they needed to be properly linked to the header files in ~/djgpp/cross/gcc-3.2-src/libstdc++-v3/config/os/djgpp/bits This suggestion seems to be was right, the links were to ~config/os/newlib/* instead of ~config/os/djgpp/* I fixed the links and was able to rebuild successfully, but when I tried to compile using i686-pc-msdosdjgpp-g++ I could not because the linker was looking for libstdcxx.a and all that was there was libstdc++.a. So I made a link from libstdc++.a to libstdcxx.a to satisfy the linker. I am not sure I should have had to do this... Why is the linker looking for cxx and not c++ ? Then when I tried to compile using the cross compiler, i686-pc-msdosdjgpp-g++, the same errors popped up regarding the ctype_base.h that were coming up before during making libstdc++-v3. ../include/c++/3.2/bits/ctype_base.h:46: _U' was not declared in this scope ../include/c++/3.2/bits/ctype_base.h:46: _L' was not declared in this scope snipped... lots of similar 'undeclared' errors re ctype_base.h I then realized that even though I fixed the links and rebuilt, the contents wrong header files were in ~/include/c++/3.2/bits for some reason. It had the files from the srcdir's ~/libstdc++-v3/config/os/newlib instead of ~/libstdc++-v3/config/os/djgpp. So to correct this, I moved the newlib dir to a backup location and then made a copy of ~/config/os/djgpp to ~/config/os/newlib so that way the build would be forced to see the djgpp headers. I am not sure I should have had to do this... Why is are the newlib target headers being used instead of the djgpp target headers? Why are the wrong links being made for the djgpp target? So after copying the ~config/os/djgpp headers into ~config/os/newlib directory, libstdc++-v3 built and installed with no errors. I was able to then compile a binary using i686-pc-msdosdjgpp-g++ without error, but when I try to execute the binary under win98 or win2kpro, i get this: Exiting due to signal SIGSEGV General Protection Fault at eip=0001a11f eax=00000000 ebx=0003eb58 ecx=0003eb58 edx=007cffa0 esi=00000054 edi=00001630 ebp=007cff68 esp=007cff64 program=H:\ROOT\PROJECTS\CPP\TEST\WELCOME.EXE cs: sel=01a7 base=01670000 limit=007dffff ds: sel=01af base=01670000 limit=007dffff es: sel=01af base=01670000 limit=007dffff fs: sel=017f base=00005870 limit=0000ffff gs: sel=01bf base=00000000 limit=0010ffff ss: sel=01af base=01670000 limit=007dffff App stack: [007d0000..00750000] Exceptn stack: [00042c88..00040d48] Call frame traceback EIPs: 0x0001a11f 0x0001a36e 0x0000167e 0x0000d1f8 Here is the C++ program: #include using namespace std; int main() { cout << "Hello world !!!" << endl; return 0; } Note: the binary file size for this simple cpp program is 1,847,862 bytes. Aside from not even executing properly, does this file size seem right? When I compile a standard C equivalent program using i686-pc-msdosdjgpp-gcc, I get an exe size of 137,204 bytes and the file executes properly. There are still enough things doing wrong here that I do not know where to focus my efforts. SOMEBODY PLEASE HELP :) Any ideas what is happening here? Charles Wilkins