jart/blink

Build is broken on macOS Ventura v13.2.1 (ARM) due to versioning definitions

devfacet opened this issue · 5 comments

Hello there,

I can't build Blink on macOS Ventura v13.2.1 (ARM) due to some of the versioning definitions (related commit 9425a09). I'm getting the following errors:

blink/blink.c:209:12: error: expected ')'
  Print(1, VERSION);
           ^
blink/blink.c:54:47: note: expanded from macro 'VERSION'
  "Blink Virtual Machine " BLINK_VERSION " (" BUILD_TIMESTAMP ")\n\
                                              ^
blink/blink.c:209:8: note: to match this '('
  Print(1, VERSION);
       ^
1 error generated.
make: *** [o//blink/blink.o] Error 1
make: *** Waiting for unfinished jobs....
blink/syscall.c:1347:27: error: expected ')'
  strcpy(uts.version, "#" BLINK_COMMITS " " BLINK_UNAME_V " " BUILD_TIMESTAMP);
                          ^
blink/syscall.c:1347:3: note: to match this '('
  strcpy(uts.version, "#" BLINK_COMMITS " " BLINK_UNAME_V " " BUILD_TIMESTAMP);
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_string.h:84:26: note: expanded from macro 'strcpy'
                __builtin___strcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                       ^
blink/blinkenlights.c:3707:9: error: expected ')'
  fputs(VERSION, stdout);
        ^
blink/blinkenlights.c:84:39: note: expanded from macro 'VERSION'
  "Blinkenlights " BLINK_VERSION " (" BUILD_TIMESTAMP ")\n\
                                      ^
blink/blinkenlights.c:3707:8: note: to match this '('
  fputs(VERSION, stdout);
       ^
1 error generated.
make: *** [o//blink/blinkenlights.o] Error 1
1 error generated.
make: *** [o//blink/syscall.o] Error 1

I was able to build with the following changes:

diff --git a/blink/blink.c b/blink/blink.c
index 59203ca..a321e5b 100644
--- a/blink/blink.c
+++ b/blink/blink.c
@@ -206,7 +206,7 @@ _Noreturn static void PrintUsage(int argc, char *argv[], int rc, int fd) {
 }
 
 _Noreturn static void PrintVersion(void) {
-  Print(1, VERSION);
+  //Print(1, VERSION);
   exit(0);
 }
 
diff --git a/blink/blinkenlights.c b/blink/blinkenlights.c
index bf5c6ae..cc21324 100644
--- a/blink/blinkenlights.c
+++ b/blink/blinkenlights.c
@@ -3704,7 +3704,7 @@ static void Tui(void) {
 }
 
 _Noreturn static void PrintVersion(void) {
-  fputs(VERSION, stdout);
+  //fputs(VERSION, stdout);
   exit(0);
 }
 
diff --git a/blink/syscall.c b/blink/syscall.c
index 6e29bc0..5399888 100644
--- a/blink/syscall.c
+++ b/blink/syscall.c
@@ -1344,7 +1344,7 @@ static int SysUname(struct Machine *m, i64 utsaddr) {
   strcpy(uts.machine, "x86_64");
   strcpy(uts.sysname, "Linux");
   strcpy(uts.release, LINUX_VERSION "-blink-" BLINK_VERSION);
-  strcpy(uts.version, "#" BLINK_COMMITS " " BLINK_UNAME_V " " BUILD_TIMESTAMP);
+  //strcpy(uts.version, "#" BLINK_COMMITS " " BLINK_UNAME_V " " BUILD_TIMESTAMP);
   memset(u.host, 0, sizeof(u.host));
   gethostname(u.host, sizeof(u.host) - 1);
   strcpy(uts.nodename, u.host);

By the way Blink is a great. I really appreciate this kind of exciting open source projects.

Thanks

jart commented

I'm sorry I can't reproduce this on my Macbook M1 Darwin 21.6.0. I don't understand the above error. Could you help us find a patch that isn't commenting out the code?

My C is really bad so I wasn't able to fix it. Here are more details:

My editor says "too few arguments in function call" for strcpy(uts.version, "#" BLINK_COMMITS " " BLINK_UNAME_V " " BUILD_TIMESTAMP); It can't find the references at all (vs it can find BLINK_VERSION).

image

Let me know if you want me to try any code change (Darwin Kernel Version 22.3.0).

Here is the full output:

make -j4 
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.host -r o// @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.i486 -r o//i486/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.m68k -r o//m68k/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.x86_64 -r o//x86_64/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.x86_64-gcc49 -r o//x86_64-gcc49/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.arm -r o//arm/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.aarch64 -r o//aarch64/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.riscv64 -r o//riscv64/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.mips -r o//mips/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.mipsel -r o//mipsel/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.mips64 -r o//mips64/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.mips64el -r o//mips64el/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.s390x -r o//s390x/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.microblaze -r o//microblaze/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.powerpc -r o//powerpc/ @o//srcs.txt @o//hdrs.txt 2>/dev/null
o//blink/blink build/bootstrap/mkdeps.com -o o//depend.powerpc64le -r o//powerpc64le/ @o//srcs.txt @o//hdrs.txt 2>/dev/null




NOTE: deleting o//depend because of an unspecified prerequisite: CPPFLAGS
NOTE: deleting o//depend because of an unspecified prerequisite: private
NOTE: deleting o//depend because of an unspecified prerequisite: +=
NOTE: deleting o//depend because of an unspecified prerequisite: CFLAGS



rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le
rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le

rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le
rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le




NOTE: deleting o//depend because of an unspecified prerequisite: -O3
NOTE: deleting o//depend because of an unspecified prerequisite: -fno-stack-protector
NOTE: deleting o//depend because of an unspecified prerequisite: -fno-sanitize=all
NOTE: deleting o//depend because of an unspecified prerequisite: -O2

rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le



rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le
rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le
rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le
cc -fno-align-functions -fno-common -pthread -g -O2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -gdwarf-2 -U_FORTIFY_SOURCE -isystem third_party/zlib -D_FILE_OFFSET_BITS=64 -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -iquote.  -c -o o//blink/blink.o blink/blink.c



NOTE: deleting o//depend because of an unspecified prerequisite: -xc
NOTE: deleting o//depend because of an unspecified prerequisite: -w
NOTE: deleting o//depend because of an unspecified prerequisite: -fomit-frame-pointer


rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le

rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le
rm -f o//depend o//depend.host o//depend.i486 o//depend.m68k o//depend.x86_64 o//depend.x86_64-gcc49 o//depend.arm o//depend.aarch64 o//depend.riscv64 o//depend.mips o//depend.mipsel o//depend.mips64 o//depend.mips64el o//depend.s390x o//depend.microblaze o//depend.powerpc o//depend.powerpc64le
cc -fno-align-functions -fno-common -pthread -g -O2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -gdwarf-2 -U_FORTIFY_SOURCE -isystem third_party/zlib -D_FILE_OFFSET_BITS=64 -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -iquote.  -c -o o//blink/blinkenlights.o blink/blinkenlights.c
cc -fno-align-functions -fno-common -pthread -g -O2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -gdwarf-2 -U_FORTIFY_SOURCE -isystem third_party/zlib -D_FILE_OFFSET_BITS=64 -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -iquote.  -c -o o//blink/sse2.o blink/sse2.c
cc -fno-align-functions -fno-common -pthread -g -O2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -gdwarf-2 -U_FORTIFY_SOURCE -isystem third_party/zlib -D_FILE_OFFSET_BITS=64 -D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -iquote.  -c -o o//blink/syscall.o blink/syscall.c
blink/blink.c:209:12: error: expected ')'
  Print(1, VERSION);
           ^
blink/blink.c:54:47: note: expanded from macro 'VERSION'
  "Blink Virtual Machine " BLINK_VERSION " (" BUILD_TIMESTAMP ")\n\
                                              ^
blink/blink.c:209:8: note: to match this '('
  Print(1, VERSION);
       ^
1 error generated.
make: *** [o//blink/blink.o] Error 1
make: *** Waiting for unfinished jobs....
blink/syscall.c:1347:27: error: expected ')'
  strcpy(uts.version, "#" BLINK_COMMITS " " BLINK_UNAME_V " " BUILD_TIMESTAMP);
                          ^
blink/syscall.c:1347:3: note: to match this '('
  strcpy(uts.version, "#" BLINK_COMMITS " " BLINK_UNAME_V " " BUILD_TIMESTAMP);
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/secure/_string.h:84:26: note: expanded from macro 'strcpy'
                __builtin___strcpy_chk (dest, __VA_ARGS__, __darwin_obsz (dest))
                                       ^
blink/blinkenlights.c:3707:9: error: expected ')'
  fputs(VERSION, stdout);
        ^
blink/blinkenlights.c:84:39: note: expanded from macro 'VERSION'
  "Blinkenlights " BLINK_VERSION " (" BUILD_TIMESTAMP ")\n\
                                      ^
blink/blinkenlights.c:3707:8: note: to match this '('
  fputs(VERSION, stdout);
       ^
1 error generated.
make: *** [o//blink/blinkenlights.o] Error 1
1 error generated.
make: *** [o//blink/syscall.o] Error 1

It works if I replace BLINK_COMMITS, BLINK_UNAME_V, BUILD_TIMESTAMP and VERSION or command out them.

jart commented

Could you cat config.mk and share its contents?

jart commented

I think I see the problem. Suspect line is this:

cc -fno-align-functions -fno-common -pthread -g -O2
-fno-omit-frame-pointer -fno-optimize-sibling-calls -gdwarf-2
-U_FORTIFY_SOURCE -isystem third_party/zlib -D_FILE_OFFSET_BITS=64
-D_DARWIN_C_SOURCE -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE
-iquote. -c -o o//blink/syscall.o blink/syscall.c

That means this GNUMakefile code isn't working:

$(BLINK_NEED_BUILDINFO_OBJS): private CPPFLAGS += $(CONFIG_CPPFLAGS)

You are almost certainly using an old version of GNU Make. Here's what I'm using:

$ make --version
Landlock Make 1.4 (GNU Make 4.3)
Built for x86_64-cosmopolitan
Copyright (C) 2022 Justine Alexandra Roberts Tunney
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please upgrade to either: