Date: Wed, 1 Dec 2004 00:04:19 EST-10EDT,10,-1,0,7200,3,-1,0,7200,3600 Subject: [UnixOS2_Archive] No. 463 ************************************************** Tuesday 30 November 2004 Number 463 ************************************************** Subjects for today 1 Ugly problems with chdrive and mkdir in gcc 3.3.5 : lsunley at mb.sympatico.ca 2 More on mkdir : lsunley at mb.sympatico.ca 3 Re: Ugly problems with chdrive and mkdir in gcc 3.3.5 : lsunley at mb.sympatico.ca 4 Re: More on mkdir : lsunley at mb.sympatico.ca 5 Re: Ugly problems with chdrive and mkdir in gcc 3.3.5 : Yuri Dario" 6 Re: Building Python 2.3.4 with Innotek GCC 3.3.5 beta 1 : Paul Smedley 7 Re: Building Python 2.3.4 with Innotek GCC 3.3.5 beta 1 : Andrew MacIntyre **= Email 1 ==========================** Date: Mon, 29 Nov 2004 23:14:43 -0500 From: lsunley at mb.sympatico.ca Subject: Ugly problems with chdrive and mkdir in gcc 3.3.5 Hi all, I ran into some problems with postgreSQL creating directories with initdb... The mkdir() routine does not work very well and chdrive has problems This program is a standalone testcase. ---------------------------------------- #include #include main (argc, argv) { char currloc[256]; char setloc [256]; int currdrive; int chgdrive; int newdrive; fprintf(stderr, "Starting it\n"); currdrive = _getdrive(); fprintf(stderr, "Current drive %d\n", currdrive); _getcwd(currloc, 255); fprintf(stderr, "Current directory %s\n", currloc); chgdrive = currdrive - 1; if(_chdrive(chgdrive)) fprintf(stderr, "error for chgdrive %d\n", chgdrive); fprintf(stderr, "errno for chgdrive %d\n", errno); newdrive = _getdrive(); fprintf(stderr, "New drive %d\n", newdrive); chdir("\\"); fprintf(stderr, "errno for chdir %d\n", errno); _getcwd(setloc, 255); fprintf(stderr, "Set directory %s\n", setloc); mkdir("pug_test", 777); fprintf(stderr, "errno for pug_test %d\n", errno); mkdir("pug_test/lowerone", 777); fprintf(stderr, "errno for pug_test lowerone %d\n", errno); _chdrive((int) currloc); } ---------------------------------------- When it is compiled and run with gcc 3.2.2 it works right and creates directories. (output is) [M:\qtest\source]qdir Starting it Current drive 77 Current directory /qtest/source errno for chgdrive 0 New drive 76 errno for chdir 0 Set directory / errno for pug_test 0 errno for pug_test lowerone 0 The directory tree \pug_test\lowerone is created on drive L (the program was started on drive M When compiled and run with gcc 3.3.5 the program does not create directories and does not change drives [M:\qtest\srcof]qdir Starting it Current drive 13 Current directory M:/qtest/srcof errno for chgdrive 0 New drive 13 errno for chdir 0 Set directory M:/ errno for pug_test 63 errno for pug_test lowerone 2 Note the completly different returns from _getcwd gcc 3.3.5 returns a driver letter in the path and gcc 3.2.2 does not Lorne -- ----------------------------------------------------------- lsunley at mb.sympatico.ca ----------------------------------------------------------- **= Email 2 ==========================** Date: Mon, 29 Nov 2004 23:37:19 -0500 From: lsunley at mb.sympatico.ca Subject: More on mkdir This program will not work... #include #include main (argc, argv) { char currloc[256]; char setloc [256]; int currdrive; int chgdrive; int newdrive; chdir("\\"); fprintf(stderr, "errno for chdir %d\n", errno); _getcwd(setloc, 255); fprintf(stderr, "Set directory %s\n", setloc); mkdir("pug_test", 777); fprintf(stderr, "errno for pug_test %d\n", errno); mkdir("pug_test/lowerone", 777); fprintf(stderr, "errno for pug_test lowerone %d\n", errno); } This one will #include #include main (argc, argv) { char currloc[256]; char setloc [256]; int currdrive; int chgdrive; int newdrive; /* chdir("\\"); fprintf(stderr, "errno for chdir %d\n", errno); */ _getcwd(setloc, 255); fprintf(stderr, "Set directory %s\n", setloc); mkdir("pug_test", 777); fprintf(stderr, "errno for pug_test %d\n", errno); mkdir("pug_test/lowerone", 777); fprintf(stderr, "errno for pug_test lowerone %d\n", errno); } The chdir routine screws something up... Lorne -- ----------------------------------------------------------- lsunley at mb.sympatico.ca ----------------------------------------------------------- **= Email 3 ==========================** Date: Mon, 29 Nov 2004 23:41:32 -0500 From: lsunley at mb.sympatico.ca Subject: Re: Ugly problems with chdrive and mkdir in gcc 3.3.5 I have discovered that if I use the number value of the drive letter (76 for drive L) the chdrive routine in 3.3.5 will change drives. When I use the drive number (starting with A = 1) the chdrive 3.3.5 will not work. getdrive in 3.2.2 returns the number value of the drive letter L = 76 whereas getdrive in 3.3.5 returns the drive number L = 12 Lorne In <0I7Z00F0N8AAI6 at l-daemon>, on 11/29/04 at 11:14 PM, lsunley at mb.sympatico.ca said: >Hi all, >I ran into some problems with postgreSQL creating directories with >initdb... >The mkdir() routine does not work very well and chdrive has problems >This program is a standalone testcase. >---------------------------------------- >#include >#include >main (argc, argv) >{ >char currloc[256]; >char setloc [256]; >int currdrive; >int chgdrive; >int newdrive; > fprintf(stderr, "Starting it\n"); > currdrive = _getdrive(); > fprintf(stderr, "Current drive %d\n", currdrive); > _getcwd(currloc, 255); > fprintf(stderr, "Current directory %s\n", currloc); > chgdrive = currdrive - 1; > if(_chdrive(chgdrive)) > fprintf(stderr, "error for chgdrive %d\n", chgdrive); > fprintf(stderr, "errno for chgdrive %d\n", errno); > newdrive = _getdrive(); > fprintf(stderr, "New drive %d\n", newdrive); > chdir("\\"); > fprintf(stderr, "errno for chdir %d\n", errno); > _getcwd(setloc, 255); > fprintf(stderr, "Set directory %s\n", setloc); > mkdir("pug_test", 777); > fprintf(stderr, "errno for pug_test %d\n", errno); > mkdir("pug_test/lowerone", 777); > fprintf(stderr, "errno for pug_test lowerone %d\n", errno); > _chdrive((int) currloc); >} >---------------------------------------- >When it is compiled and run with gcc 3.2.2 it works right and creates >directories. (output is) >[M:\qtest\source]qdir >Starting it >Current drive 77 >Current directory /qtest/source >errno for chgdrive 0 >New drive 76 >errno for chdir 0 >Set directory / >errno for pug_test 0 >errno for pug_test lowerone 0 >The directory tree \pug_test\lowerone is created on drive L (the program >was started on drive M >When compiled and run with gcc 3.3.5 the program does not create >directories and does not change drives >[M:\qtest\srcof]qdir >Starting it >Current drive 13 >Current directory M:/qtest/srcof >errno for chgdrive 0 >New drive 13 >errno for chdir 0 >Set directory M:/ >errno for pug_test 63 >errno for pug_test lowerone 2 >Note the completly different returns from _getcwd >gcc 3.3.5 returns a driver letter in the path and gcc 3.2.2 does not >Lorne -- ----------------------------------------------------------- lsunley at mb.sympatico.ca ----------------------------------------------------------- **= Email 4 ==========================** Date: Mon, 29 Nov 2004 23:51:27 -0500 From: lsunley at mb.sympatico.ca Subject: Re: More on mkdir This will not work either NOTE leading "/" on directory to make the directory in the root directory of the current drive. The program below that does work creates subdirectories in the current directory. #include #include main (argc, argv) { char currloc[256]; char setloc [256]; int currdrive; int chgdrive; int newdrive; _getcwd(setloc, 255); fprintf(stderr, "Set directory %s\n", setloc); mkdir("/pug_test", 777); fprintf(stderr, "errno for pug_test %d\n", errno); mkdir("/pug_test/lowerone", 777); fprintf(stderr, "errno for pug_test lowerone %d\n", errno); } In <0I7Z00D9D90YNF at l-daemon>, on 11/29/04 at 11:37 PM, lsunley at mb.sympatico.ca said: >This program will not work... >#include >#include >main (argc, argv) >{ >char currloc[256]; >char setloc [256]; >int currdrive; >int chgdrive; >int newdrive; > chdir("\\"); > fprintf(stderr, "errno for chdir %d\n", errno); > _getcwd(setloc, 255); > fprintf(stderr, "Set directory %s\n", setloc); > mkdir("pug_test", 777); > fprintf(stderr, "errno for pug_test %d\n", errno); > mkdir("pug_test/lowerone", 777); > fprintf(stderr, "errno for pug_test lowerone %d\n", errno); } >This one will >#include >#include >main (argc, argv) >{ >char currloc[256]; >char setloc [256]; >int currdrive; >int chgdrive; >int newdrive; >/* > chdir("\\"); > fprintf(stderr, "errno for chdir %d\n", errno); >*/ > _getcwd(setloc, 255); > fprintf(stderr, "Set directory %s\n", setloc); > mkdir("pug_test", 777); > fprintf(stderr, "errno for pug_test %d\n", errno); > mkdir("pug_test/lowerone", 777); > fprintf(stderr, "errno for pug_test lowerone %d\n", errno); > >} >The chdir routine screws something up... >Lorne -- ----------------------------------------------------------- lsunley at mb.sympatico.ca ----------------------------------------------------------- **= Email 5 ==========================** Date: Tue, 30 Nov 2004 08:24:38 +0100 (CET) From: "Yuri Dario" Subject: Re: Ugly problems with chdrive and mkdir in gcc 3.3.5 Hi, >I have discovered that if I use the number value of the drive letter (76 >for drive L) the chdrive routine in 3.3.5 will change drives. When I use >the drive number (starting with A = 1) the chdrive 3.3.5 will not work. are you using libc06b1? chdir2/getdrive were broken in alpha releases. BTW you can use chdir2 instead of chdir, this will change also current drive, without adding more code. Bye, Yuri Dario /* * member of TeamOS/2 - Italy * http://www.os2power.com/yuri * http://www.teamos2.it */ **= Email 6 ==========================** Date: Tue, 30 Nov 2004 21:04:23 +1030 From: Paul Smedley Subject: Re: Building Python 2.3.4 with Innotek GCC 3.3.5 beta 1 Hi Andrew, Andrew MacIntyre wrote: > On Sun, 28 Nov 2004, Paul Smedley wrote: > You could try using emximp to find out what symbols are visible in the > object file. I vaguely recall some mention about Innotek's gcc not > behaving the same way as EMX gcc with regards to prepending underscores - > if there's a _initfpectl symbol this is the cause. > > If this is the case, it may be possible to work around this with the > autogeneration of the .DEF file, but you will need to alias the > underscored symbols to non-underscored symbols as the import machinery > doesn't know anything about prepending underscores. Yep you're right - Innotek GCC is adding the underscores but Ilink is looking for the symbol name without the underscore. I've seen reference to this - now I need to understand how to deal with it :) Cheers, Paul. **= Email 7 ==========================** Date: Tue, 30 Nov 2004 00:14:04 +1100 (EST) From: Andrew MacIntyre Subject: Re: Building Python 2.3.4 with Innotek GCC 3.3.5 beta 1 On Sun, 28 Nov 2004, Paul Smedley wrote: > python.exe, pgen.exe, pythonpm.exe & python24.dll all get successfully > built using the same changes as for python 2.3.4 > > However, appears I got carried away with the completion of compilation - > noticed with 2.4rc1 the following: > > Creating .DEF file: out/optimize/fpectl_m.def > gcc -Zmt -Zcrtdll -L. -lgcc -s -Zomf -Zdll -o fpectl.pyd > out/optimize/fpectlmodu > le.obj out/optimize/fpectl_m.def python24.lib -lsocket > weakld: error: Unresolved symbol (UNDEF EXPORT) 'initfpectl'. > weakld: info: The symbol is referenced by: > E:/DEV/Python-2.4c1/PC/os2emx/out/optimize/fpectl_m.def > Ignoring unresolved externals reported from weak prelinker. > ILink : error LNK2022: initfpectl (alias initfpectl) : export undefined > > There was 1 error detected > make[1]: *** [fpectl.pyd] Error 1 > rm out/optimize/fpectlmodule.obj out/optimize/fpectl_m.def > make[1]: Leaving directory `/dev/python-2.4c1/pc/os2emx' > make: *** [python_noncore] Error 2 > > > Which rang a bell as happening when I build 2.3.4 as well I just failed > to report it in my last post :( Hmmm... you haven't shown the output from compiling fpectlmodule.c. The object file either must be empty or use a different naming convention. You could try using emximp to find out what symbols are visible in the object file. I vaguely recall some mention about Innotek's gcc not behaving the same way as EMX gcc with regards to prepending underscores - if there's a _initfpectl symbol this is the cause. If this is the case, it may be possible to work around this with the autogeneration of the .DEF file, but you will need to alias the underscored symbols to non-underscored symbols as the import machinery doesn't know anything about prepending underscores. This will have affected building all dynamically loaded extention modules. ------------------------------------------------------------------------- Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac at bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac at pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia