June 19, 2019

Grinder - IRAF mkpkg won't run

In order to do some debugging, I had the need to make some changes (add print statements) to an IRAF package. Of course this involves rebuilding it, and that involves "mkpkg".
mkpkg -p mirror linux
 /iraf/iraf/unix/bin.linux/mkpkg.e: No such file or directory
I am greeted with the above error. But the file exists!
which mkpkg
/usr/local/bin/mkpkg
ls -l /usr/local/bin/mkpkg
lrwxrwxrwx. 1 root root 35 Jun 14 16:27 /usr/local/bin/mkpkg -> /iraf/iraf/unix/bin.linux64/mkpkg.e
file /iraf/iraf/unix/bin.linux64/mkpkg.e
/iraf/iraf/unix/bin.linux64/mkpkg.e: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked,
interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18,
BuildID[sha1]=be36f681be04766271c9e3c4ca8396109c90b252, with debug_info, not stripped
As it turns out, the initial error message is misleading. And the bogus message is entirely a linux bug, the problem is some missing library, or something of the sort. I have some old notes that recommend (for Fedora) installing the following libraries:
dnf install glibc.i686
dnf install glibc-devel.i686
dnf install ncurses-compat-libs.i686
Note that these are 32 bit libraries, and the mkpkg executable is 64 bit. The problem must come from something deeper (maybe) and mkpkg is trying to run some 32 bit executable, or something of the sort. Who can say?

Why mkpkg and not just gnu make

I have been told not to be so hard on IRAF, and I do try to cut it all the slack I can. But when facing some nasty and hard to solve problem, it is hard to avoid asking some obvious questions. Unix has a perfectly good make utility. Why did the IRAF project have to reinvent the wheel?

Who can say for sure. The "not invented here" syndrome runs strong and some people have an irresistable urge to redo everything. That could be part of it. It is also possible that back in the early 1990's when IRAF was being worked up, that they had an interest in making it possible to build IRAF on systems that didn't have a decent make utility (if you can imagine such a thing).

I think they would have been better served to just use good old "make" on the systems where it existed and to have ported actual make to systems that lacked it, but instead we have mkpkg, which is a unique make-like dialect. So another needless learning curve and all-around pain in the ass.

Back to the problem at hand

We use the usual trio of commands to try to rebuild our package. Remember that we must do this as "irafdude" because the user "irafdude" has the csh for a login shell (and a bunch of necessary aliases and environment variables set) and all that is absolutely essential for the following to work. Details on this setup elsewhere:
su - irafdude
cd /iraf/iraf/extern/mirror
mkpkg -p mirror linux
mkpkg -p mirror >& spool
mkpkg -p mirror summary
This greets us with the following message. This is something I know about.
In file included from /usr/include/iraf.h:28,
/iraf/iraf/unix/hlib/libc/libc.h:325:10: fatal error: /iraf/iraf/unix/bin/f2c.h: No such file or directory
  325 | #include "/iraf/iraf/unix/bin/f2c.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
The fix is to do this:
cd /iraf/iraf/unix
mkdir bin.generic
cp bin.linux/f2c.h bin.generic
As my IRAF expert says, this is a kludge, but it gets things going and is not worth the time to debug and tidy up.

After installing this, we repeat the following commands and we seem to get a proper result:

su - irafdude
cd /iraf/iraf/extern/mirror
mkpkg -p mirror >& spool
mkpkg -p mirror summary
And we see the following, which looks OK.
Wed 19 Jun 2019 02:27:13 PM MST
Subdirectory src/oven/menusc is up to date
Subdirectory src/oven/menusm is up to date
Subdirectory src/ovenr is up to date
Subdirectory src/odisp is up to date
Subdirectory src/ograph is up to date
Subdirectory src/xytran is up to date
Subdirectory src/imagemask is up to date
Subdirectory src/smooth is up to date
Subdirectory src/util is up to date
ranlib libpkg.a
Updated 22 files in libpkg.a
Object x_mirror.o is up to date
move `xx_mirror.e' to `mirrorbin$x_mirror.e'
purge directory `mirrorbin$'
!date
Wed 19 Jun 2019 02:27:13 PM MST

Have any comments? Questions? Drop me a line!

Tom's home page / tom@mmto.org