crazywhalecc / static-php-cli

Build standalone PHP binary on Linux, macOS, FreeBSD, Windows, with PHP project together, with popular extensions included.
https://static-php.dev
MIT License
1.34k stars 234 forks source link

`make -j10` fails on M1 Mac #380

Closed warrickbayman closed 8 months ago

warrickbayman commented 8 months ago

While attempting to build static php binaries for PHP 8.3 or 8.2 I get the following error at the make -j10 step:

[19:51:12] [INFO] [EXEC] make -j10
[19:51:13] [CRIT] Build failed with SPC\exception\RuntimeException: Command run failed with code[2]: cd '/source/pkg-config' && make -j10 1>/dev/null 2>&1
[19:51:13] [CRIT] Please check with --debug option to see more details.

I ran make -j10 myself with --debug and get the following:

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-am' does not exist.
   File `libglib-2.0.la' does not exist.
     File `libglib_2_0_la-gatomic.lo' does not exist.
    Must remake target `libglib_2_0_la-gatomic.lo'.
     File `libglib_2_0_la-gbitlock.lo' does not exist.
    Must remake target `libglib_2_0_la-gbitlock.lo'.
     File `libglib_2_0_la-gbookmarkfile.lo' does not exist.
    Must remake target `libglib_2_0_la-gbookmarkfile.lo'.
     File `libglib_2_0_la-gbytes.lo' does not exist.
    Must remake target `libglib_2_0_la-gbytes.lo'.
     File `libglib_2_0_la-gcharset.lo' does not exist.
    Must remake target `libglib_2_0_la-gcharset.lo'.
     File `libglib_2_0_la-gchecksum.lo' does not exist.
    Must remake target `libglib_2_0_la-gchecksum.lo'.
     File `libglib_2_0_la-gconvert.lo' does not exist.
    Must remake target `libglib_2_0_la-gconvert.lo'.
     File `libglib_2_0_la-gdataset.lo' does not exist.
    Must remake target `libglib_2_0_la-gdataset.lo'.
  CC       libglib_2_0_la-gatomic.lo
     File `libglib_2_0_la-gdate.lo' does not exist.
    Must remake target `libglib_2_0_la-gdate.lo'.
     File `libglib_2_0_la-gdatetime.lo' does not exist.
    Must remake target `libglib_2_0_la-gdatetime.lo'.
     File `libglib_2_0_la-gdir.lo' does not exist.
    Must remake target `libglib_2_0_la-gdir.lo'.
  CC       libglib_2_0_la-gbookmarkfile.lo
  CC       libglib_2_0_la-gcharset.lo
  CC       libglib_2_0_la-gbytes.lo
  CC       libglib_2_0_la-gdatetime.lo
  CC       libglib_2_0_la-gchecksum.lo
  CC       libglib_2_0_la-gbitlock.lo
  CC       libglib_2_0_la-gdataset.lo
  CC       libglib_2_0_la-gconvert.lo
  CC       libglib_2_0_la-gdate.lo
gatomic.c:392:10: error: incompatible integer to pointer conversion passing 'gssize' (aka 'long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_add ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:170:46: note: expanded from macro 'g_atomic_pointer_add'
    (gssize) __sync_fetch_and_add ((atomic), (val));                         \
                                             ^~~~~
gatomic.c:416:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_and ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:177:45: note: expanded from macro 'g_atomic_pointer_and'
    (gsize) __sync_fetch_and_and ((atomic), (val));                          \
                                            ^~~~~
gatomic.c:440:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_or ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:184:44: note: expanded from macro 'g_atomic_pointer_or'
    (gsize) __sync_fetch_and_or ((atomic), (val));                           \
                                           ^~~~~
gatomic.c:464:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_xor ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:191:45: note: expanded from macro 'g_atomic_pointer_xor'
    (gsize) __sync_fetch_and_xor ((atomic), (val));                          \
                                            ^~~~~
4 errors generated.
make[6]: *** [libglib_2_0_la-gatomic.lo] Error 1
make[6]: *** Waiting for unfinished jobs....
gdataset.c:1191:3: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'GData *' (aka 'struct _GData *') [-Wint-conversion]
  g_atomic_pointer_or (datalist, (gsize)flags);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:184:44: note: expanded from macro 'g_atomic_pointer_or'
    (gsize) __sync_fetch_and_or ((atomic), (val));                           \
                                           ^~~~~
gdataset.c:1214:3: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'GData *' (aka 'struct _GData *') [-Wint-conversion]
  g_atomic_pointer_and (datalist, ~(gsize)flags);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:177:45: note: expanded from macro 'g_atomic_pointer_and'
    (gsize) __sync_fetch_and_and ((atomic), (val));                          \
                                            ^~~~~
2 errors generated.
make[6]: *** [libglib_2_0_la-gdataset.lo] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [all] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

I initially tried this with FrankenPHP (dunglas/frankenphp#636), and now tried spc directly.

I'm on MacOS Sanoma 14.3.1 on an M1 Max. I used the following build commands:

./spc download --with-php=8.3 --for-extensions bcmath,ctype,curl,dom,fileinfo,filter,mbstring,openssl,pdo,pdo_sqlite,session,simplexml,sqlite3,tokenizer,xml,zlib

./spc build --build-cli --build-embed "bcmath,ctype,curl,dom,fileinfo,filter,mbstring,openssl,pdo,pdo_sqlite,session,simplexml,sqlite3,tokenizer,xml,zlib"
crazywhalecc commented 8 months ago
  1. Delete buildroot/ and source/ dir and run build command to try again.
  2. Make sure you have proper environments: ./spc doctor.
  3. Make sure your brew and cmake tools are arm64 arch: file $(which cmake) or file $(which clang) etc.

This error message produced by pkg-config build, that's weird. If the problem persists, maybe you can try compiling pkg-config separately: spc build:libs pkg-config --debug, or go directly to source/pkg-config and run ./configure && make.

warrickbayman commented 8 months ago

Thanks for the help. Went through all the following:

  1. Deleted buildroot and source but get the same error when running build.
  2. ./spc doctor returns:
Checking if current OS are supported ... Darwin arm64, supported (but not tested on this distro)
Checking if homebrew has installed ... ok
Checking if necessary tools are installed ... ok
Doctor check complete !
  1. file $(which cmake) returns
/opt/homebrew/bin/cmake: Mach-O 64-bit executable arm64
  1. file $(which clang) returns:
/usr/bin/clang: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/clang (for architecture x86_64):   Mach-O 64-bit executable x86_64
/usr/bin/clang (for architecture arm64e):   Mach-O 64-bit executable arm64e

I get the following when running spc build:libs pkg-config --debug:

gatomic.c:392:10: error: incompatible integer to pointer conversion passing 'gssize' (aka 'long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_add ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:170:46: note: expanded from macro 'g_atomic_pointer_add'
    (gssize) __sync_fetch_and_add ((atomic), (val));                         \
                                             ^~~~~
gatomic.c:416:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_and ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:177:45: note: expanded from macro 'g_atomic_pointer_and'
    (gsize) __sync_fetch_and_and ((atomic), (val));                          \
                                            ^~~~~
gatomic.c:440:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_or ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:184:44: note: expanded from macro 'g_atomic_pointer_or'
    (gsize) __sync_fetch_and_or ((atomic), (val));                           \
                                           ^~~~~
gatomic.c:464:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_xor ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:191:45: note: expanded from macro 'g_atomic_pointer_xor'
    (gsize) __sync_fetch_and_xor ((atomic), (val));                          \
                                            ^~~~~
4 errors generated.
make[6]: *** [libglib_2_0_la-gatomic.lo] Error 1
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [all-recursive] Error 1
make[4]: *** [all] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
[13:21:20] [ERRO] Uncaught SPC\exception\RuntimeException: Command run failed with code[2]: cd '/Users/warrick/Downloads/source/pkg-config' && make -j10 at phar:///Users/warrick/Downloads/spc/src/globals/functions.php(100)
[13:21:20] [ERRO] #0 phar:///Users/warrick/Downloads/spc/src/SPC/util/UnixShell.php(47): f_passthru('cd '/Users/warr...')
#1 phar:///Users/warrick/Downloads/spc/src/SPC/builder/unix/library/pkgconfig.php(33): SPC\util\UnixShell->exec('cd '/Users/warr...')
#2 phar:///Users/warrick/Downloads/spc/src/SPC/builder/LibraryBase.php(144): SPC\builder\macos\library\pkgconfig->build()
#3 phar:///Users/warrick/Downloads/spc/src/SPC/builder/LibraryBase.php(165): SPC\builder\LibraryBase->tryBuild(true)
#4 phar:///Users/warrick/Downloads/spc/src/SPC/builder/unix/UnixBuilderBase.php(143): SPC\builder\LibraryBase->tryBuild(false)
#5 phar:///Users/warrick/Downloads/spc/src/SPC/command/BuildLibsCommand.php(64): SPC\builder\unix\UnixBuilderBase->buildLibs(Array)
#6 phar:///Users/warrick/Downloads/spc/src/SPC/command/BaseCommand.php(99): SPC\command\BuildLibsCommand->handle()
#7 phar:///Users/warrick/Downloads/spc/vendor/symfony/console/Command/Command.php(326): SPC\command\BaseCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 phar:///Users/warrick/Downloads/spc/vendor/symfony/console/Application.php(1078): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 phar:///Users/warrick/Downloads/spc/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(SPC\command\BuildLibsCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 phar:///Users/warrick/Downloads/spc/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 phar:///Users/warrick/Downloads/spc/bin/spc(20): Symfony\Component\Console\Application->run()
#12 /Users/warrick/Downloads/spc(8): require('phar:///Users/w...')
#13 {main}

Running a simple ./configure && make inside source/pkg-config results in the following:

Making all in .
  CC       pkg.o
  CC       parse.o
parse.c:1114:24: warning: Deprecated pre-processor symbol: replace with "g_path_get_dirname" [-W#pragma-messages]
      pkg->pcfiledir = g_dirname (path);
                       ^
/opt/homebrew/Cellar/glib/2.78.3/include/glib-2.0/glib/gfileutils.h:208:38: note: expanded from macro 'g_dirname'
#define g_dirname g_path_get_dirname GLIB_DEPRECATED_MACRO_IN_2_26_FOR(g_path_get_dirname)
                                     ^
/opt/homebrew/Cellar/glib/2.78.3/include/glib-2.0/glib/glib-visibility.h:40:46: note: expanded from macro 'GLIB_DEPRECATED_MACRO_IN_2_26_FOR'
#define GLIB_DEPRECATED_MACRO_IN_2_26_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f)
                                             ^
/opt/homebrew/Cellar/glib/2.78.3/include/glib-2.0/glib/gmacros.h:1299:3: note: expanded from macro 'GLIB_DEPRECATED_MACRO_FOR'
  _GLIB_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Deprecated pre-processor symbol: replace with #f))
  ^
/opt/homebrew/Cellar/glib/2.78.3/include/glib-2.0/glib/gmacros.h:1296:33: note: expanded from macro '_GLIB_GNUC_DO_PRAGMA'
#define _GLIB_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
                                ^
<scratch space>:99:6: note: expanded from here
 GCC warning "Deprecated pre-processor symbol: replace with \"g_path_get_dirname\""
     ^
1 warning generated.
  CC       rpmvercmp.o
  CC       main.o
  CCLD     pkg-config
Making all in check
make[2]: Nothing to be done for `all'.

Happy to run any tests you need.

crazywhalecc commented 8 months ago

Could you please provide the complete log output by the terminal and the source/pkg-config/config.log file? This may caused by system build tools.

warrickbayman commented 8 months ago

config.log

./spc build --build-cli --build-embed "bcmath,ctype,curl,dom,fileinfo,filter,mbstring,openssl,pdo,pdo_sqlite,session,simplexml,sqlite3,tokenizer,xml,zlib"
     _        _   _                 _
 ___| |_ __ _| |_(_) ___      _ __ | |__  _ __
/ __| __/ _` | __| |/ __|____| '_ \| '_ \| '_ \
\__ \ || (_| | |_| | (_|_____| |_) | | | | |_) |
|___/\__\__,_|\__|_|\___|    | .__/|_| |_| .__/   v2.1.5
                             |_|         |_|
[18:57:28] [INFO] [EXEC] sysctl -n hw.ncpu
[18:57:28] [INFO] Build OS:        Darwin (arm64)
[18:57:28] [INFO] Build SAPI:      cli, embed
[18:57:28] [INFO] Extensions (16): bcmath,ctype,curl,dom,fileinfo,filter,mbstring,zlib,openssl,pdo,sqlite3,pdo_sqlite,session,simplexml,tokenizer,xml
[18:57:28] [INFO] Libraries (6):   zlib,openssl,libiconv,libxml2,curl,sqlite
[18:57:28] [INFO] Strip Binaries:  yes
[18:57:28] [INFO] Enable ZTS:      no
[18:57:28] [INFO] PHP Version:     8.2.16
[18:57:28] [NOTI] Build will start after 2s ...
[18:57:30] [INFO] extracting pkg-config source to /Users/warrick/Downloads/source/pkg-config ...
[18:57:30] [INFO] extracting zlib source to /Users/warrick/Downloads/source/zlib ...
[18:57:30] [INFO] extracting openssl source to /Users/warrick/Downloads/source/openssl ...
[18:57:31] [INFO] extracting libiconv source to /Users/warrick/Downloads/source/libiconv ...
[18:57:31] [INFO] extracting libxml2 source to /Users/warrick/Downloads/source/libxml2 ...
[18:57:32] [INFO] extracting curl source to /Users/warrick/Downloads/source/curl ...
[18:57:32] [INFO] extracting sqlite source to /Users/warrick/Downloads/source/sqlite ...
[18:57:32] [INFO] Building required library [pkg-config]
[18:57:32] [INFO] Entering dir: /Users/warrick/Downloads/source/pkg-config
[18:57:32] [INFO] [EXEC] CFLAGS='--target=arm64-apple-darwin -Wimplicit-function-declaration' ./configure --disable-shared --enable-static --with-internal-glib --disable-host-tool --with-pic --prefix=/Users/warrick/Downloads/buildroot --without-sysroot --without-system-include-path --without-system-library-path --without-pc-path
[18:58:09] [INFO] [EXEC] make clean
[18:58:09] [INFO] [EXEC] make -j10
[18:58:10] [CRIT] Build failed with SPC\exception\RuntimeException: Command run failed with code[2]: cd '/Users/warrick/Downloads/source/pkg-config' && make -j10 1>/dev/null 2>&1
[18:58:10] [CRIT] Please check with --debug option to see more details.
make -j10 --debug
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all' does not exist.
Must remake target `all'.
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-recursive' does not exist.
Must remake target `all-recursive'.
Making all in glib
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all' does not exist.
Must remake target `all'.
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-recursive' does not exist.
Must remake target `all-recursive'.
Making all in .
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-am' does not exist.
Must remake target `all-am'.
Successfully remade target file `all-am'.
make[4]: Nothing to be done for `all-am'.
Making all in m4macros
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all' does not exist.
Must remake target `all'.
/Library/Developer/CommandLineTools/usr/bin/make  all-am
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-am' does not exist.
Must remake target `all-am'.
Successfully remade target file `all-am'.
make[5]: Nothing to be done for `all-am'.
Making all in glib
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all' does not exist.
Must remake target `all'.
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-recursive' does not exist.
Must remake target `all-recursive'.
Making all in libcharset
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all' does not exist.
Must remake target `all'.
/Library/Developer/CommandLineTools/usr/bin/make  all-am
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-am' does not exist.
   File `all-local' does not exist.
  Must remake target `all-local'.
  Successfully remade target file `all-local'.
Must remake target `all-am'.
Successfully remade target file `all-am'.
make[7]: Nothing to be done for `all-am'.
Making all in gnulib
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all' does not exist.
Must remake target `all'.
/Library/Developer/CommandLineTools/usr/bin/make  all-am
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-am' does not exist.
Must remake target `all-am'.
Successfully remade target file `all-am'.
make[7]: Nothing to be done for `all-am'.
Making all in .
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Updating goal targets....
 File `all-am' does not exist.
   File `libglib-2.0.la' does not exist.
     File `libglib_2_0_la-gatomic.lo' does not exist.
    Must remake target `libglib_2_0_la-gatomic.lo'.
     File `libglib_2_0_la-gbitlock.lo' does not exist.
    Must remake target `libglib_2_0_la-gbitlock.lo'.
     File `libglib_2_0_la-gbookmarkfile.lo' does not exist.
    Must remake target `libglib_2_0_la-gbookmarkfile.lo'.
     File `libglib_2_0_la-gbytes.lo' does not exist.
    Must remake target `libglib_2_0_la-gbytes.lo'.
     File `libglib_2_0_la-gcharset.lo' does not exist.
    Must remake target `libglib_2_0_la-gcharset.lo'.
     File `libglib_2_0_la-gchecksum.lo' does not exist.
    Must remake target `libglib_2_0_la-gchecksum.lo'.
  CC       libglib_2_0_la-gatomic.lo
     File `libglib_2_0_la-gconvert.lo' does not exist.
    Must remake target `libglib_2_0_la-gconvert.lo'.
     File `libglib_2_0_la-gdataset.lo' does not exist.
    Must remake target `libglib_2_0_la-gdataset.lo'.
     File `libglib_2_0_la-gdate.lo' does not exist.
    Must remake target `libglib_2_0_la-gdate.lo'.
     File `libglib_2_0_la-gdatetime.lo' does not exist.
    Must remake target `libglib_2_0_la-gdatetime.lo'.
     File `libglib_2_0_la-gdir.lo' does not exist.
    Must remake target `libglib_2_0_la-gdir.lo'.
  CC       libglib_2_0_la-gbookmarkfile.lo
  CC       libglib_2_0_la-gchecksum.lo
  CC       libglib_2_0_la-gbytes.lo
  CC       libglib_2_0_la-gbitlock.lo
  CC       libglib_2_0_la-gdataset.lo
  CC       libglib_2_0_la-gconvert.lo
  CC       libglib_2_0_la-gdate.lo
  CC       libglib_2_0_la-gdatetime.lo
  CC       libglib_2_0_la-gcharset.lo
gatomic.c:392:10: error: incompatible integer to pointer conversion passing 'gssize' (aka 'long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_add ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:170:46: note: expanded from macro 'g_atomic_pointer_add'
    (gssize) __sync_fetch_and_add ((atomic), (val));                         \
                                             ^~~~~
gatomic.c:416:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_and ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:177:45: note: expanded from macro 'g_atomic_pointer_and'
    (gsize) __sync_fetch_and_and ((atomic), (val));                          \
                                            ^~~~~
gatomic.c:440:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_or ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:184:44: note: expanded from macro 'g_atomic_pointer_or'
    (gsize) __sync_fetch_and_or ((atomic), (val));                           \
                                           ^~~~~
gatomic.c:464:10: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'gpointer' (aka 'void *') [-Wint-conversion]
  return g_atomic_pointer_xor ((volatile gpointer *) atomic, val);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:191:45: note: expanded from macro 'g_atomic_pointer_xor'
    (gsize) __sync_fetch_and_xor ((atomic), (val));                          \
                                            ^~~~~
4 errors generated.
gdataset.c:1191:3: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'GData *' (aka 'struct _GData *') [-Wint-conversion]
  g_atomic_pointer_or (datalist, (gsize)flags);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:184:44: note: expanded from macro 'g_atomic_pointer_or'
    (gsize) __sync_fetch_and_or ((atomic), (val));                           \
                                           ^~~~~
gdataset.c:1214:3: error: incompatible integer to pointer conversion passing 'gsize' (aka 'unsigned long') to parameter of type 'GData *' (aka 'struct _GData *') [-Wint-conversion]
  g_atomic_pointer_and (datalist, ~(gsize)flags);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./gatomic.h:177:45: note: expanded from macro 'g_atomic_pointer_and'
    (gsize) __sync_fetch_and_and ((atomic), (val));                          \
                                            ^~~~~
2 errors generated.
make[6]: *** [libglib_2_0_la-gatomic.lo] Error 1
make[6]: *** Waiting for unfinished jobs....
make[6]: *** [libglib_2_0_la-gdataset.lo] Error 1
make[5]: *** [all-recursive] Error 1
make[4]: *** [all] Error 2
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
crazywhalecc commented 8 months ago

I cannot download config.log and terminal output does not enable --debug full log. It would be better if you could send these two contents in files. 🙌

leonboot commented 8 months ago

Hi!

I'm experiencing the same issue. I've attached the output of ./spc build and the config.log from the source/pkg-config directory. I'm hoping this will shed some light on the issue!

config.log output.txt

crazywhalecc commented 8 months ago

Hi, @leonboot , I don't know your environment setup, but I guess this may caused by some redundant cflags.

You can try this:

  1. Clone repository, run static-php-cli as source mode: bin/spc build. (you need to install dev environment first, including php-cli)
  2. Open src/SPC/builder/unix/library/pkgconfig.php, edit ->exec("make -j{$this->builder->concurrency}") line, add CFLAGS='-Wno-error': (e.g. ->exec("make -j{$this->builder->concurrency} CFLAGS='-Wno-error'").
  3. downloads dir you can reuse the download cache you just downloaded before for spc.
  4. Compile pkg-config separately: bin/spc build:libs pkg-config --debug and see what happen (Remember removing buildroot and source dir first).

If it works, I'll add patch code and fix it next version.

leonboot commented 8 months ago

Hi @crazywhalecc, thanks for the response. I've followed your instructions, but it doesn't seem to make any difference. Here are the exact steps I've done:

Here's the output of the last command: output.txt

I have an M2 Mac with macOS Sanoma 14.4 and Xcode 15.3 installed. Here's a list of homebrew packages/formulae I have installed: homebrew.txt

warrickbayman commented 8 months ago

Hi @crazywhalecc. I've done the same and heres the output: output.txt

And installed homebrew packages: homebrew.txt

crazywhalecc commented 8 months ago

Seems related to https://gitlab.freedesktop.org/pkg-config/pkg-config/-/issues/81 pkg-config's dependency glib fixed this problem in October 2023, but pkg-config has not been updated in seven years.

warrickbayman commented 8 months ago

Wow. I gave it a try and 'Wno-int-conversion' flag gets round the errors. Will give it a full try a bit later.

output.txt

Thanks for the help!

crazywhalecc commented 8 months ago

Yeah, -Wno-int-conversion can fix it, I will create PR for it