Bug #11617
closedesc fails with /usr/bin/cpp present
100%
Description
The eversholt compiler defaults to looking for a C pre-processor in /usr/bin/cpp and if not present falls back to /usr/lib/cpp. Unfortunately, it assumes that this means that such a cpp supports some of the classic Sun K&R cpp arguments. When /usr/bin/cpp is present from gcc or others, this leads to a build failure:
==== Build errors (non-DEBUG) ==== cpp: error: unrecognized command line option '-Y.' esc: fatal error: cpp errors while reading "amd64.esc", bailing out. cpp: error: unrecognized command line option '-Y.' esc: fatal error: cpp errors while reading "gcpu.esc", bailing out. cpp: error: unrecognized command line option '-Y.' ...
While the eversholt compiler has the ability to change its default cpp through the environment and it also has the ability to change the default cpp arguments such that we won't end up passing such ones, it's pretty clear at this time that it wants one that has these specific arguments. As such, we'll change the default compiler to /usr/lib/cpp so that this will work by default. However, technically the cpp that we're using is set by the CPP
and ANSI_CPP
macros in Makefile.master. Therefore, we should also actually set the _ESC_CPP
variable in the environment so that way we can make sure that we're actually using the intended cpp.
This was tested by the user who hit this and verified that the initial change worked when /usr/bin/cpp was present. I further tested this by using DTrace to make sure we were invoking the correct cpp as set in the environment variable. For example:
rm@hurin:/ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/files$ CPP=/bin/false dmake install /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/files/i386 /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/files/i386/i86pc _ESC_CPP=/bin/false /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/esc/i386/esc -D_ESC -I/ws/rm/esc.cpp/proto/root_i386/usr/include -o amd64.eft amd64.esc esc: fatal error: cpp errors while reading "amd64.esc", bailing out. *** Error code 1 dmake: Fatal error: Command failed for target `amd64.eft' Current working directory /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/files/i386/i86pc *** Error code 1 The following command caused the error: cd i86pc; pwd; VERSION='master-0-g812a37938b' dmake install dmake: Fatal error: Command failed for target `i86pc' Current working directory /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/files/i386 *** Error code 1 The following command caused the error: cd i386; pwd; VERSION='master-0-g812a37938b' dmake install dmake: Fatal error: Command failed for target `i386' Current working directory /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/files
rm@hurin:~$ sudo dtrace -n 'proc:::exec-success{ trace(curpsinfo->pr_psargs); }' dtrace: description 'proc:::exec-success' matched 1 probe CPU ID FUNCTION:NAME 6 1562 exec_common:exec-success dmake install 8 1562 exec_common:exec-success sh -c mach 8 1562 exec_common:exec-success /usr/bin/sh /usr/bin/mach 8 1562 exec_common:exec-success /usr/bin/uname -p 8 1562 exec_common:exec-success sh -ce cd i386; pwd; VERSION='master-0-g812a37938b' dmake install 8 1562 exec_common:exec-success dmake install 0 1562 exec_common:exec-success sh -c mach 0 1562 exec_common:exec-success /usr/bin/sh /usr/bin/mach 0 1562 exec_common:exec-success /usr/bin/uname -p 9 1562 exec_common:exec-success sh -ce cd i86pc; pwd; VERSION='master-0-g812a37938b' dmake install 9 1562 exec_common:exec-success dmake install 0 1562 exec_common:exec-success sh -ce _ESC_CPP=/bin/false /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/esc/i386/esc 0 1562 exec_common:exec-success /ws/rm/esc.cpp/usr/src/cmd/fm/eversholt/esc/i386/esc -D_ESC -I/ws/rm/esc.cpp/pr 1 1562 exec_common:exec-success sh -c /bin/false -undef -Y. -D_ESC -I/ws/rm/esc.cpp/proto/root_i386/usr/includ 1 1562 exec_common:exec-success /bin/false -undef -Y. -D_ESC -I/ws/rm/esc.cpp/proto/root_i386/usr/include amd64
Related issues
Updated by Robert Mustacchi almost 3 years ago
- Subject changed from esc failes with /usr/bin/cpp present to esc fails with /usr/bin/cpp present
Updated by Yuri Pankov almost 3 years ago
- Has duplicate Bug #6219: esc is sensitive to /usr/bin/cpp added
Updated by Robert Mustacchi almost 3 years ago
I tested this by changing the CPP setting and making sure that we used the right one. Aurélien tested this in an environment where /usr/bin/cpp
was present.
Updated by Electric Monk almost 3 years ago
- Status changed from New to Closed
git commit 96fc3fdf646c403f7896ecd3e9657d0474025bba
commit 96fc3fdf646c403f7896ecd3e9657d0474025bba Author: Robert Mustacchi <rm@joyent.com> Date: 2019-09-06T16:21:49.000Z 11617 esc fails with /usr/bin/cpp present Reviewed by: John Levon <john.levon@joyent.com> Reviewed by: Yuri Pankov <yuripv@yuripv.net> Approved by: Dan McDonald <danmcd@joyent.com>