Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfe build dies on macOS Montery with "pfe/def-regth.h:44:38: error: register '%r15' unsuitable for global register variables on this target" #2

Open
tkurtbond opened this issue Aug 1, 2023 · 0 comments

Comments

@tkurtbond
Copy link

pfe build dies on macOS Montery with "pfe/def-regth.h:44:38: error: register '%r15' unsuitable for global register variables on this target".

Here's a log of the build:

$ make
Makefile:536: warning: overriding commands for target `rpm'
Makefile:446: warning: ignoring old commands for target `rpm'
(cd `uname -msr | tr " /" "__"`.d && test ! -f configure && /Applications/Xcode.app/Contents/Developer/usr/bin/make "all") || exit ; /Applications/Xcode.app/Contents/Developer/usr/bin/make done "RULE=all"
Making all in pfe
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
/bin/sh ./libtool --silent  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I../../pfe/..             -I. -I../../pfe  -O1      -I/usr/local/opt/expat/include  -g -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Werror-implicit-function-declaration -fno-strict-aliasing -Wno-sign-compare   -no-cpp-precomp -MT def-check.lo -MD -MP -MF .deps/def-check.Tpo -c -o def-check.lo ../../pfe/def-check.c
In file included from ../../pfe/def-check.c:28:
In file included from ../../pfe/../pfe/def-regs.h:25:
../../pfe/../pfe/def-regth.h:44:38: error: register '%r15' unsuitable for global register variables on this target
register struct p4_Thread* p4TH asm (P4_REGTH);
                                     ^
../../pfe/../pfe/def-regmacro.h:166:36: note: expanded from macro 'P4_REGTH'
#            define P4_REGTH       "%r15"
                                   ^
1 error generated.
make[3]: *** [def-check.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

What was using the default computer on macOS, which is /usr/bin/gcc, which is actually Apple clang:

$ /usr/bin/gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I tried using a real GCC, installed by the macOS package manager homebrew, by setting CC=gcc-13 in the arguments to configure, like this: configure CC=gcc-13. It died with the error: "gcc-13: error: unrecognized command-line option '-no-cpp-precomp'".

Makefile:536: warning: overriding commands for target `rpm'
Makefile:446: warning: ignoring old commands for target `rpm'
(cd `uname -msr | tr " /" "__"`.d && test ! -f configure && /Applications/Xcode.app/Contents/Developer/usr/bin/make "all") || exit ; /Applications/Xcode.app/Contents/Developer/usr/bin/make done "RULE=all"
Making all in pfe
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-am
/bin/sh ./libtool --silent  --tag=CC   --mode=compile gcc-13 -DHAVE_CONFIG_H -I. -I.. -I../../pfe/..             -I. -I../../pfe  -O1      -I/usr/local/opt/expat/include  -g -Wall -Wstrict-prototypes   -no-cpp-precomp -MT def-check.lo -MD -MP -MF .deps/def-check.Tpo -c -o def-check.lo ../../pfe/def-check.c
gcc-13: error: unrecognized command-line option '-no-cpp-precomp'
make[3]: *** [def-check.lo] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

I found "-no-cpp-precomp" in configure. When I removed it, the build worked. Yay! Here's the diff:

diff --git a/pfe/configure b/pfe/configure
index 62f0dda..2dfee43 100644
--- a/pfe/configure
+++ b/pfe/configure
@@ -16723,13 +16723,6 @@ $as_echo ": with-regs $WITHVAL_REGS" >&6; }
   ;; esac
 fi

-case "$GCC,$host" in
-  yes,*darwin*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: :and use -no-cpp-precomp" >&5
-$as_echo ":and use -no-cpp-precomp" >&6; }
-     CFLAGS="$CFLAGS -no-cpp-precomp"
-     EXTRAS="$EXTRAS -no-cpp-precomp" ;;
-esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: cleaning LIBS from -lm occurrences" >&5
 $as_echo "cleaning LIBS from -lm occurrences" >&6; }
 LIBS=`echo " $LIBS " | sed -e "s/ -lm //g"`
# (0) tkb@vidar:/usr/local/sw/src/forth/pfe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant