Kurtis Rader
2017-10-24 04:16:01 UTC
Has anyone else worked on making it possible to build ksh93 on macOS using
clang/LLVM rather than gcc? After many hours of investigation and
experimentation I have a working solution. But it involves hacking the
`./src/cmd/nmake/ppcc.sh` script to special-case clang and remove the `-I-`
flag from the list of arguments. Doing that, plus eliminating all the AST
items not needed to build ksh93, reduces the build time from 12 minutes to
8 minutes on my server. And that is without optimizing all the `iffe`
invocations.
The current build toolchain hasn't been updated in a very long time. A lot
of the logic involves dealing with ancient history such as C compilers that
only recognize K&R syntax, not ANSI C syntax. It is also incredibly
inefficient. For example, man source modules are compiled twice
(e.g., src/lib/libast/disc/sfstrtmp.c). Not to mention redundant `iffe`
invocations to detect various features of the platform.
There is an open issue, https://github.com/att/ast/issues/42, discussing
replacing the current build system with something based on autoconf or
Cmake. Given what I've observed in the past few days trying to get ksh93 to
build on macOS with clang I feel quite strongly the current build system
needs to be replaced. What do you think?
Note that I'm approaching this from the perspective that no one cares about
anything in the AST project other than ksh93. Which is certainly true for
myself. It also appears to be true for everyone else who has commented on
the code for this project hosted on Github: https://github.com/att/ast/.
clang/LLVM rather than gcc? After many hours of investigation and
experimentation I have a working solution. But it involves hacking the
`./src/cmd/nmake/ppcc.sh` script to special-case clang and remove the `-I-`
flag from the list of arguments. Doing that, plus eliminating all the AST
items not needed to build ksh93, reduces the build time from 12 minutes to
8 minutes on my server. And that is without optimizing all the `iffe`
invocations.
The current build toolchain hasn't been updated in a very long time. A lot
of the logic involves dealing with ancient history such as C compilers that
only recognize K&R syntax, not ANSI C syntax. It is also incredibly
inefficient. For example, man source modules are compiled twice
(e.g., src/lib/libast/disc/sfstrtmp.c). Not to mention redundant `iffe`
invocations to detect various features of the platform.
There is an open issue, https://github.com/att/ast/issues/42, discussing
replacing the current build system with something based on autoconf or
Cmake. Given what I've observed in the past few days trying to get ksh93 to
build on macOS with clang I feel quite strongly the current build system
needs to be replaced. What do you think?
Note that I'm approaching this from the perspective that no one cares about
anything in the AST project other than ksh93. Which is certainly true for
myself. It also appears to be true for everyone else who has commented on
the code for this project hosted on Github: https://github.com/att/ast/.
--
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank