1 Current state of the patches here is with respect to perl5.002b1d ;-).
3 ========================================================
5 The OS/2 patchkit was submitted by ilya@math.ohio-state.edu. I have
6 applied some parts that I suspect won't cause any problems.
7 Others do things that I haven't had time to fully consider.
9 Still other patches included here should perhaps be integrated with the
10 metaconfig package that generates Configure.
12 Andy Dougherty <doughera@lafcol.lafayette.edu>
14 ========================================================
18 patches should be applied as
20 All the diff.* files and POSIX.mkfifo should be applied.
22 Additional files are available on
23 ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2
24 including patched pdksh and gnumake, needed for build.
30 This is not supposed to make a perfect Perl on OS/2. This patch is
31 concerned only with perfect _build_ of Perl on OS/2. Some good
32 features from Andreas Kaiser port missed this port. However, most of
33 the features are available in different form.
35 !!! Note that [gs]etpriority functions in this port are compatible
36 !!! with *nix, not with ak's port!!!
38 The priorities are absolute, go from 32 to -95, lower is quickier. 0
41 Notes on build on OS/2:
42 ~~~~~~~~~~~~~~~~~~~~~~~
43 The change of C code in this patch is based on the ak port of 5.001+.
45 a) Make sure your sort is not the broken OS/2 one, and that you have /tmp
46 on the build partition.
48 b) when extracting perl5.*.tar.gz you need to extract perl5.*/Configure
49 separately, since by default perl5.001m/configure may overwrite it;
51 tar vzxf perl5.004.tar.gz --case-sensitive perl5.004/Configure
53 c) Necessary manual intervention when compiling on OS/2:
55 Need to put perl.dll on LIBPATH after it is created.
59 !!! At the end of this README is independent description of the build
60 !!! process by Rocco Caputo.
62 # Look for hints/os2.sh and correct what is different on your system
63 # I have rather spartan configuration.
65 # Prefix means where to install:
66 sh Configure -des -D prefix=f:/perl5.005
67 # Ignore the message about missing `ln', and about `c' option
70 # Will probably die after build of miniperl (unless you have DLL
71 # from previous compile). Need to move DLL where it belongs
73 # Somehow with 5.002b3 I needed to type another make after pod2man
75 # some warnings in POSIX.c
77 # some tests fail, 9 or 10 on my system (see the list at end).
79 # before this you should create subdirs bin and lib in the
80 # prefix directory (f:/perl5.005 above):
82 # To run finer tests, cd t && perl harness
85 e) At the end of August GNU make and pdksh were too buggy for compile.
86 Both maintainers have patches that make it possible to compile perl.
87 The binaries are included in
88 ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2
89 patches are available too.
90 Note that the pdksh5.2.4 broke builds with -Zexe option because of a
91 changed order of executable extensions. A patch is sent to
92 maintainer. The version 5.2.5alpha was OK for the build,
95 If you see that some '/' became '\' in pdksh 5.2.3, you did not apply
97 Same with segfaults in Make 3.74.
102 a) one of the latest tr is broken, get an old one :-(
103 1.11 works. (On compuserver?)
104 b) You need a link386.
105 c) Get rid of invalid perl.dll on your LIBPATH.
107 Note the EMX does not support en_us locale (most nobody does ;-). Some
108 TCP/IP update could have installed it to your config.sys. You need to
109 delete it until EMX is updated to support this newest discovery by IBM.
112 Send comments to ilya@math.ohio-state.edu.
114 ======================================================
115 Requires 0.9b (well, provision are made to make it build under 0.9a6,
116 but they are not tested, please inform me on success).
117 (earlier than 0.9b ttyname was not present, it is hard to maintain this
118 difference automatically, though I try).
119 ======================================================
121 Building with a.out style is supported by the `perl_' target of make.
122 Dynamic extensions are not possible with perl_.exe, since boot code
123 should return the retvalue on stack, the address of which is not known
126 The reason why compiling with a.out style executables leads to problems
127 with dynamic extensions is:
128 a) OS/2 does not export symbols from executables;
129 b) Thus if extension needs to import symbols from an application
130 the symbols for the application should reside in a .dll.
131 c) You cannot export data from a .dll compiled with a.out style.
132 On the other hand, aout-style compiled extension enjoys all the
133 (dis)advantages of fork().
135 Check A.OUT compile with the following make targets:
141 ======================================================
142 Tests which fail with OMF compile:
144 io/fs.t: 2-5, 7-11, 18 as they should.
145 io/pipe: all, since open("|-") is not working (works with perl_.exe).
146 lib/"all the dbm".t: 1 test should fail (file permission).
147 op/fork all fail, as they should (except with perl_.exe)
148 op/stat 3 20 35 as they should, 39 (-t on /dev/null) ???? Sometimes 4
149 - timing problem ????
151 Sometimes I have seen segfault in socket ????, only if run with Testing tools.
153 A lot of `bad free'... in databases, bug in DB confirmed on other
156 Fail: Total 30 subtests (if stat:4 fails) in 10 scripts (one of 10
157 is socket, which runs OK standalone). With newer configs I could not
158 reproduce most the crashes.
160 =======================================================
162 Changes to calls to external programs:
163 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Due to a popular demand the perl
164 external program calling has been changed. _If_ perl needs to call an
165 external program _via shell_, the X:/bin/sh.exe will be called. The
166 name of the shell is not overridable, except the drive letter.
168 Thus means that you need to pickup some copy of a sh.exe as well (I use one
169 from pdksh). The drive X: above is set up automatically during the
170 build, is settable in runtime from $ENV{PERL_SH_DRIVE}.
172 Reasons: a consensus on perl5-porters was that perl should use one
173 non-overridable shell per platform. The obvious choices for OS/2 are cmd.exe
174 and sh.exe. Having perl build itself would be impossible with cmd.exe as
175 a shell, thus I picked up sh.exe. Thus assures almost 100% compatibility
176 with the scripts coming from *nix.
178 Disadvantages: sh.exe calls external programs via fork/exec, and there is
179 _no_ functioning exec on OS/2. exec is emulated by EMX by asyncroneous call
180 while the caller waits for child completion (to pretend that pid did
181 not change). This means that 1 _extra_ copy of sh.exe is made active via
182 fork/exec, which may lead to some resources taken from the system.
184 The long-term solution proposed on p5-p is to have a directive
186 which will override system(), exec(), ``, and open(,' |'). With current
187 perl you may override only system(), readpipe() - the explicit version
188 of ``, and maybe exec(). The code will substitute a one-argument system
189 by CORE::system('cmd.exe', '/c', shift).
191 If you have some working code for OS2::Cmd.pm, please send it to me,
192 I will include it into distribution. I have no need for such a module, so
195 ===================================================
199 Since binaries cannot go into perl distribution, no extensions are
200 included. They are available in .../os2/ilyaz directory of CPAN, as
201 well as in my directory
202 ftp://ftp.math.ohio-state.edu/pub/users/ilya/os2
204 I include 3 extensions by Andread Kaiser, OS2::REXX, OS2::UPM, and OS2::FTP,
205 into my ftp directory, mirrored on CPAN. I made
206 some minor changes needed to compile them by standard tools. I cannot
207 test UPM and FTP, so I will appreciate your feedback. Other extensions
208 there are OS2::ExtAttribs, OS2::PrfDB for tied access to EAs and .INI
209 files - and maybe some other extensions at the time you read it.
211 Note that OS2 perl defines 2 pseudo-extension functions
212 OS2::Copy::copy and DynaLoader::mod2fname.
214 The -R switch of older perl is deprecated. If you need to call a REXX code
215 which needs access to variables, include the call into a REXX compartment
217 REXX_call {...block...};
219 Two new functions are supported by REXX code,
221 REXX_eval_with 'string', REXX_function_name => \&perl_sub_reference;
223 If you have some other extensions you want to share, send the code to me.
224 Two jump to mind: tied access to EA's, and tied access to system databases.
226 ==================================================================
228 == User report [my comments in brackets, IZ] ==
230 ==================================================================
232 Starting in x:/usr/src, using 4OS2/32 2.5 as the command interpreter on
233 OS/2 2.30 with FixPak-17. DAX is installed, but this shouldn't be a
234 factor. Drive X is a TVFS virtual drive pointing to several physical
237 >>> Make sure that no copies or perl are currently running. Miniperl
238 may fail during the build because it will find an older version
239 of perl.dll loaded in memory.
241 Close any running perl scripts.
242 Shut down anything that might run perl scripts, like cron.
243 `emxload -l` to check for loaded versions of perl.
244 `emxload -u perl.exe` to unload them.
246 >>> Pre-load some common utilities:
248 emxload -e sh.exe make.exe ls.exe tr.exe id.exe sed.exe
249 SET GCCLOAD=30 (number of minutes to hold the compiler)
250 [grep egrep fgrep cat rm uniq basename uniq sort - are not bad too.]
251 The theory is that it's faster to demand-load the development tools
252 from virtual memory than it is to re-load and re-link them all the
253 time. This is definitely true with my system because swapfile.dat
254 is on a faster drive than my development environment.
256 ls, tr, and id represent the GNU file, text, and shell utilities.
257 These may not be needed, but it makes sure that their respective
260 >>> Unpack the perl 5_002_01 archive onto an HPFS partition.
262 tar vxzf perl5_002_01.tar-gz
265 [Do not forget to extract Configure as described above.]
267 >>> Read the README, keeping a copy open in another session for reference.
269 start /c /fg less os2/README
271 >>> Apply the OS/2 patches included with 5.002_01, as per the README.
273 for %m in (os2\diff.*) patch -p0 < %m
274 patch -p0 < os2\POSIX.mkfifo
276 [The patch below is already applied.]
278 >>> You may need to apply this patch if you plan to run a non-standard
279 Configure (that is, if you defy the README). This patch will ensure
280 that Makefile inherits the libraries specified during Configure.
281 People running standard perl builds can probably ignore this patch.
283 *** os2\Makefile.SHs Mon Mar 25 02:05:00 1996
284 --- os2\Makefile.SHs.new Fri May 24 10:37:10 1996
287 emximp -o perl.imp perl5.def
289 perl.dll: $(obj) perl5.def perl$(OBJ_EXT)
290 ! $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) -lsocket perl5.def
292 perl5.def: perl.linkexp
293 echo "LIBRARY 'Perl' INITINSTANCE TERMINSTANCE" > $@
295 emximp -o perl.imp perl5.def
297 perl.dll: $(obj) perl5.def perl$(OBJ_EXT)
298 ! $(LD) $(LDDLFLAGS) -o $@ perl$(OBJ_EXT) $(obj) $(libs) perl5.def
300 perl5.def: perl.linkexp
301 echo "LIBRARY 'Perl' INITINSTANCE TERMINSTANCE" > $@
304 cat perl.exports perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
306 perl.map: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT)
307 ! $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o dummy.exe miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) $(obj) -lsocket -lm -Zmap -Zlinker /map
308 awk '{if ($$3 == "") print $$2}' <dummy.map | sort | uniq > perl.map
309 rm dummy.exe dummy.map
312 cat perl.exports perl.map | sort | uniq -d | sed -e 's/\w\+/ "\0"/' > perl.linkexp
314 perl.map: $(obj) perl$(OBJ_EXT) miniperlmain$(OBJ_EXT)
315 ! $(CC) $(LARGE) $(CLDFLAGS) $(CCDLFLAGS) -o dummy.exe miniperlmain$(OBJ_EXT) perl$(OBJ_EXT) $(obj) $(libs) -Zmap -Zlinker /map
316 awk '{if ($$3 == "") print $$2}' <dummy.map | sort | uniq > perl.map
317 rm dummy.exe dummy.map
319 >>> Apply the patches from Ilya's perl5.002_01 binary distribution:
321 touch os2/dlfcn.h os2/dl_os2.c
322 patch -p1 < f:\perllib\README.fix1
324 >>> Run Configure. Most people can run it by following the README:
326 sh Configure -des -D prefix=f:/usr/local
328 Advanced perl users (experienced C programmers, recommended) can run
329 the interactive Configure and answer the questions. When in doubt
330 about an answer, check the EMX headers and documentation. Pick the
331 default answer if that doesn't help:
335 [Yet more advanced users just specify the answers on the command line
336 of Configure, like I did with prefix.]
338 Note: You may need to wrap an answer in quotes if it contains
339 spaces. For example, "-lsocket -lm".
341 Note: If you want to add some options to a long default, you can
342 use $* to include the default in your answer: "$* -DDEBUGGING".
344 Configure warnings and errors, and possible work-arounds:
346 I don't know where 'ln' is....
347 (ignored; OS/2 doesn't have a ln command)
349 nm didn't seem to work right. Trying emxomfar instead...
350 (nothing to worry about)
352 The recommended value for $d_shrplib on this machine was "define"!
353 (kept the recommended value: y)
355 Directory f:/usr/lib/perl5/os2/5.00201/CORE doesn't exist.
356 (created the directory from another window with
357 \usr\bin\mkdir -p f:/usr/lib/perl5/os2/5.00201/CORE
358 and then answered: y. Your directory may look different.)
360 [Ignore this as well, install script will create it for you.]
362 The recommended value for $i_dlfcn on this machine was "define"!
363 (kept the recommended value: y)
365 The recommended value for $d_fork on this machine was "undef"!
366 (kept the recommended value: y)
368 Figuring out the flag used by open() for non-blocking I/O...
369 Seems like we can use O_NONBLOCK.
370 This seems to be used for informative purposes only.
371 The errors that follow this (including a SIGPIPE) don't seem
372 to affect perl at all. These were safely ignored.
374 What pager is used on your system? [/usr/ucb/more]
375 Had to answer "/usr/bin/less.exe" because Configure wants a
376 leading / (unix full path). Need to edit config.sh later with
377 the real full path to the pager, including the drive letter.
379 [Apparently this setting is never used, so it is safe to ignore it.]
381 Hmm... F:/USR/BIN/sed: Unterminated `s' command
382 Perl built fine even with this error, so it seems safe to
385 Things I did different from the defaults. Most (if not all) of these
386 are optional changes. They're listed here to show how good Configure
387 is at detecting the system setup.
389 [I add the options to put it on command line of Configure, see below.]
391 Selected 'none' for the man1 location.
392 (I prefer the pod2html version.)
394 Selected 'none' for the man3 location.
395 (I prefer the pod2html version.)
397 Changed the hostname and domain.
398 (I wanted to override a dynamic PPP address. This only
399 matters if other people will be using your perl build.)
400 [-D myhostname=my_host_name -D mydomain=.foo.org]
401 Fixed the e-mail address.
402 (Put in a known working e-mail address. This only matters
403 if other people will be using your perl build.)
404 [-D cf_email=root@myhostname.uucp]
405 Added some directories to the library search path.
406 [-D "libpth=f:/emx/lib/st f:/emx/lib"]
407 Added -g to the optimizer/debugger flags.
409 Added "-lgdbm -ldb -lcrypt -lbsd" to the additional libraries.
410 [ -D "libs=-lsocket -lcrypt -lgdbm"
411 the rest of libraries will not be used]
413 >>> Advanced users may want to edit config.sh when prompted by Configure.
414 Most (all?) of these changes aren't really necessary:
418 (getpriority and setpriority are included in os2.c, but
419 Configure doesn't know to look there.)
421 pager='f:/usr/bin/less.exe'
422 (Correcting Configure's insistence on a leading slash.)
423 bin_sh='f:/usr/bin/sh.exe'
424 (If Configure detects sh.exe somewhere else first. Example:
425 it saw sh.exe at /bin/sh.exe on my TVFS drive, but I want
426 perl to look for it on the physical F drive.)
427 aout_ccflags='... existing flags... -DDEBUGGING'
428 aout_cppflags='... existing flags... -DDEBUGGING'
429 (If you want to include DEBUGGING for the aout version.)
430 [Do not do it, -D optimize=-g will automatically add these flags.]
432 >>> Allow Configure to make the build scripts.
434 >>> Allow Configure to run `make depend`. Ignore the following warning:
436 perl.h:861: warning: `DEBUGGING_MSTATS' redefined
439 >>> Rename any existing perl.dll, preventing anything from loading it and
440 saving a known working copy in case something goes wrong:
442 mv /usr/lib/perl.dll /usr/lib/ilya-perl.dll
444 >>> Run `make`, and ignore the following warnings:
446 perl.h:861: warning: `DEBUGGING_MSTATS' redefined
448 invalid preprocessing directive name
449 emxomf warning: Cycle detected by make_type
450 LINK386 : warning L4071: application type not specified; assuming WINDOWCOMPAT
451 Warning (will try anyway): No library found for -lposix
452 Warning (will try anyway): No library found for -lcposix
453 POSIX.c:203: warning: `mkfifo' redefined
454 POSIX.c:4603: warning: assignment makes pointer from integer without a cast
456 >>> If `make` dies while "Making DynaLoader (static)", you'll need to
457 put miniperl in the OS/2 paths. This step is only necessary if `make`
459 [I would be interested if somebody confirmes this.]
461 cp perl.dll /usr/lib (where /usr/lib is in your LIBPATH)
462 cp miniperl.exe /usr/bin (where /usr/bin is in your PATH)
463 make (ignore the errors in the previous step)
465 This should run to completion.
473 io/fs..........FAILED on test 2
475 "OS/2 is not unix". Test 2 checks the link() command, which
476 is not supported by OS/2.
478 io/pipe........f:/usr/bin/sh.exe: -c requires an argument
479 f:/usr/bin/sh.exe: -c requires an argument
480 The Unsupported function fork function is unimplemented at
484 More "OS/2 is not unix" errors. Read ahead to find out
487 op/exec........FAILED on test 4
489 if (system "true") {print "not ok 4\n";} else \
492 This fails for me, but changing it to read like this works:
494 if (system '\usr\bin\true.cmd') {print "not ok 4\n";} \
495 else {print "ok 4\n";}
497 So you can count this as another "OS/2 is not unix".
499 op/fork........The Unsupported function fork function is \
500 unimplemented at op/fork.t line 8.
503 The dynamically-loaded version of perl currently doesn't
504 support fork(). This is a known behavior of EMX.
507 Process terminated by SIGINT
510 The test passed even with the SIGINT message. I don't
511 know why, but I won't argue.
513 op/stat........ls: /dev: No such file or directory
514 f:/usr/bin/sh.exe: ln: not found
515 ls: perl: No such file or directory
518 "OS/2 is not unix". We don't have the ln command.
520 lib/anydbm.....Bad free() ignored at lib/anydbm.t line 51.
521 Bad free() ignored at lib/anydbm.t line 51.
522 Bad free() ignored at lib/anydbm.t line 51.
523 Bad free() ignored during global destruction.
524 Bad free() ignored during global destruction.
525 Bad free() ignored during global destruction.
528 Test 2 looks at the file permissions for a database. "OS/2
529 is not unix" so the permissions aren't exactly what this test
532 lib/db-btree...Bad free() ignored at lib/db-btree.t line 109.
533 Bad free() ignored at lib/db-btree.t line 221.
534 Bad free() ignored at lib/db-btree.t line 337.
535 Bad free() ignored at lib/db-btree.t line 349.
536 Bad free() ignored at lib/db-btree.t line 349.
537 Bad free() ignored at lib/db-btree.t line 399.
538 Bad free() ignored at lib/db-btree.t line 400.
539 Bad free() ignored at lib/db-btree.t line 401.
542 Another file permissions test fails.
544 lib/db-hash....Bad free() ignored at lib/db-hash.t line 101.
545 Bad free() ignored at lib/db-hash.t line 101.
546 Bad free() ignored at lib/db-hash.t line 101.
547 Bad free() ignored at lib/db-hash.t line 239.
548 Bad free() ignored at lib/db-hash.t line 239.
549 Bad free() ignored at lib/db-hash.t line 239.
550 Bad free() ignored at lib/db-hash.t line 253.
551 Bad free() ignored at lib/db-hash.t line 253.
552 Bad free() ignored at lib/db-hash.t line 253.
555 Another file permissions test fails.
557 lib/db-recno...Bad free() ignored at lib/db-recno.t line 138.
558 Bad free() ignored at lib/db-recno.t line 138.
561 Another file permissions test fails.
563 lib/gdbm.......FAILED on test 2
565 Another file permissions test fails.
567 lib/sdbm.......FAILED on test 2
569 Another file permissions test fails.
571 Failed 11/94 tests, 88.30% okay.
573 All of which are known differences with unix or documented
574 behaviors in EMX. I re-run the test with Ilya's version,
575 and the same tests fail. This new build is a success.
576 [Note that bad free() mentioned above are bugs in the Berkeley
577 DB. They just are more visible under OS/2 with perl free(), because of
578 "rigid" function name resolution.
579 To get finer tests, cd to ./t and run
583 (Actually, Ilya's perl release fails an extra test because I don't
584 have sed in f:\emx.add. This shows how important it is to configure
585 and build perl yourself instead of grabbing pre-built binaries.)
586 [Hmm, should not happen... There is no mentions of full_sed under ./t
589 >>> Cross your fingers and install it:
593 Warnings encountered and workarounds presented.:
595 WARNING: You've never run 'make test'!!! (Installing anyway.)
596 (Lies! All lies! At least it still installs.)
598 WARNING: Can't find libperl*.dll* to install into \
599 f:/usr/lib/perl5/os2/5.00201/CORE. (Installing other things anyway.)
600 (Safe to ignore. The important one, libperl.lib, gets copied.)
602 Couldn't copy f:/usr/bin/perl5.00201.exe to f:/usr/bin/perl.exe: \
603 No such file or directory
604 cp /usr/bin/perl5.00201.exe /usr/bin/perl.exe
606 Couldn't copy f:/usr/bin/perl.exe to /usr/bin/perl.exe: No such \
608 (I think this one is safe to ignore since the two directories
609 point to the same place.)
611 >>> Laugh maniacally because you just built and installed your own copy
612 of perl, with all the paths set "just so" and with whatever little
613 psychotic modifications you've always wanted but were afraid to add.
615 -----------------------------------------------------------------------------
617 Development tools and versions:
619 EMX 0.9b with emxfix04 applied.
621 `ls --version` reports: 'GNU file utilities 3.12'
622 `tr --version` reports: 'tr - GNU textutils 1.14'
623 `id --version` reports: 'id - GNU sh-utils 1.12'
625 `sed --version` reports: 'GNU sed version 2.05'
626 `awk --version` reports: 'Gnu Awk (gawk) 2.15, patchlevel 6'
627 `grep --version` reports an illegal option and: 'GNU grep version 2.0'
628 (this includes egrep)
630 `sort --version` reports: 'sort - GNU textutils 1.14'
631 `uniq --version` reports: 'uniq - GNU textutils 1.14'
632 `find --version` reports: 'GNU find version 4.1'
634 KSH_VERSION='@(#)PD KSH v5.2.4 96/01/17'
635 (Ilya's patched version.)
637 `make --version` reports: 'GNU Make version 3.74'
638 (Ilya's patched version.)
642 EMXIO : revision = 40
643 EMXLIBC : revision = 40
644 EMXLIBCM : revision = 43
645 EMXLIBCS : revision = 43
646 EMXWRAP : revision = 40
648 -----------------------------------------------------------------------------