Search code examples
c++linuxunixcompilation

How to compile DEC UNIX v4.0 application source code in Linux?


I have the source code of a very old software that was designed to be compiled on a Digital Unix V.40 operating system. Now I want to compile and run it on Ubuntu 20.04 operating system. The software was compiled in the digital Unix operating system with the CC compiler, which is now obsolete and is not supported by GCC. Based on the errors I received, what gcc switches should I use to fix this problem?

cc  -O2 -Olimit 2000 -g -migrate -assume -Zp1 noaligned_objects ...
cc: error: 2000: No such file or directory
cc: error: noaligned_objects: No such file or directory
cc: error: unrecognized command line option ‘-migrate’
cc: error: unrecognized command line option ‘-assume’
cc: error: unrecognized command line option ‘-Zp1’

Solution

  • Start with compiling it with no system-specific flags (i.e. by using gcc possibly with -I, -L, and -l flags and nothing else). If the program in question is portable enough, then it will be a matter of getting all dependencies available for it.

    Once you are able to build it, see if it runs as expected (ignore performance). If it doesn't, that would be a good time to look at the flags you used on DEC to see if it requires any special treatment when building. This is where you either make the program portable or try to get the equivalent behavior using gcc on the target architecture of your choice.

    Finally, once the program builds and runs, that would be a good time to see if you want to use any optimization flags (hint: you don't have to. If it runs fine, leave it the way it is).